Skip to main content

Module context

Module context 

Source
Expand description

Context Provider Extension Point

This module provides the extension point for integrating context databases like OpenViking into the agent loop. Context providers can supply memory, resources, and skills to augment the LLM’s context.

§Usage

Implement the ContextProvider trait and register it with a session:

use a3s_code::context::{ContextProvider, ContextQuery, ContextResult};

struct MyProvider { /* ... */ }

#[async_trait::async_trait]
impl ContextProvider for MyProvider {
    fn name(&self) -> &str { "my-provider" }

    async fn query(&self, query: &ContextQuery) -> anyhow::Result<ContextResult> {
        // Retrieve relevant context...
    }
}

Re-exports§

pub use fs_provider::FileSystemContextConfig;
pub use fs_provider::FileSystemContextProvider;
pub use vector_provider::VectorContextConfig;
pub use vector_provider::VectorContextProvider;
pub use vector_store::InMemoryVectorStore;
pub use vector_store::VectorStore;

Modules§

embedding
Embedding Provider Extension Point
fs_provider
File System Context Provider
vector_provider
Vector RAG Context Provider
vector_store
Vector Store Extension Point

Structs§

ContextItem
A single piece of retrieved context
ContextQuery
Query to a context provider
ContextResult
Result from a context provider query

Enums§

ContextDepth
Retrieval depth for tiered context (L0/L1/L2 pattern)
ContextType
Type of context being queried

Traits§

ContextProvider
Context provider trait - implement this for OpenViking, RAG systems, etc.