objectiveai-api 2.0.5

ObjectiveAI API Server
//! Trait for fetching votes from historical completions.

use crate::ctx;

/// Fetches votes from a previously executed vector completion.
///
/// Only returns votes generated by actual LLM inference. Excludes votes that
/// came from the cache (`from_cache`), but includes votes from previous retries.
#[async_trait::async_trait]
pub trait Fetcher<CTXEXT> {
    /// Retrieves votes from a historical vector completion by ID.
    ///
    /// Returns None if the completion is not found.
    async fn fetch<PC: crate::ctx::persistent_cache::PersistentCacheClient>(
        &self,
        ctx: ctx::Context<CTXEXT, PC>,
        id: &str,
    ) -> Result<
        Option<Vec<objectiveai_sdk::vector::completions::response::Vote>>,
        objectiveai_sdk::error::ResponseError,
    >;
}