mirascope.core.base.call_response_chunk | Mirascope
MirascopeLilypad

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

NameTypeDescription
chunk_ChunkT-
model_configConfigDict(extra='allow', arbitrary_types_allowed=True)-
contentstrShould 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_reasonslist[_FinishReasonT] | NoneShould return the finish reasons of the response. If there is no finish reason, this method must return None.
modelstr | NoneShould return the name of the response model.
idstr | NoneShould return the id of the response.
usageAnyShould return the usage of the response. If there is no usage, this method must return None.
input_tokensint | float | NoneShould return the number of input tokens. If there is no input_tokens, this method must return None.
cached_tokensint | float | NoneShould return the number of cached tokens. If there is no cached_tokens, this method must return None.
output_tokensint | float | NoneShould return the number of output tokens. If there is no output_tokens, this method must return None.
cost_metadataCostMetadataGet metadata required for cost calculation.
common_finish_reasonslist[FinishReason] | NoneProvider-agnostic finish reasons.
common_usageUsage | NoneProvider-agnostic usage info.