mirascope.core.base.stream¶
This module contains the base classes for streaming responses from LLMs.
BaseStream
¶
BaseStream(
*,
stream: (
Generator[
tuple[
_BaseCallResponseChunkT, _BaseToolT | None
],
None,
None,
]
| AsyncGenerator[
tuple[
_BaseCallResponseChunkT, _BaseToolT | None
],
None,
]
),
metadata: Metadata,
tool_types: list[type[_BaseToolT]] | None,
call_response_type: type[_BaseCallResponseT],
model: str,
prompt_template: str | None,
fn_args: dict[str, Any],
dynamic_config: _BaseDynamicConfigT,
messages: list[_MessageParamT],
call_params: _BaseCallParamsT,
call_kwargs: BaseCallKwargs[_ToolSchemaT]
)
Bases: Generic[_BaseCallResponseT, _BaseCallResponseChunkT, _UserMessageParamT, _AssistantMessageParamT, _ToolMessageParamT, _MessageParamT, _BaseToolT, _ToolSchemaT, _BaseDynamicConfigT, _BaseCallParamsT, _FinishReason]
, ABC
A base class for streaming responses from LLMs.
Source code in mirascope/core/base/stream.py
tool_message_params
¶
tool_message_params(
tools_and_outputs: list[tuple[_BaseToolT, JsonableType]]
) -> list[_ToolMessageParamT]
Returns the tool message parameters for tool call results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tools_and_outputs |
list[tuple[_BaseToolT, JsonableType]]
|
The list of tools and their outputs from which the tool message parameters should be constructed. |
required |