diff --git a/.vscode/launch.json b/.vscode/launch.json index b41c86d9..2d012c69 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -29,11 +29,11 @@ "cwd": "${workspaceFolder}" }, { - "name": "Debug `arcade chat -s -h localhost`", + "name": "Debug `arcade chat -s -d -h localhost`", "type": "python", "request": "launch", "program": "${workspaceFolder}/arcade/run_cli.py", - "args": ["chat", "-s", "-h", "localhost"], + "args": ["chat", "-d", "-h", "localhost"], "console": "integratedTerminal", "jinja": true, "justMyCode": true, diff --git a/arcade/arcade/actor/core/base.py b/arcade/arcade/actor/core/base.py index a1182679..8576d7c6 100644 --- a/arcade/arcade/actor/core/base.py +++ b/arcade/arcade/actor/core/base.py @@ -122,11 +122,11 @@ class BaseActor(Actor): "environment": self.environment, }, ) - invocation_id = tool_request.invocation_id or "" + execution_id = tool_request.execution_id or "" logger.info( - f"{invocation_id} | Calling tool: {tool_fqname} version: {tool_request.tool.version}" + f"{execution_id} | Calling tool: {tool_fqname} version: {tool_request.tool.version}" ) - logger.debug(f"{invocation_id} | Tool inputs: {tool_request.inputs}") + logger.debug(f"{execution_id} | Tool inputs: {tool_request.inputs}") tracer = trace.get_tracer(__name__) with tracer.start_as_current_span("RunTool"): @@ -144,27 +144,27 @@ class BaseActor(Actor): if output.error: logger.warning( - f"{invocation_id} | Tool {tool_fqname} version {tool_request.tool.version} failed" + f"{execution_id} | Tool {tool_fqname} version {tool_request.tool.version} failed" ) - logger.warning(f"{invocation_id} | Tool error: {output.error.message}") + logger.warning(f"{execution_id} | Tool error: {output.error.message}") logger.warning( - f"{invocation_id} | Tool developer message: {output.error.developer_message}" + f"{execution_id} | Tool developer message: {output.error.developer_message}" ) logger.debug( - f"{invocation_id} | duration: {duration_ms}ms | Tool output: {output.value}" + f"{execution_id} | duration: {duration_ms}ms | Tool output: {output.value}" ) if output.error.traceback_info: - logger.debug(f"{invocation_id} | Tool traceback: {output.error.traceback_info}") + logger.debug(f"{execution_id} | Tool traceback: {output.error.traceback_info}") else: logger.info( - f"{invocation_id} | Tool {tool_fqname} version {tool_request.tool.version} success" + f"{execution_id} | Tool {tool_fqname} version {tool_request.tool.version} success" ) logger.debug( - f"{invocation_id} | duration: {duration_ms}ms | Tool output: {output.value}" + f"{execution_id} | duration: {duration_ms}ms | Tool output: {output.value}" ) return ToolCallResponse( - invocation_id=invocation_id, + execution_id=execution_id, duration=duration_ms, finished_at=datetime.now().isoformat(), success=not output.error, diff --git a/arcade/arcade/cli/utils.py b/arcade/arcade/cli/utils.py index 86d68598..f79be3d9 100644 --- a/arcade/arcade/cli/utils.py +++ b/arcade/arcade/cli/utils.py @@ -412,8 +412,8 @@ def handle_tool_authorization( stream: bool, ) -> ChatInteractionResult: with Live(console=console, refresh_per_second=4) as live: - if tool_authorization.authorization_url: - authorization_url = str(tool_authorization.authorization_url) + if tool_authorization.url: # type: ignore[attr-defined] + authorization_url = str(tool_authorization.url) # type: ignore[attr-defined] webbrowser.open(authorization_url) message = ( "You'll need to authorize this action in your browser.\n\n" @@ -446,7 +446,7 @@ def wait_for_authorization_completion( while auth_response.status != "completed": try: auth_response = client.auth.status( - authorization_id=cast(str, auth_response.authorization_id), + authorization_id=cast(str, auth_response.id), # type: ignore[attr-defined] scopes=" ".join(auth_response.scopes) if auth_response.scopes else NOT_GIVEN, wait=59, ) diff --git a/arcade/arcade/core/schema.py b/arcade/arcade/core/schema.py index 5c615043..5a91021f 100644 --- a/arcade/arcade/core/schema.py +++ b/arcade/arcade/core/schema.py @@ -244,8 +244,8 @@ class ToolCallRequest(BaseModel): run_id: str | None = None """The globally-unique run ID provided by the Engine.""" - invocation_id: str | None = None - """The globally-unique ID for this tool invocation in the run.""" + execution_id: str | None = None + """The globally-unique ID for this tool execution in the run.""" created_at: str | None = None """The timestamp when the tool invocation was created.""" tool: ToolReference @@ -311,13 +311,13 @@ class ToolCallOutput(BaseModel): class ToolCallResponse(BaseModel): """The response to a tool invocation.""" - invocation_id: str - """The globally-unique ID for this tool invocation.""" + execution_id: str + """The globally-unique ID for this tool execution.""" finished_at: str - """The timestamp when the tool invocation finished.""" + """The timestamp when the tool execution finished.""" duration: float - """The duration of the tool invocation in milliseconds (ms).""" + """The duration of the tool execution in milliseconds (ms).""" success: bool - """Whether the tool invocation was successful.""" + """Whether the tool execution was successful.""" output: ToolCallOutput | None = None """The output of the tool invocation.""" diff --git a/schemas/preview/invoke_tool_request.schema.jsonc b/schemas/preview/invoke_tool_request.schema.jsonc index 51ecd1ae..4cf21e03 100644 --- a/schemas/preview/invoke_tool_request.schema.jsonc +++ b/schemas/preview/invoke_tool_request.schema.jsonc @@ -9,11 +9,11 @@ }, "run_id": { "type": "string", - "description": "ID of the overall run" + "description": "The globally-unique run ID provided by the Engine." }, - "invocation_id": { + "execution_id": { "type": "string", - "description": "ID of this specific tool call" + "description": "The globally-unique ID for this tool execution in the run." }, "created_at": { "type": "string", diff --git a/schemas/preview/invoke_tool_response.schema.jsonc b/schemas/preview/invoke_tool_response.schema.jsonc index e5098a8a..eb4c79c5 100644 --- a/schemas/preview/invoke_tool_response.schema.jsonc +++ b/schemas/preview/invoke_tool_response.schema.jsonc @@ -7,9 +7,9 @@ "type": "string", "format": "uri" }, - "invocation_id": { + "execution_id": { "type": "string", - "description": "ID of this specific tool call" + "description": "The globally-unique ID for this tool execution." }, "duration": { "type": "number", @@ -17,11 +17,12 @@ }, "finished_at": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The timestamp when the tool execution finished." }, "success": { "type": "boolean", - "description": "Whether the tool call was successful" + "description": "Whether the tool execution was successful" }, "output": { // Can be null/omitted, in the case of a null-returning (void) function @@ -81,15 +82,15 @@ "requires_authorization": { "type": "object", "properties": { - "authorization_url": { + "id": { + "type": "string", + "description": "The ID for checking the status of the authorization" + }, + "url": { "type": "string", "format": "uri", "description": "The URL to redirect the user to for authorization" }, - "authorization_id": { - "type": "string", - "description": "The ID for checking the status of the authorization" - }, "scopes": { "type": "array", "items": { @@ -102,7 +103,7 @@ "description": "The status of the authorization" } }, - "required": ["status"], + "required": ["id", "status"], "additionalProperties": false } },