mirascope.core.groq.stream
Module stream
The GroqStream
class for convenience around streaming LLM calls.
Usage
Attribute FinishReason
Type: Choice.__annotations__['finish_reason']
Class GroqStream
A class for convenience around streaming Groq LLM calls.
Example:
from mirascope.core import prompt_template
from mirascope.core.groq import groq_call
@groq_call("llama-3.1-8b-instant", stream=True)
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
stream = recommend_book("fantasy") # returns `GroqStream` instance
for chunk, _ in stream:
print(chunk.content, end="", flush=True)
Bases:
BaseStream[GroqCallResponse, GroqCallResponseChunk, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam, ChatCompletionToolMessageParam, ChatCompletionMessageParam, GroqTool, ChatCompletionToolParam, AsyncGroqDynamicConfig | GroqDynamicConfig, GroqCallParams, FinishReason]Attributes
Name | Type | Description |
---|---|---|
cost_metadata | CostMetadata | - |
Function construct_call_response
Constructs the call response from a consumed GroqStream.
Parameters
Name | Type | Description |
---|---|---|
self | Any | - |
Returns
Type | Description |
---|---|
GroqCallResponse | - |