mirascope.llm.override | Mirascope
MirascopeLilypad

mirascope.llm.override

Alias override

Overrides the provider-specific call with the specified provider.

This function creates a new function that wraps the original function and temporarily sets a context with the specified overrides when called. It supports both setting overrides (provider, model, client, call_params) and structural overrides (stream, tools, response_model, output_parser).

Parameters

NameTypeDescription
provider_agnostic_call() => Awaitable[_R] | () => _RThe provider-agnostic call to override.
provider= NoneProvider | LocalProvider | NoneThe provider to override with.
model= Nonestr | NoneThe model to override with.
stream= Nonebool | StreamConfig | NoneWhether to stream the response.
tools= Nonelist[type[BaseTool] | Callable] | NoneThe tools to use for the LLM API call.
response_model= Nonetype[_ResponseModelT] | NoneThe response model to structure the response into.
output_parser= None(Any) => _ParsedOutputT | NoneA function to parse the response.
json_mode= Nonebool | NoneWhether to use JSON mode.
client= NoneAnyThe client to override with.
call_params= NoneCommonCallParams | AnthropicCallParams | AzureCallParams | BedrockCallParams | CohereCallParams | GeminiCallParams | GoogleCallParams | GroqCallParams | MistralCallParams | OpenAICallParams | VertexCallParams | XAICallParams | NoneThe call params to override with.

Returns

TypeDescription
() => Awaitable[_R] | Awaitable[CallResponse] | Awaitable[Stream] | Awaitable[_ResponseModelT] | Awaitable[_ParsedOutputT] | Awaitable[AsyncIterable[_ResponseModelT]] | Awaitable[_ResponseModelT | CallResponse] | Awaitable[_ParsedOutputT | CallResponse] | _R | CallResponse | Stream | _ResponseModelT | _ParsedOutputT | Iterable[_ResponseModelT] | _ResponseModelT | CallResponse | _ParsedOutputT | CallResponseThe overridden function with appropriate return type.

Alias to: mirascope.llm._override.override