ractogateway._models.stream
Streaming response models — every chunk the user sees is a StreamChunk.
- class ractogateway._models.stream.StreamDelta(**data)[source]
Bases:
BaseModelIncremental content produced by a single streaming event.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- text: str
- thinking: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ractogateway._models.stream.StreamChunk(**data)[source]
Bases:
BaseModelA single piece of a streaming response.
Consumers iterate over
StreamChunkobjects — they never touch raw provider events directly.- delta
The incremental content for this chunk.
- accumulated_text
Running concatenation of all
delta.textvalues so far.
- finish_reason
Nonefor intermediate chunks; set on the final chunk.
- tool_calls
Empty until the final chunk (
is_final=True).
- usage
Token counts — populated on the final chunk only.
- is_final
Trueonly for the very last chunk in the stream.
- raw
The underlying provider event (escape-hatch for advanced users).
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- delta: StreamDelta
- accumulated_text: str
- accumulated_thinking: str
- is_thinking: bool
- finish_reason: FinishReason | None
- tool_calls: list[ToolCallResult]
- is_final: bool
- raw: Any
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].