mirascope.core.base.call_factory
call_factory
Function call_factory
A factory method for creating provider-specific call decorators.
Parameters
Name | Type | Description |
---|---|---|
TCallResponse | type[_BaseCallResponseT] | The provider-specific `BaseCallResponse` type. |
TCallResponseChunk | type[_BaseCallResponseChunkT] | The provider-specific `BaseCallResponseChunk` type. |
TToolType | type[_BaseToolT] | The provider-specific `BaseTool` type. |
TStream | type[_BaseStreamT] | The provider-specific `BaseStream` type. |
default_call_params | BaseCallParams | The default call parameters to use, which must match the `TCallParams` type if provided. |
setup_call | SameSyncAndAsyncClientSetupCall[_SameSyncAndAsyncClientT, _BaseDynamicConfigT, _AsyncBaseDynamicConfigT, _BaseCallParamsT, _ResponseT, _ResponseChunkT, _AsyncResponseT, _AsyncResponseChunkT, _BaseToolT] | SetupCall[_SyncBaseClientT, _AsyncBaseClientT, _BaseDynamicConfigT, _AsyncBaseDynamicConfigT, _BaseCallParamsT, _ResponseT, _ResponseChunkT, _AsyncResponseT, _AsyncResponseChunkT, _BaseToolT] | The helper method for setting up a call, which returns the configured create function, the prompt template, the list of provider-specific messages, the list of provider-specific tool types, and the finalized `call_kwargs` with which to make the API call with the create function. |
get_json_output | GetJsonOutput[_BaseCallResponseT | _BaseCallResponseChunkT] | The helper method for getting JSON output from a call response. |
handle_stream | HandleStream[_ResponseChunkT, _BaseCallResponseChunkT, _BaseToolT] | The helper method for converting a provider's original stream generator into a generator that returns tuples of `(chunk, tool)` where `chunk` and `tool` are provider-specific `BaseCallResponseChunk` and `BaseTool` instances, respectively. |
handle_stream_async | HandleStreamAsync[_AsyncResponseChunkT, _BaseCallResponseChunkT, _BaseToolT] | The same helper method as `handle_stream` except for handling asynchronous streaming. |
Returns
Type | Description |
---|---|
CallDecorator[_BaseCallResponseT, _BaseCallResponseChunkT, _BaseDynamicConfigT, _AsyncBaseDynamicConfigT, _BaseCallParamsT, _BaseStreamT, _SyncBaseClientT, _AsyncBaseClientT, _SameSyncAndAsyncClientT] | - |