Skip to main content

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

1use crate::{error, functions::executions::response, vector};
2use serde::{Deserialize, Serialize};
3use schemars::JsonSchema;
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    #[serde(flatten)]
12    pub inner: vector::completions::response::unary::VectorCompletion,
13    pub error: Option<error::ResponseError>,
14}
15
16impl From<response::streaming::VectorCompletionTaskChunk>
17    for VectorCompletionTask
18{
19    fn from(
20        response::streaming::VectorCompletionTaskChunk {
21            index,
22            task_index,
23            task_path,
24            inner,
25            error,
26        }: response::streaming::VectorCompletionTaskChunk,
27    ) -> Self {
28        Self {
29            index,
30            task_index,
31            task_path,
32            inner: inner.into(),
33            error,
34        }
35    }
36}