Base Provider

class llm_async.providers.base.BaseProvider(api_key: str, base_url: str = '', retry_config: RetryConfig | None = None, client_kwargs: dict | None = None, http2: bool = False)[source]

Bases: object

BASE_URL = None[source]
async acomplete(model: str, messages: Sequence[Message | Mapping[str, Any]], stream: bool = False, tools: list[Tool] | None = None, tool_choice: str | dict[str, Any] | None = None, response_schema: ResponseSchema | Mapping[str, Any] | None = None, headers: HeadersType | None = None, **kwargs: Any) Response[source]
async execute_tool(tool_call: ToolCall, tools_map: dict[str, Callable[[...], Any]]) dict[str, Any][source]

Execute tools and return results in provider-specific format.

classmethod name() str[source]
async request(method: Literal['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], path: str, json_data: dict[str, Any] | None = None, headers: HeadersType | None = None, **kwargs: Any) dict[str, Any][source]

Make a request to the provider’s API.

Args:

method: HTTP method (GET, POST, PUT, DELETE, PATCH) path: API endpoint path (e.g., “/v1/models”) json_data: JSON body for POST/PUT/PATCH requests **kwargs: Additional headers to include

Returns:

The JSON response from the API