This PR introduces both synchronous and asynchronous Arcade client implementations, providing a robust interface for interacting with the Arcade API. ## Key Features 1. Synchronous (`SyncArcade`) and Asynchronous (`AsyncArcade`) clients 2. Authentication and Tool resources 3. OpenAI chat completions integration 4. Comprehensive error handling ## Client Methods Both `SyncArcade` and `AsyncArcade` offer: - `auth.authorize()`: Initiate authorization - `auth.poll_authorization()`: Check authorization status - `tool.run()`: Execute a tool - `tool.get()`: Retrieve tool specification - `chat.create()`: Create chat completions ## Usage Examples ### Synchronous Authorization ```python from arcade.client import AuthProvider, SyncArcade client = SyncArcade(base_url="https://api.arcade.com", api_key="your_api_key") auth_response = client.auth.authorize( provider=AuthProvider.google, scopes=["https://www.googleapis.com/auth/gmail.readonly"], user_id="user123" ) print(f"Authorize at: {auth_response.auth_url}") ``` ### Asynchronous Authorization ```python import asyncio from arcade.client import AuthProvider, AsyncArcade async def authorize(): client = AsyncArcade(base_url="https://api.arcade.com", api_key="your_api_key") auth_response = await client.auth.authorize( provider=AuthProvider.slack_user, scopes=["chat:write", "im:write"], user_id="user456" ) print(f"Authorize at: {auth_response.auth_url}") asyncio.run(authorize()) ``` This implementation provides a flexible and powerful way to interact with Arcade services, supporting both synchronous and asynchronous workflows.
8 lines
167 B
Python
8 lines
167 B
Python
from arcade.client.client import Arcade, AsyncArcade
|
|
from arcade.client.schema import AuthProvider
|
|
|
|
__all__ = [
|
|
"AuthProvider",
|
|
"AsyncArcade",
|
|
"Arcade",
|
|
]
|