use crate::{agent, vector::completions::response};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
#[schemars(rename = "vector.completions.response.unary.AgentCompletion")]
pub struct AgentCompletion {
pub index: u64,
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(extend("omitempty" = true))]
pub agent_inline: Option<crate::agent::InlineAgentWithFallbacks>,
pub request_choice_keys: Vec<String>,
#[serde(flatten)]
pub inner: agent::completions::response::unary::AgentCompletion,
}
impl From<response::streaming::AgentCompletionChunk> for AgentCompletion {
fn from(
response::streaming::AgentCompletionChunk {
index,
agent_inline,
request_choice_keys,
inner,
}: response::streaming::AgentCompletionChunk,
) -> Self {
Self {
index,
agent_inline,
request_choice_keys: request_choice_keys.unwrap_or_default(),
inner: agent::completions::response::unary::AgentCompletion::from(
inner,
),
}
}
}