diff --git a/arcade/arcade/cli/main.py b/arcade/arcade/cli/main.py index e92ca210..84ac7a7f 100644 --- a/arcade/arcade/cli/main.py +++ b/arcade/arcade/cli/main.py @@ -7,7 +7,7 @@ from typing import Any, Optional import typer from arcadepy import Arcade -from arcadepy.types import AuthorizationResponse +from arcadepy.types import AuthAuthorizationResponse from openai import OpenAI, OpenAIError from rich.console import Console from rich.markup import escape @@ -271,7 +271,7 @@ def chat( if tool_authorization and is_authorization_pending(tool_authorization): chat_result = handle_tool_authorization( client, - AuthorizationResponse.model_validate(tool_authorization), + AuthAuthorizationResponse.model_validate(tool_authorization), history, openai_client, model, diff --git a/arcade/arcade/cli/utils.py b/arcade/arcade/cli/utils.py index f79be3d9..7dafa4e3 100644 --- a/arcade/arcade/cli/utils.py +++ b/arcade/arcade/cli/utils.py @@ -12,7 +12,7 @@ from urllib.parse import urlencode, urlparse import idna import typer from arcadepy import NOT_GIVEN, APIConnectionError, APIStatusError, APITimeoutError, Arcade -from arcadepy.types import AuthorizationResponse +from arcadepy.types import AuthAuthorizationResponse from openai import OpenAI from openai.resources.chat.completions import ChatCompletionChunk, Stream from openai.types.chat.chat_completion import Choice as ChatCompletionChoice @@ -404,7 +404,7 @@ def handle_chat_interaction( def handle_tool_authorization( arcade_client: Arcade, - tool_authorization: AuthorizationResponse, + tool_authorization: AuthAuthorizationResponse, history: list[dict[str, Any]], openai_client: OpenAI, model: str, @@ -412,8 +412,8 @@ def handle_tool_authorization( stream: bool, ) -> ChatInteractionResult: with Live(console=console, refresh_per_second=4) as live: - if tool_authorization.url: # type: ignore[attr-defined] - authorization_url = str(tool_authorization.url) # type: ignore[attr-defined] + if tool_authorization.url: + authorization_url = str(tool_authorization.url) webbrowser.open(authorization_url) message = ( "You'll need to authorize this action in your browser.\n\n" @@ -432,7 +432,7 @@ def handle_tool_authorization( def wait_for_authorization_completion( - client: Arcade, tool_authorization: AuthorizationResponse | None + client: Arcade, tool_authorization: AuthAuthorizationResponse | None ) -> None: """ Wait for the authorization for a tool call to complete i.e., wait for the user to click on @@ -441,13 +441,12 @@ def wait_for_authorization_completion( if tool_authorization is None: return - auth_response = AuthorizationResponse.model_validate(tool_authorization) + auth_response = AuthAuthorizationResponse.model_validate(tool_authorization) while auth_response.status != "completed": try: auth_response = client.auth.status( - authorization_id=cast(str, auth_response.id), # type: ignore[attr-defined] - scopes=" ".join(auth_response.scopes) if auth_response.scopes else NOT_GIVEN, + id=cast(str, auth_response.id), wait=59, ) except APITimeoutError: diff --git a/arcade/pyproject.toml b/arcade/pyproject.toml index 5383d304..ec559c74 100644 --- a/arcade/pyproject.toml +++ b/arcade/pyproject.toml @@ -23,7 +23,7 @@ toml = "^0.10.2" pyyaml = "^6.0" tomlkit = "^0.12.4" openai = "^1.36.0" # TODO: relax to an earlier version that still has what we need -arcadepy = "~0.2.0" +arcadepy = "1.0.0rc1" pyjwt = "^2.8.0" loguru = "^0.7.0" tqdm = "^4.1.0"