AssistantTurn
AssistantTurn(
contents,
*,
tokens=None,
finish_reason=None,
completion=None,
cost=None,
partial_reason=None,
**kwargs,
)
Assistant turn - represents model response with additional metadata
Parameters
| contents |
str | Sequence[Content | str] |
A list of Content objects. |
required |
| tokens |
Optional[tuple[int, int, int] | list[int]] |
A numeric vector of length 3 representing the number of input, output, and cached tokens (respectively) used in this turn. |
None |
| finish_reason |
Optional[str] |
A string indicating the reason why the conversation ended. |
None |
| completion |
Optional[CompletionT] |
The completion object returned by the provider. This is useful if there’s information returned by the provider that chatlas doesn’t otherwise expose. |
None |
| cost |
Optional[float] |
The cost of this turn in USD. This is computed when the turn is created based on the token usage and pricing information (including service tier). |
None |
| partial_reason |
Optional[str] |
If set, indicates this turn is incomplete (e.g., the stream was interrupted or cancelled). The value describes the reason for the partial state. |
None |
See Also
Turn: The base class for all turn types.
Attributes
| is_partial |
Whether this turn is a partial (interrupted/cancelled) turn. |
Methods
| validate_tokens |
Convert list to tuple for JSON deserialization compatibility. |
validate_tokens
AssistantTurn.validate_tokens(v)
Convert list to tuple for JSON deserialization compatibility.