Expand description
Completion events, and Streamed, the one stream every reply arrives
as.
use rig_core::streaming::{Item, StreamEvent};
fn text(item: &Item<StreamEvent>) -> Option<&str> {
match item {
Item::Event(StreamEvent::Text { text, .. }) => Some(text),
_ => None,
}
}Structs§
- Part
- A part’s position in the response’s
choice. Only this crate constructs one: - Streamed
- One reply as it arrives: its events, and the fold that has seen each of
them. It is what
Model::streamreturns for every operation, and what a call finishes. - Transcript
- A completion stream’s items read back from their serialized form, in an order the writer could have produced: each part starts once, at the next position, grows only while open and with its own kind of fragment, and ends once. Unmodeled payloads may come anywhere.
- Unknown
Payload - Unmodeled JSON payload with content-redacted
Debugoutput. Serialization preserves the payload;Self::valueexplicitly exposes it.
Enums§
- Item
- One item of a stream: an event of the operation, or a payload the provider sent that the decoder does not model. An unmodeled payload always reaches the consumer.
- Part
Kind - What kind of part a
StreamEvent::Startopened. - Relayed
- One item of a completion stream relayed over the bus: an item of the reply, or the response the origin folded when the provider ended it.
- Sequence
Error - Why a serialized event sequence is not one the writer could produce.
- Stream
Event - One event of a completion stream: a part starts, grows, or ends with the content it finalized.
- Streamed
User Content - Streamed user content. This content is primarily used to represent tool results from tool calls made during a multi-turn/step agent prompt.
Type Aliases§
- Completion
Stream - A streamed completion.
- Stream
Events - A completion stream as the bus carries it.