mirascope.core.google.stream
The GoogleStream
class for convenience around streaming LLM calls.
Usage
Class GoogleStream
A class for convenience around streaming Google LLM calls.
Example:
from mirascope.core import prompt_template
from mirascope.core.google import google_call
@google_call("google-1.5-flash", stream=True)
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
stream = recommend_book("fantasy") # returns `GoogleStream` instance
for chunk, _ in stream:
print(chunk.content, end="", flush=True)
Bases:
BaseStream[GoogleCallResponse, GoogleCallResponseChunk, ContentDict, ContentDict, ContentDict, ContentListUnion | ContentListUnionDict, GoogleTool, Tool, GoogleDynamicConfig, GoogleCallParams, FinishReason]Attributes
Name | Type | Description |
---|---|---|
cost_metadata | CostMetadata | - |
Function construct_call_response
Constructs the call response from a consumed GoogleStream.
Parameters
Name | Type | Description |
---|---|---|
self | Any | - |
Returns
Type | Description |
---|---|
GoogleCallResponse | - |