pub struct NdjsonStreamEvent {
pub event: NdjsonStreamEventEvent,
pub model: Option<ModelId>,
pub response_id: Option<String>,
pub state_id: Option<Uuid>,
pub stop_reason: Option<String>,
pub text_delta: Option<String>,
pub tool_call_delta: Option<ToolCallDelta>,
pub tool_calls: Vec<ToolCall>,
pub usage: Option<Usage>,
}Expand description
Events sent during streaming responses (application/x-ndjson). Each line is a JSON object with an “event” field indicating the type.
JSON schema
{
"description": "Events sent during streaming responses (application/x-ndjson).\nEach line is a JSON object with an \"event\" field indicating the type.\n",
"type": "object",
"required": [
"event"
],
"properties": {
"event": {
"description": "Event type",
"type": "string",
"enum": [
"message_start",
"message_delta",
"message_stop",
"tool_use_start",
"tool_use_delta",
"tool_use_stop",
"ping",
"keepalive"
]
},
"model": {
"$ref": "#/$defs/ModelId"
},
"response_id": {
"description": "Response identifier (message_start)",
"type": "string"
},
"state_id": {
"type": "string",
"format": "uuid"
},
"stop_reason": {
"description": "Why generation stopped (message_stop)",
"type": "string"
},
"text_delta": {
"description": "Text content fragment (message_delta)",
"type": "string"
},
"tool_call_delta": {
"$ref": "#/$defs/ToolCallDelta"
},
"tool_calls": {
"description": "Completed tool calls (tool_use_stop, message_stop)",
"type": "array",
"items": {
"$ref": "#/$defs/ToolCall"
}
},
"usage": {
"$ref": "#/$defs/Usage"
}
}
}Fields§
§event: NdjsonStreamEventEventEvent type
model: Option<ModelId>§response_id: Option<String>Response identifier (message_start)
state_id: Option<Uuid>§stop_reason: Option<String>Why generation stopped (message_stop)
text_delta: Option<String>Text content fragment (message_delta)
tool_call_delta: Option<ToolCallDelta>§tool_calls: Vec<ToolCall>Completed tool calls (tool_use_stop, message_stop)
usage: Option<Usage>Trait Implementations§
Source§impl Clone for NdjsonStreamEvent
impl Clone for NdjsonStreamEvent
Source§fn clone(&self) -> NdjsonStreamEvent
fn clone(&self) -> NdjsonStreamEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NdjsonStreamEvent
impl Debug for NdjsonStreamEvent
Source§impl<'de> Deserialize<'de> for NdjsonStreamEvent
impl<'de> Deserialize<'de> for NdjsonStreamEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&NdjsonStreamEvent> for NdjsonStreamEvent
impl From<&NdjsonStreamEvent> for NdjsonStreamEvent
Source§fn from(value: &NdjsonStreamEvent) -> Self
fn from(value: &NdjsonStreamEvent) -> Self
Converts to this type from the input type.
Source§impl From<NdjsonStreamEvent> for ModelRelayApi
impl From<NdjsonStreamEvent> for ModelRelayApi
Source§fn from(value: NdjsonStreamEvent) -> Self
fn from(value: NdjsonStreamEvent) -> Self
Converts to this type from the input type.
Source§impl PartialEq for NdjsonStreamEvent
impl PartialEq for NdjsonStreamEvent
Source§impl Serialize for NdjsonStreamEvent
impl Serialize for NdjsonStreamEvent
impl StructuralPartialEq for NdjsonStreamEvent
Auto Trait Implementations§
impl Freeze for NdjsonStreamEvent
impl RefUnwindSafe for NdjsonStreamEvent
impl Send for NdjsonStreamEvent
impl Sync for NdjsonStreamEvent
impl Unpin for NdjsonStreamEvent
impl UnwindSafe for NdjsonStreamEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more