pub struct TaskResponse { /* private fields */ }Expand description
The response from an agent after completing a task.
Contains the task ID and the output data produced by the agent.
§Examples
use ceylon::agent::Agent;
use ceylon::tasks::{TaskRequest, OutputData};
let mut agent = Agent::new("Assistant", "openai::gpt-4");
let task = TaskRequest::new("Say hello");
let response = agent.run(task).await;
match response.result() {
OutputData::Text(text) => println!("Agent said: {}", text),
_ => println!("Non-text response"),
}Implementations§
Source§impl TaskResponse
impl TaskResponse
Sourcepub fn result(&self) -> OutputData
pub fn result(&self) -> OutputData
Returns a clone of the output data.
§Examples
use ceylon::tasks::{TaskResponse, OutputData};
let response = TaskResponse::new("task-123", OutputData::Text("Hello".to_string()));
let output = response.result();Source§impl TaskResponse
impl TaskResponse
Sourcepub fn new(id: &str, output: OutputData) -> Self
pub fn new(id: &str, output: OutputData) -> Self
Creates a new task response.
§Arguments
id- The ID of the task this is responding tooutput- The output data produced by the agent
Auto Trait Implementations§
impl Freeze for TaskResponse
impl RefUnwindSafe for TaskResponse
impl Send for TaskResponse
impl Sync for TaskResponse
impl Unpin for TaskResponse
impl UnwindSafe for TaskResponse
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more