# providers
## <ApiType type="Attribute" slug="k-n-o-w-n_-p-r-o-v-i-d-e-r_-i-d-s" symbolName="KNOWN_PROVIDER_IDS" /> KNOWN_PROVIDER_IDS
**Type:** <TypeLink type={{"type_str": "get_args(KnownProviderId)", "description": null, "kind": "simple", "symbol_name": "get_args(KnownProviderId)", "doc_url": null}} />
## <ApiType type="Attribute" slug="anthropic-model-id" symbolName="AnthropicModelId" /> AnthropicModelId
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
The Anthropic model ids registered with Mirascope.
## <ApiType type="Class" slug="anthropic-provider" symbolName="AnthropicProvider" /> AnthropicProvider
The client for the Anthropic LLM model.
**Bases:**
<TypeLink type={{"type_str": "BaseProvider[Anthropic]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseProvider", "description": null, "kind": "simple", "symbol_name": "BaseProvider", "doc_url": "/docs/api/llm/providers#base-provider"}, "parameters": [{"type_str": "Anthropic", "description": null, "kind": "simple", "symbol_name": "Anthropic", "doc_url": null}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "'anthropic'",
"description": null,
"kind": "simple",
"symbol_name": "'anthropic'",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "'anthropic/'",
"description": null,
"kind": "simple",
"symbol_name": "'anthropic/'",
"doc_url": null
}
},
{
"name": "error_map",
"type_info": {
"type_str": "_utils.ANTHROPIC_ERROR_MAP",
"description": null,
"kind": "simple",
"symbol_name": "_utils.ANTHROPIC_ERROR_MAP",
"doc_url": null
}
},
{
"name": "client",
"type_info": {
"type_str": "Anthropic(api_key=api_key, base_url=base_url)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "async_client",
"type_info": {
"type_str": "AsyncAnthropic(api_key=api_key, base_url=base_url)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-anthropic-provider--anthropic-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from Anthropic exception.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}}
/>
## <ApiType type="Class" slug="base-open-a-i-completions-provider" symbolName="BaseOpenAICompletionsProvider" /> BaseOpenAICompletionsProvider
Base class for providers that use OpenAI Completions-compatible APIs.
**Bases:**
<TypeLink type={{"type_str": "BaseProvider[OpenAI]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseProvider", "description": null, "kind": "simple", "symbol_name": "BaseProvider", "doc_url": "/docs/api/llm/providers#base-provider"}, "parameters": [{"type_str": "OpenAI", "description": null, "kind": "simple", "symbol_name": "OpenAI", "doc_url": null}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "str | list[str]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "list[str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"symbol_name": "list",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "default_base_url",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "api_key_env_var",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
},
{
"name": "api_key_required",
"type_info": {
"type_str": "bool",
"description": null,
"kind": "simple",
"symbol_name": "bool",
"doc_url": null
}
},
{
"name": "provider_name",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "error_map",
"type_info": {
"type_str": "_shared_utils.OPENAI_ERROR_MAP",
"description": null,
"kind": "simple",
"symbol_name": "_shared_utils.OPENAI_ERROR_MAP",
"doc_url": null
}
},
{
"name": "client",
"type_info": {
"type_str": "OpenAI(api_key=effective_api_key, base_url=resolved_base_url)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "async_client",
"type_info": {
"type_str": "AsyncOpenAI(api_key=effective_api_key, base_url=resolved_base_url)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-openai-completions-base_provider--base-open-a-i-completions-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from OpenAI exception.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}}
/>
## <ApiType type="Class" slug="base-provider" symbolName="BaseProvider" /> BaseProvider
Base abstract provider for LLM interactions.
This class defines explicit methods for each type of call, eliminating
the need for complex overloads in provider implementations.
**Bases:**
<TypeLink type={{"type_str": "Generic[ProviderClientT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "ProviderClientT", "description": null, "kind": "simple", "symbol_name": "ProviderClientT", "doc_url": null}], "doc_url": null}} />, <TypeLink type={{"type_str": "ABC", "description": null, "kind": "simple", "symbol_name": "ABC", "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "ProviderId",
"description": null,
"kind": "simple",
"symbol_name": "ProviderId",
"doc_url": null
},
"description": "Provider identifier (e.g., \"anthropic\", \"openai\")."
},
{
"name": "default_scope",
"type_info": {
"type_str": "str | list[str]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "list[str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"symbol_name": "list",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Default scope(s) for this provider when explicitly registered.\n\nCan be a single scope string or a list of scopes. For example:\n- \"anthropic/\" - Single scope\n- [\"anthropic/\", \"openai/\"] - Multiple scopes (e.g., for AWS Bedrock)"
},
{
"name": "error_map",
"type_info": {
"type_str": "ProviderErrorMap",
"description": null,
"kind": "simple",
"symbol_name": "ProviderErrorMap",
"doc_url": null
},
"description": "Mapping from provider SDK exceptions to Mirascope error types.\n\nValues can be:\n- Error type: Simple 1:1 mapping (e.g., AnthropicRateLimitError -> RateLimitError)\n- Callable: Transform function returning error type based on exception details\n (e.g., lambda e: NotFoundError if e.code == \"model_not_found\" else BadRequestError)\n\nThe mapping is walked via the exception's MRO, allowing both specific error handling\nand fallback to base SDK error types (e.g., AnthropicError -> ProviderError)."
},
{
"name": "client",
"type_info": {
"type_str": "ProviderClientT",
"description": null,
"kind": "simple",
"symbol_name": "ProviderClientT",
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-call" symbolName="call" /> call
Generate an `llm.Response` by synchronously calling this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[Tool] | Toolkit | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[Tool]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Tool",
"description": null,
"kind": "simple",
"symbol_name": "Tool",
"doc_url": "/docs/api/llm/tools#tool"
}
],
"doc_url": null
},
{
"type_str": "Toolkit",
"description": null,
"kind": "simple",
"symbol_name": "Toolkit",
"doc_url": "/docs/api/llm/tools#toolkit"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Response | Response[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Response",
"description": null,
"kind": "simple",
"symbol_name": "Response",
"doc_url": "/docs/api/llm/responses#response"
},
{
"type_str": "Response[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Response",
"description": null,
"kind": "simple",
"symbol_name": "Response",
"doc_url": "/docs/api/llm/responses#response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.Response` object containing the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_call" symbolName="context_call" /> context_call
Generate an `llm.ContextResponse` by synchronously calling this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[Tool | ContextTool[DepsT]] | ContextToolkit[DepsT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[Tool | ContextTool[DepsT]]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Tool | ContextTool[DepsT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Tool",
"description": null,
"kind": "simple",
"symbol_name": "Tool",
"doc_url": "/docs/api/llm/tools#tool"
},
{
"type_str": "ContextTool[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextTool",
"description": null,
"kind": "simple",
"symbol_name": "ContextTool",
"doc_url": "/docs/api/llm/tools#context-tool"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "ContextToolkit[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextToolkit",
"description": null,
"kind": "simple",
"symbol_name": "ContextToolkit",
"doc_url": "/docs/api/llm/tools#context-toolkit"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "ContextResponse[DepsT, None] | ContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ContextResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextResponse",
"doc_url": "/docs/api/llm/responses#context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "ContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextResponse",
"doc_url": "/docs/api/llm/responses#context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.ContextResponse` object containing the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-call_async" symbolName="call_async" /> call_async
Generate an `llm.AsyncResponse` by asynchronously calling this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[AsyncTool] | AsyncToolkit | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[AsyncTool]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "AsyncTool",
"description": null,
"kind": "simple",
"symbol_name": "AsyncTool",
"doc_url": "/docs/api/llm/tools#async-tool"
}
],
"doc_url": null
},
{
"type_str": "AsyncToolkit",
"description": null,
"kind": "simple",
"symbol_name": "AsyncToolkit",
"doc_url": "/docs/api/llm/tools#async-toolkit"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncResponse | AsyncResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncResponse",
"doc_url": "/docs/api/llm/responses#async-response"
},
{
"type_str": "AsyncResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncResponse",
"doc_url": "/docs/api/llm/responses#async-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.AsyncResponse` object containing the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_call_async" symbolName="context_call_async" /> context_call_async
Generate an `llm.AsyncContextResponse` by asynchronously calling this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[AsyncTool | AsyncContextTool[DepsT]] | AsyncContextToolkit[DepsT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[AsyncTool | AsyncContextTool[DepsT]]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "AsyncTool | AsyncContextTool[DepsT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncTool",
"description": null,
"kind": "simple",
"symbol_name": "AsyncTool",
"doc_url": "/docs/api/llm/tools#async-tool"
},
{
"type_str": "AsyncContextTool[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextTool",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextTool",
"doc_url": "/docs/api/llm/tools#async-context-tool"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "AsyncContextToolkit[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextToolkit",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextToolkit",
"doc_url": "/docs/api/llm/tools#async-context-toolkit"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncContextResponse[DepsT, None] | AsyncContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncContextResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextResponse",
"doc_url": "/docs/api/llm/responses#async-context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "AsyncContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextResponse",
"doc_url": "/docs/api/llm/responses#async-context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.AsyncContextResponse` object containing the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-stream" symbolName="stream" /> stream
Generate an `llm.StreamResponse` by synchronously streaming from this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[Tool] | Toolkit | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[Tool]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Tool",
"description": null,
"kind": "simple",
"symbol_name": "Tool",
"doc_url": "/docs/api/llm/tools#tool"
}
],
"doc_url": null
},
{
"type_str": "Toolkit",
"description": null,
"kind": "simple",
"symbol_name": "Toolkit",
"doc_url": "/docs/api/llm/tools#toolkit"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "StreamResponse | StreamResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "StreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "StreamResponse",
"doc_url": "/docs/api/llm/responses#stream-response"
},
{
"type_str": "StreamResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "StreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "StreamResponse",
"doc_url": "/docs/api/llm/responses#stream-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.StreamResponse` object for iterating over the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_stream" symbolName="context_stream" /> context_stream
Generate an `llm.ContextStreamResponse` by synchronously streaming from this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[Tool | ContextTool[DepsT]] | ContextToolkit[DepsT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[Tool | ContextTool[DepsT]]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Tool | ContextTool[DepsT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Tool",
"description": null,
"kind": "simple",
"symbol_name": "Tool",
"doc_url": "/docs/api/llm/tools#tool"
},
{
"type_str": "ContextTool[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextTool",
"description": null,
"kind": "simple",
"symbol_name": "ContextTool",
"doc_url": "/docs/api/llm/tools#context-tool"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "ContextToolkit[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextToolkit",
"description": null,
"kind": "simple",
"symbol_name": "ContextToolkit",
"doc_url": "/docs/api/llm/tools#context-toolkit"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "ContextStreamResponse[DepsT, None] | ContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ContextStreamResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextStreamResponse",
"doc_url": "/docs/api/llm/responses#context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "ContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextStreamResponse",
"doc_url": "/docs/api/llm/responses#context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.ContextStreamResponse` object for iterating over the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-stream_async" symbolName="stream_async" /> stream_async
Generate an `llm.AsyncStreamResponse` by asynchronously streaming from this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[AsyncTool] | AsyncToolkit | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[AsyncTool]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "AsyncTool",
"description": null,
"kind": "simple",
"symbol_name": "AsyncTool",
"doc_url": "/docs/api/llm/tools#async-tool"
}
],
"doc_url": null
},
{
"type_str": "AsyncToolkit",
"description": null,
"kind": "simple",
"symbol_name": "AsyncToolkit",
"doc_url": "/docs/api/llm/tools#async-toolkit"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncStreamResponse | AsyncStreamResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncStreamResponse",
"doc_url": "/docs/api/llm/responses#async-stream-response"
},
{
"type_str": "AsyncStreamResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncStreamResponse",
"doc_url": "/docs/api/llm/responses#async-stream-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.AsyncStreamResponse` object for asynchronously iterating over the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_stream_async" symbolName="context_stream_async" /> context_stream_async
Generate an `llm.AsyncContextStreamResponse` by asynchronously streaming from this client's LLM provider.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "messages",
"type_info": {
"type_str": "Sequence[Message]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "Message",
"description": null,
"kind": "simple",
"symbol_name": "Message",
"doc_url": "/docs/api/llm/messages#message"
}
],
"doc_url": null
},
"description": "Messages to send to the LLM."
},
{
"name": "tools",
"type_info": {
"type_str": "Sequence[AsyncTool | AsyncContextTool[DepsT]] | AsyncContextToolkit[DepsT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Sequence[AsyncTool | AsyncContextTool[DepsT]]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"symbol_name": "Sequence",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
},
"parameters": [
{
"type_str": "AsyncTool | AsyncContextTool[DepsT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncTool",
"description": null,
"kind": "simple",
"symbol_name": "AsyncTool",
"doc_url": "/docs/api/llm/tools#async-tool"
},
{
"type_str": "AsyncContextTool[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextTool",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextTool",
"doc_url": "/docs/api/llm/tools#async-context-tool"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "AsyncContextToolkit[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextToolkit",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextToolkit",
"doc_url": "/docs/api/llm/tools#async-context-toolkit"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional tools that the model may invoke."
},
{
"name": "format",
"type_info": {
"type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "type[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "type",
"description": null,
"kind": "simple",
"symbol_name": "type",
"doc_url": "https://docs.python.org/3/library/functions.html#type"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "Format[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Format",
"description": null,
"kind": "simple",
"symbol_name": "Format",
"doc_url": "/docs/api/llm/formatting#format"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "OutputParser[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "OutputParser",
"description": null,
"kind": "simple",
"symbol_name": "OutputParser",
"doc_url": "/docs/api/llm/formatting#output-parser"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Optional response format specifier."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncContextStreamResponse[DepsT, None] | AsyncContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncContextStreamResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextStreamResponse",
"doc_url": "/docs/api/llm/responses#async-context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "AsyncContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextStreamResponse",
"doc_url": "/docs/api/llm/responses#async-context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "An `llm.AsyncContextStreamResponse` object for asynchronously iterating over the LLM-generated content."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-resume" symbolName="resume" /> resume
Generate a new `llm.Response` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "Response | Response[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Response",
"description": null,
"kind": "simple",
"symbol_name": "Response",
"doc_url": "/docs/api/llm/responses#response"
},
{
"type_str": "Response[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Response",
"description": null,
"kind": "simple",
"symbol_name": "Response",
"doc_url": "/docs/api/llm/responses#response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Response | Response[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "Response",
"description": null,
"kind": "simple",
"symbol_name": "Response",
"doc_url": "/docs/api/llm/responses#response"
},
{
"type_str": "Response[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Response",
"description": null,
"kind": "simple",
"symbol_name": "Response",
"doc_url": "/docs/api/llm/responses#response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.Response` object containing the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-resume_async" symbolName="resume_async" /> resume_async
Generate a new `llm.AsyncResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "AsyncResponse | AsyncResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncResponse",
"doc_url": "/docs/api/llm/responses#async-response"
},
{
"type_str": "AsyncResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncResponse",
"doc_url": "/docs/api/llm/responses#async-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous async response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncResponse | AsyncResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncResponse",
"doc_url": "/docs/api/llm/responses#async-response"
},
{
"type_str": "AsyncResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncResponse",
"doc_url": "/docs/api/llm/responses#async-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.AsyncResponse` object containing the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_resume" symbolName="context_resume" /> context_resume
Generate a new `llm.ContextResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "ContextResponse[DepsT, None] | ContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ContextResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextResponse",
"doc_url": "/docs/api/llm/responses#context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "ContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextResponse",
"doc_url": "/docs/api/llm/responses#context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous context response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "ContextResponse[DepsT, None] | ContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ContextResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextResponse",
"doc_url": "/docs/api/llm/responses#context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "ContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextResponse",
"doc_url": "/docs/api/llm/responses#context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.ContextResponse` object containing the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_resume_async" symbolName="context_resume_async" /> context_resume_async
Generate a new `llm.AsyncContextResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "AsyncContextResponse[DepsT, None] | AsyncContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncContextResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextResponse",
"doc_url": "/docs/api/llm/responses#async-context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "AsyncContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextResponse",
"doc_url": "/docs/api/llm/responses#async-context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous async context response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncContextResponse[DepsT, None] | AsyncContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncContextResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextResponse",
"doc_url": "/docs/api/llm/responses#async-context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "AsyncContextResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextResponse",
"doc_url": "/docs/api/llm/responses#async-context-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.AsyncContextResponse` object containing the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-resume_stream" symbolName="resume_stream" /> resume_stream
Generate a new `llm.StreamResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "StreamResponse | StreamResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "StreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "StreamResponse",
"doc_url": "/docs/api/llm/responses#stream-response"
},
{
"type_str": "StreamResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "StreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "StreamResponse",
"doc_url": "/docs/api/llm/responses#stream-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous stream response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "StreamResponse | StreamResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "StreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "StreamResponse",
"doc_url": "/docs/api/llm/responses#stream-response"
},
{
"type_str": "StreamResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "StreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "StreamResponse",
"doc_url": "/docs/api/llm/responses#stream-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.StreamResponse` object for streaming the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-resume_stream_async" symbolName="resume_stream_async" /> resume_stream_async
Generate a new `llm.AsyncStreamResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "AsyncStreamResponse | AsyncStreamResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncStreamResponse",
"doc_url": "/docs/api/llm/responses#async-stream-response"
},
{
"type_str": "AsyncStreamResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncStreamResponse",
"doc_url": "/docs/api/llm/responses#async-stream-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous async stream response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncStreamResponse | AsyncStreamResponse[FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncStreamResponse",
"doc_url": "/docs/api/llm/responses#async-stream-response"
},
{
"type_str": "AsyncStreamResponse[FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncStreamResponse",
"doc_url": "/docs/api/llm/responses#async-stream-response"
},
"parameters": [
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.AsyncStreamResponse` object for asynchronously streaming the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_resume_stream" symbolName="context_resume_stream" /> context_resume_stream
Generate a new `llm.ContextStreamResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "ContextStreamResponse[DepsT, None] | ContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ContextStreamResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextStreamResponse",
"doc_url": "/docs/api/llm/responses#context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "ContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextStreamResponse",
"doc_url": "/docs/api/llm/responses#context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous context stream response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "ContextStreamResponse[DepsT, None] | ContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ContextStreamResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextStreamResponse",
"doc_url": "/docs/api/llm/responses#context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "ContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "ContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "ContextStreamResponse",
"doc_url": "/docs/api/llm/responses#context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.ContextStreamResponse` object for streaming the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-context_resume_stream_async" symbolName="context_resume_stream_async" /> context_resume_stream_async
Generate a new `llm.AsyncContextStreamResponse` by extending another response's messages with additional user content.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "ctx",
"type_info": {
"type_str": "Context[DepsT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Context",
"description": null,
"kind": "simple",
"symbol_name": "Context",
"doc_url": null
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
}
],
"doc_url": null
},
"description": "Context object with dependencies for tools."
},
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Model identifier to use."
},
{
"name": "response",
"type_info": {
"type_str": "AsyncContextStreamResponse[DepsT, None] | AsyncContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncContextStreamResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextStreamResponse",
"doc_url": "/docs/api/llm/responses#async-context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "AsyncContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextStreamResponse",
"doc_url": "/docs/api/llm/responses#async-context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "Previous async context stream response to extend."
},
{
"name": "content",
"type_info": {
"type_str": "UserContent",
"description": null,
"kind": "simple",
"symbol_name": "UserContent",
"doc_url": "/docs/api/llm/messages#user-content"
},
"description": "Additional user content to append."
},
{
"name": "params",
"type_info": {
"type_str": "Unpack[Params]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Unpack",
"description": null,
"kind": "simple",
"symbol_name": "Unpack",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
},
"parameters": [
{
"type_str": "Params",
"description": null,
"kind": "simple",
"symbol_name": "Params",
"doc_url": "/docs/api/llm/models#params"
}
],
"doc_url": null
},
"default": "{}"
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "AsyncContextStreamResponse[DepsT, None] | AsyncContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "AsyncContextStreamResponse[DepsT, None]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextStreamResponse",
"doc_url": "/docs/api/llm/responses#async-context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
{
"type_str": "AsyncContextStreamResponse[DepsT, FormattableT]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "AsyncContextStreamResponse",
"description": null,
"kind": "simple",
"symbol_name": "AsyncContextStreamResponse",
"doc_url": "/docs/api/llm/responses#async-context-stream-response"
},
"parameters": [
{
"type_str": "DepsT",
"description": null,
"kind": "simple",
"symbol_name": "DepsT",
"doc_url": null
},
{
"type_str": "FormattableT",
"description": null,
"kind": "simple",
"symbol_name": "FormattableT",
"doc_url": "/docs/api/llm/formatting#formattable-t"
}
],
"doc_url": null
}
],
"doc_url": null
},
"description": "A new `llm.AsyncContextStreamResponse` object for asynchronously streaming the extended conversation."
}}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-base-base_provider--base-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from provider-specific exception.
Different SDKs store status codes differently (e.g., .status_code vs .code).
Each provider implements this to handle their SDK's convention.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
},
"description": "The exception to extract status code from."
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"description": "The HTTP status code if available, None otherwise."
}}
/>
## <ApiType type="Attribute" slug="google-model-id" symbolName="GoogleModelId" /> GoogleModelId
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
The Google model ids registered with Mirascope.
## <ApiType type="Class" slug="google-provider" symbolName="GoogleProvider" /> GoogleProvider
The client for the Google LLM model.
**Bases:**
<TypeLink type={{"type_str": "BaseProvider[Client]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseProvider", "description": null, "kind": "simple", "symbol_name": "BaseProvider", "doc_url": "/docs/api/llm/providers#base-provider"}, "parameters": [{"type_str": "Client", "description": null, "kind": "simple", "symbol_name": "Client", "doc_url": null}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "'google'",
"description": null,
"kind": "simple",
"symbol_name": "'google'",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "'google/'",
"description": null,
"kind": "simple",
"symbol_name": "'google/'",
"doc_url": null
}
},
{
"name": "error_map",
"type_info": {
"type_str": "_utils.GOOGLE_ERROR_MAP",
"description": null,
"kind": "simple",
"symbol_name": "_utils.GOOGLE_ERROR_MAP",
"doc_url": null
}
},
{
"name": "client",
"type_info": {
"type_str": "Client(api_key=api_key, http_options=http_options)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-google-provider--google-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from Google exception.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}}
/>
## <ApiType type="Attribute" slug="m-l-x-model-id" symbolName="MLXModelId" /> MLXModelId
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
The identifier of the MLX model to be loaded by the MLX client.
An MLX model identifier might be a local path to a model's file, or a huggingface
repository such as:
- "mlx-community/Qwen3-8B-4bit-DWQ-053125"
- "mlx-community/gpt-oss-20b-MXFP4-Q8"
For more details, see:
- https://github.com/ml-explore/mlx-lm/?tab=readme-ov-file#supported-models
- https://huggingface.co/mlx-community
## <ApiType type="Class" slug="m-l-x-provider" symbolName="MLXProvider" /> MLXProvider
Client for interacting with MLX language models.
This client provides methods for generating responses from MLX models,
supporting both synchronous and asynchronous operations, as well as
streaming responses.
**Bases:**
<TypeLink type={{"type_str": "BaseProvider[None]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseProvider", "description": null, "kind": "simple", "symbol_name": "BaseProvider", "doc_url": "/docs/api/llm/providers#base-provider"}, "parameters": [{"type_str": "None", "description": null, "kind": "simple", "symbol_name": "None", "doc_url": "https://docs.python.org/3/library/constants.html#None"}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "'mlx'",
"description": null,
"kind": "simple",
"symbol_name": "'mlx'",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "'mlx-community/'",
"description": null,
"kind": "simple",
"symbol_name": "'mlx-community/'",
"doc_url": null
}
},
{
"name": "error_map",
"type_info": {
"type_str": "_utils.MLX_ERROR_MAP",
"description": null,
"kind": "simple",
"symbol_name": "_utils.MLX_ERROR_MAP",
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-mlx-provider--m-l-x-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from MLX exception.
MLX/HuggingFace Hub exceptions don't have status codes.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}}
/>
## <ApiType type="Class" slug="mirascope-provider" symbolName="MirascopeProvider" /> MirascopeProvider
Provider that routes LLM requests through the Mirascope Router API.
The Mirascope Router provides a unified API for multiple LLM providers
(Anthropic, Google, OpenAI) with usage tracking and cost calculation.
This provider:
- Takes model IDs in the format "scope/model-name" (e.g., "openai/gpt-4")
- Routes requests to the Mirascope Router endpoint
- Delegates to the appropriate underlying provider (Anthropic, Google, or OpenAI)
- Uses MIRASCOPE_API_KEY for authentication
**Bases:**
<TypeLink type={{"type_str": "BaseProvider[None]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseProvider", "description": null, "kind": "simple", "symbol_name": "BaseProvider", "doc_url": "/docs/api/llm/providers#base-provider"}, "parameters": [{"type_str": "None", "description": null, "kind": "simple", "symbol_name": "None", "doc_url": "https://docs.python.org/3/library/constants.html#None"}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "'mirascope'",
"description": null,
"kind": "simple",
"symbol_name": "'mirascope'",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "['anthropic/', 'google/', 'openai/']",
"description": null,
"kind": "tuple",
"base_type": {
"type_str": "tuple",
"description": null,
"kind": "simple",
"symbol_name": "tuple",
"doc_url": null
},
"parameters": [
{
"type_str": "'anthropic/'",
"description": null,
"kind": "simple",
"symbol_name": "'anthropic/'",
"doc_url": null
},
{
"type_str": "'google/'",
"description": null,
"kind": "simple",
"symbol_name": "'google/'",
"doc_url": null
},
{
"type_str": "'openai/'",
"description": null,
"kind": "simple",
"symbol_name": "'openai/'",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "error_map",
"type_info": {
"type_str": "{}",
"description": null,
"kind": "simple",
"symbol_name": "{}",
"doc_url": null
},
"description": "Empty error map since MirascopeProvider delegates to underlying providers.\n\nError handling is performed by the underlying provider instances (Anthropic,\nGoogle, OpenAI), which have their own error maps. Any exceptions that bubble\nup from underlying providers are already converted to Mirascope exceptions."
},
{
"name": "api_key",
"type_info": {
"type_str": "api_key",
"description": null,
"kind": "simple",
"symbol_name": "api_key",
"doc_url": null
}
},
{
"name": "router_base_url",
"type_info": {
"type_str": "base_url or _utils.get_default_router_base_url()",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "client",
"type_info": {
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-mirascope-provider--mirascope-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from exception.
Since MirascopeProvider delegates to underlying providers, this method
is not used for direct error extraction. Underlying providers handle
their own status code extraction.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
},
"description": "The exception to extract status code from."
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"description": "None, as status extraction is handled by underlying providers."
}}
/>
## <ApiType type="Attribute" slug="model-id" symbolName="ModelId" /> ModelId
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
## <ApiType type="Class" slug="ollama-provider" symbolName="OllamaProvider" /> OllamaProvider
Provider for Ollama's OpenAI-compatible API.
Inherits from BaseOpenAICompletionsProvider with Ollama-specific configuration:
- Uses Ollama's local API endpoint (default: http://localhost:11434/v1/)
- API key is not required (Ollama ignores API keys)
- Supports OLLAMA_BASE_URL environment variable
**Bases:**
<TypeLink type={{"type_str": "BaseOpenAICompletionsProvider", "description": null, "kind": "simple", "symbol_name": "BaseOpenAICompletionsProvider", "doc_url": "/docs/api/llm/providers#base-open-a-i-completions-provider"}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "str | list[str]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "list[str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"symbol_name": "list",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "default_base_url",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "api_key_env_var",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
},
{
"name": "api_key_required",
"type_info": {
"type_str": "bool",
"description": null,
"kind": "simple",
"symbol_name": "bool",
"doc_url": null
}
},
{
"name": "provider_name",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "client",
"type_info": {
"type_str": "OpenAI(api_key=resolved_api_key, base_url=resolved_base_url)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "async_client",
"type_info": {
"type_str": "AsyncOpenAI(api_key=resolved_api_key, base_url=resolved_base_url)",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
}
]}
/>
## <ApiType type="Attribute" slug="open-a-i-model-id" symbolName="OpenAIModelId" /> OpenAIModelId
**Type:** <TypeLink type={{"type_str": "OpenAIKnownModels | str", "description": null, "kind": "union", "base_type": {"type_str": "Union", "description": null, "kind": "simple", "symbol_name": "Union", "doc_url": null}, "parameters": [{"type_str": "OpenAIKnownModels", "description": null, "kind": "simple", "symbol_name": "OpenAIKnownModels", "doc_url": null}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": null}], "doc_url": null}} />
Valid OpenAI model IDs including API-specific variants.
## <ApiType type="Class" slug="open-a-i-provider" symbolName="OpenAIProvider" /> OpenAIProvider
Unified provider for OpenAI that routes to Completions or Responses API based on model_id.
**Bases:**
<TypeLink type={{"type_str": "BaseProvider[OpenAI]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseProvider", "description": null, "kind": "simple", "symbol_name": "BaseProvider", "doc_url": "/docs/api/llm/providers#base-provider"}, "parameters": [{"type_str": "OpenAI", "description": null, "kind": "simple", "symbol_name": "OpenAI", "doc_url": null}], "doc_url": null}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "'openai'",
"description": null,
"kind": "simple",
"symbol_name": "'openai'",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "'openai/'",
"description": null,
"kind": "simple",
"symbol_name": "'openai/'",
"doc_url": null
}
},
{
"name": "error_map",
"type_info": {
"type_str": "{None: _utils.OPENAI_ERROR_MAP, OpenAIBadRequestError: lambda e: NotFoundError if hasattr(e, 'code') and e.code == 'model_not_found' else BadRequestError}",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "client",
"type_info": {
"type_str": "self._completions_provider.client",
"description": null,
"kind": "simple",
"symbol_name": "self._completions_provider.client",
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="mirascope-llm-providers-openai-provider--open-a-i-provider-get_error_status" symbolName="get_error_status" /> get_error_status
Extract HTTP status code from OpenAI exception.
<ParametersTable
parameters={[
{
"name": "self",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"symbol_name": null,
"doc_url": null
}
},
{
"name": "e",
"type_info": {
"type_str": "Exception",
"description": null,
"kind": "simple",
"symbol_name": "Exception",
"doc_url": "https://docs.python.org/3/library/exceptions.html#Exception"
}
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"symbol_name": "int",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
}
}}
/>
## <ApiType type="Attribute" slug="provider" symbolName="Provider" /> Provider
**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
Type alias for `BaseProvider` with any client type.
## <ApiType type="Attribute" slug="provider-id" symbolName="ProviderId" /> ProviderId
**Type:** <TypeLink type={{"type_str": "KnownProviderId | str", "description": null, "kind": "union", "base_type": {"type_str": "Union", "description": null, "kind": "simple", "symbol_name": "Union", "doc_url": null}, "parameters": [{"type_str": "KnownProviderId", "description": null, "kind": "simple", "symbol_name": "KnownProviderId", "doc_url": null}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": null}], "doc_url": null}} />
## <ApiType type="Class" slug="together-provider" symbolName="TogetherProvider" /> TogetherProvider
Provider for Together AI's OpenAI-compatible API.
Inherits from BaseOpenAICompletionsProvider with Together-specific configuration:
- Uses Together AI's API endpoint
- Requires TOGETHER_API_KEY
**Bases:**
<TypeLink type={{"type_str": "BaseOpenAICompletionsProvider", "description": null, "kind": "simple", "symbol_name": "BaseOpenAICompletionsProvider", "doc_url": "/docs/api/llm/providers#base-open-a-i-completions-provider"}} />
<AttributesTable
attributes={[
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
},
{
"name": "default_scope",
"type_info": {
"type_str": "str | list[str]",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "list[str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"symbol_name": "list",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
],
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "default_base_url",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
}
},
{
"name": "api_key_env_var",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
}
},
{
"name": "api_key_required",
"type_info": {
"type_str": "bool",
"description": null,
"kind": "simple",
"symbol_name": "bool",
"doc_url": null
}
},
{
"name": "provider_name",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": null
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": null
}
],
"doc_url": null
}
}
]}
/>
## <ApiType type="Function" slug="get_provider_for_model" symbolName="get_provider_for_model" /> get_provider_for_model
Get the provider for a model_id based on the registry.
Uses longest prefix matching to find the most specific provider for the model.
If no explicit registration is found, checks for auto-registration defaults
and automatically registers the provider on first use.
When auto-registering, providers are tried in fallback order. For example,
if ANTHROPIC_API_KEY is not set but MIRASCOPE_API_KEY is, the Mirascope
Router will be used as a fallback for anthropic/ models.
<ParametersTable
parameters={[
{
"name": "model_id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The full model ID (e.g., \"anthropic/claude-4-5-sonnet\")."
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Provider",
"description": null,
"kind": "simple",
"symbol_name": "Provider",
"doc_url": "/docs/api/llm/providers#provider"
},
"description": "The provider instance registered for this model."
}}
/>
## <ApiType type="Function" slug="register_provider" symbolName="register_provider" /> register_provider
Register a provider with scope(s) in the global registry.
Scopes use prefix matching on model IDs:
- "anthropic/" matches "anthropic/*"
- "anthropic/claude-4-5" matches "anthropic/claude-4-5*"
- "anthropic/claude-4-5-sonnet" matches exactly "anthropic/claude-4-5-sonnet"
When multiple scopes match a model_id, the longest match wins.
<ParametersTable
parameters={[
{
"name": "provider",
"type_info": {
"type_str": "ProviderId | Provider",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "ProviderId",
"description": null,
"kind": "simple",
"symbol_name": "ProviderId",
"doc_url": "/docs/api/llm/providers#provider-id"
},
{
"type_str": "Provider",
"description": null,
"kind": "simple",
"symbol_name": "Provider",
"doc_url": "/docs/api/llm/providers#provider"
}
],
"doc_url": null
},
"description": "Either a provider ID string or a provider instance."
},
{
"name": "scope",
"type_info": {
"type_str": "str | list[str] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
{
"type_str": "list[str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"symbol_name": "list",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
}
],
"doc_url": null
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Scope string or list of scopes for prefix matching on model IDs.\nIf None, uses the provider's default_scope attribute.\nCan be a single string or a list of strings."
},
{
"name": "api_key",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "API key for authentication (only used if provider is a string)."
},
{
"name": "base_url",
"type_info": {
"type_str": "str | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"symbol_name": "Union",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"symbol_name": "str",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
],
"doc_url": null
},
"default": "None",
"description": "Base URL for the API (only used if provider is a string)."
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "Provider",
"description": null,
"kind": "simple",
"symbol_name": "Provider",
"doc_url": "/docs/api/llm/providers#provider"
}
}}
/>
## <ApiType type="Function" slug="reset_provider_registry" symbolName="reset_provider_registry" /> reset_provider_registry
Resets the provider registry, clearing all registered providers.
<ReturnTable
returnType={{
"type_info": {
"type_str": "None",
"description": null,
"kind": "simple",
"symbol_name": "None",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
}}
/>