pub struct VectorCompletionChunk {
pub id: String,
pub completions: Vec<AgentCompletionChunk>,
pub votes: Vec<Vote>,
pub scores: Vec<Decimal>,
pub weights: Vec<Decimal>,
pub created: u64,
pub swarm: String,
pub object: Object,
pub usage: Option<Usage>,
}Expand description
A chunk in a streaming vector completion response.
Each chunk contains incremental updates to the completion. Use the
push method to accumulate chunks into a complete response.
Fields§
§id: StringUnique identifier for this vector completion.
completions: Vec<AgentCompletionChunk>Incremental agent completion chunks from each agent.
votes: Vec<Vote>Votes received so far. New votes are appended in subsequent chunks.
scores: Vec<Decimal>Current weighted scores. Updated as new votes arrive.
weights: Vec<Decimal>Current weight distribution across responses. Updated as new votes arrive.
created: u64Unix timestamp when the completion was created.
swarm: StringID of the swarm used for this completion.
object: ObjectObject type identifier ("vector.completion.chunk").
usage: Option<Usage>Aggregated usage statistics. Typically present only in the final chunk.
Implementations§
Source§impl VectorCompletionChunk
impl VectorCompletionChunk
Sourcepub fn default_from_request_responses_len(request_responses_len: usize) -> Self
pub fn default_from_request_responses_len(request_responses_len: usize) -> Self
Creates a default chunk with uniform scores for the given number of responses.
Sourcepub fn inner_errors(&self) -> impl Iterator<Item = InnerError<'_>>
pub fn inner_errors(&self) -> impl Iterator<Item = InnerError<'_>>
Yields each inner error from this chunk’s per-agent completions,
tagged with the failing completion’s index.
Lazy and zero-allocation; collect with .collect::<Vec<_>>() if you
need to retain the items past the chunk’s lifetime.
Sourcepub fn push(&mut self, _: &VectorCompletionChunk)
pub fn push(&mut self, _: &VectorCompletionChunk)
Accumulates another chunk into this one.
Updates scores, weights, and usage, appends new votes.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for VectorCompletionChunk
impl<'arbitrary> Arbitrary<'arbitrary> for VectorCompletionChunk
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for VectorCompletionChunk
impl Clone for VectorCompletionChunk
Source§fn clone(&self) -> VectorCompletionChunk
fn clone(&self) -> VectorCompletionChunk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VectorCompletionChunk
impl Debug for VectorCompletionChunk
Source§impl Default for VectorCompletionChunk
impl Default for VectorCompletionChunk
Source§fn default() -> VectorCompletionChunk
fn default() -> VectorCompletionChunk
Source§impl<'de> Deserialize<'de> for VectorCompletionChunk
impl<'de> Deserialize<'de> for VectorCompletionChunk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<VectorCompletionChunk> for VectorCompletion
impl From<VectorCompletionChunk> for VectorCompletion
Source§fn from(_: VectorCompletionChunk) -> Self
fn from(_: VectorCompletionChunk) -> Self
Source§impl JsonSchema for VectorCompletionChunk
impl JsonSchema for VectorCompletionChunk
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for VectorCompletionChunk
impl PartialEq for VectorCompletionChunk
Source§fn eq(&self, other: &VectorCompletionChunk) -> bool
fn eq(&self, other: &VectorCompletionChunk) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for VectorCompletionChunk
impl Serialize for VectorCompletionChunk
impl StructuralPartialEq for VectorCompletionChunk
Auto Trait Implementations§
impl Freeze for VectorCompletionChunk
impl RefUnwindSafe for VectorCompletionChunk
impl Send for VectorCompletionChunk
impl Sync for VectorCompletionChunk
impl Unpin for VectorCompletionChunk
impl UnsafeUnpin for VectorCompletionChunk
impl UnwindSafe for VectorCompletionChunk
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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