mirascope.core.base.call_response_chunk
This module contains the BaseCallResponseChunk
class.
Usage
Class BaseCallResponseChunk
A base abstract interface for LLM streaming response chunks.
Bases: BaseModel, Generic[_ChunkT, _FinishReasonT], ABC
Attributes
Name | Type | Description |
---|---|---|
chunk | _ChunkT | - |
model_config | ConfigDict(extra='allow', arbitrary_types_allowed=True) | - |
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 | list[_FinishReasonT] | None | Should return the finish reasons of the response. If there is no finish reason, this method must return None. |
model | str | None | Should return the name of the response model. |
id | str | None | Should return the id of the response. |
usage | Any | Should return the usage of the response. If there is no usage, this method must return None. |
input_tokens | int | float | None | Should return the number of input tokens. If there is no input_tokens, this method must return None. |
cached_tokens | int | float | None | Should return the number of cached tokens. If there is no cached_tokens, this method must return None. |
output_tokens | int | float | None | Should return the number of output tokens. If there is no output_tokens, this method must return None. |
cost_metadata | CostMetadata | Get metadata required for cost calculation. |
common_finish_reasons | list[FinishReason] | None | Provider-agnostic finish reasons. |
common_usage | Usage | None | Provider-agnostic usage info. |