模擬模式中工具行為的設定。
| JSON 表示法 |
|---|
{
"enableFakeMode": boolean,
// The following is a list of mutually exclusive fields. At most one of the
// fields will be set in a response:
"codeBlock": {
object ( |
| 欄位 | |
|---|---|
enableFakeMode |
選用。工具是否使用模擬模式。 |
| 回應可以是靜態,也可以由 Python 函式提供。以下列出互斥欄位。回應中最多會設定一個欄位: | |
codeBlock |
選用。要執行的程式碼區塊,而非實際的工具呼叫。 |
| 互斥欄位的結尾。 | |
CodeBlock
要執行的程式碼區塊,而非實際的工具呼叫。
| JSON 表示法 |
|---|
{ "pythonCode": string } |
| 欄位 | |
|---|---|
pythonCode |
這是必要旗標,在工具模擬模式中呼叫的 Python 程式碼。預期的 Python 函式簽章 - 如要擷取所有工具呼叫: def fake_tool_call(tool: Tool, input: dict[str, Any], callback_context: CallbackContext) -> Optional[dict[str, Any]]: 如要擷取特定工具呼叫: def fake_{toolId}(tool: Tool, input: dict[str, Any], callback_context: CallbackContext) -> Optional[dict[str, Any]]: 如果函式傳回 None,系統會改為叫用實際工具。 |