mirascope.core.mistral.stream
The MistralStream
class for convenience around streaming LLM calls.
Usage
Class MistralStream
A class for convenience around streaming Mistral LLM calls.
Example:
from mirascope.core import prompt_template
from mirascope.core.mistral import mistral_call
@mistral_call("mistral-large-latest", stream=True)
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
stream = recommend_book("fantasy") # returns `MistralStream` instance
for chunk, _ in stream:
print(chunk.content, end="", flush=True)
Bases:
BaseStream[MistralCallResponse, MistralCallResponseChunk, UserMessage, AssistantMessage, ToolMessage, AssistantMessage | SystemMessage | ToolMessage | UserMessage, MistralTool, dict[str, Any], MistralDynamicConfig, MistralCallParams, FinishReason]Attributes
Name | Type | Description |
---|---|---|
cost_metadata | CostMetadata | - |
Function construct_call_response
Constructs the call response from a consumed MistralStream.
Parameters
Name | Type | Description |
---|---|---|
self | Any | - |
Returns
Type | Description |
---|---|
MistralCallResponse | - |