pub struct EventTextDeltas { /* private fields */ }Expand description
Converts complete response snapshots to text and thinking deltas.
Create one adapter per live stream for append-only output. Keep the original events for persistence and consumers that support content replacement.
§Example
use adk_core::{Content, Event, EventTextDeltas};
let mut deltas = EventTextDeltas::default();
let mut chunk = Event::new("invocation");
chunk.llm_response.partial = true;
chunk.set_content(Content::new("model").with_text("Hello"));
deltas.push(&chunk);
let mut terminal = chunk.clone();
terminal.llm_response.partial = false;
terminal.llm_response.provider_metadata = Some(serde_json::json!({"content_complete": true}));
terminal.set_content(Content::new("model").with_text("Hello world"));
let output = deltas.push(&terminal);
assert_eq!(output.content().unwrap().parts[0].text(), Some(" world"));Implementations§
Trait Implementations§
Source§impl Debug for EventTextDeltas
impl Debug for EventTextDeltas
Auto Trait Implementations§
impl Freeze for EventTextDeltas
impl RefUnwindSafe for EventTextDeltas
impl Send for EventTextDeltas
impl Sync for EventTextDeltas
impl Unpin for EventTextDeltas
impl UnsafeUnpin for EventTextDeltas
impl UnwindSafe for EventTextDeltas
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