0.6.0 (latest) 0.5.0 0.4.4 0.3.0 0.2.0 0.1.1 Reference documentation and code samples for the Google Cloud Ces V1 Client class CodeBlock.

A code block to be executed instead of a real tool call.

Generated from protobuf message `google.cloud.ces.v1.CodeBlock`

## Namespace

Google \\ Cloud \\ Ces \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ python_code` | `string` Required. Python code which will be invoked in tool fake mode. Expected Python function signature - To catch all tool calls: def fake_tool_call(tool: Tool, input: dict\[str, Any\], callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]: To catch a specific tool call: def fake_{tool_id}(tool: Tool, input: dict\[str, Any\], callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]: If the function returns None, the real tool will be invoked instead. |

### getPythonCode

Required. Python code which will be invoked in tool fake mode.

Expected Python function signature -
To catch all tool calls:
def fake_tool_call(tool: Tool, input: dict\[str, Any\],
callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]:
To catch a specific tool call:
def fake_{tool_id}(tool: Tool, input: dict\[str, Any\],
callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]:
If the function returns None, the real tool will be invoked instead.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setPythonCode

Required. Python code which will be invoked in tool fake mode.

Expected Python function signature -
To catch all tool calls:
def fake_tool_call(tool: Tool, input: dict\[str, Any\],
callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]:
To catch a specific tool call:
def fake_{tool_id}(tool: Tool, input: dict\[str, Any\],
callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]:
If the function returns None, the real tool will be invoked instead.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |