Skip to main content

objectiveai_sdk/functions/executions/response/unary/
vector_completion_task.rs

1use crate::{error, functions::executions::response, vector};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
6#[schemars(rename = "functions.executions.response.unary.VectorCompletionTask")]
7pub struct VectorCompletionTask {
8    pub index: u64,
9    pub task_index: u64,
10    pub task_path: Vec<u64>,
11    /// The messages dispatched for this vector-completion task,
12    /// carried from the task's first streaming chunk.
13    pub request_messages: Vec<crate::agent::completions::message::Message>,
14    /// The response options (choices) voted on for this
15    /// vector-completion task, carried from the task's first streaming
16    /// chunk.
17    pub request_choices:
18        Vec<crate::agent::completions::message::RichContent>,
19    #[serde(flatten)]
20    pub inner: vector::completions::response::unary::VectorCompletion,
21    pub error: Option<error::ResponseError>,
22}
23
24impl From<response::streaming::VectorCompletionTaskChunk>
25    for VectorCompletionTask
26{
27    fn from(
28        response::streaming::VectorCompletionTaskChunk {
29            index,
30            task_index,
31            task_path,
32            request_messages,
33            request_choices,
34            inner,
35            error,
36        }: response::streaming::VectorCompletionTaskChunk,
37    ) -> Self {
38        Self {
39            index,
40            task_index,
41            task_path,
42            request_messages: request_messages.unwrap_or_default(),
43            request_choices: request_choices.unwrap_or_default(),
44            inner: inner.into(),
45            error,
46        }
47    }
48}