mirascope.core.base.call_response_chunk¶
This module contains the BaseCallResponseChunk
class.
Usage Documentation
BaseCallResponseChunk
¶
Bases: BaseModel
, Generic[_ChunkT, _FinishReasonT]
, ABC
A base abstract interface for LLM streaming response chunks.
Attributes:
Name | Type | Description |
---|---|---|
chunk |
_ChunkT
|
The original response chunk from whichever model response this wraps. |
content
abstractmethod
property
¶
content: str
Should return the string content of the response chunk.
If there are multiple choices in a chunk, this method should select the 0th choice and return it's string content.
If there is no string content (e.g. when using tools), this method must return the empty string.
finish_reasons
abstractmethod
property
¶
finish_reasons: list[_FinishReasonT] | None
Should return the finish reasons of the response.
If there is no finish reason, this method must return None.
usage
abstractmethod
property
¶
usage: Any
Should return the usage of the response.
If there is no usage, this method must return None.
input_tokens
abstractmethod
property
¶
Should return the number of input tokens.
If there is no input_tokens, this method must return None.