Skip to main content

ToolEmbedding

Trait ToolEmbedding 

Source
pub trait ToolEmbedding: Tool {
    type InitError: Error + WasmCompatSend + WasmCompatSync + 'static;
    type Context: for<'de> Deserialize<'de> + Serialize;
    type State: WasmCompatSend;

    // Required methods
    fn embedding_docs(&self) -> Vec<String>;
    fn context(&self) -> Self::Context;
    fn init(
        state: Self::State,
        context: Self::Context,
    ) -> Result<Self, Self::InitError>;
}
Expand description

A tool that can be stored in a vector store and reconstructed for RAG.

Required Associated Types§

Source

type InitError: Error + WasmCompatSend + WasmCompatSync + 'static

Error returned while reconstructing the tool.

Source

type Context: for<'de> Deserialize<'de> + Serialize

Serializable static context.

Source

type State: WasmCompatSend

Runtime initialization state.

Required Methods§

Source

fn embedding_docs(&self) -> Vec<String>

Documents used to retrieve the tool.

Source

fn context(&self) -> Self::Context

Serializable tool context.

Source

fn init( state: Self::State, context: Self::Context, ) -> Result<Self, Self::InitError>

Reconstruct the tool.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§