pub trait ToolEmbedding: Tool {
type InitError: Error + Send + Sync + 'static;
type Context: for<'a> Deserialize<'a> + Serialize;
type State: Send;
// 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
Trait that represents an LLM tool that can be stored in a vector store and RAGged
Required Associated Types§
type InitError: Error + Send + Sync + 'static
Sourcetype Context: for<'a> Deserialize<'a> + Serialize
type Context: for<'a> Deserialize<'a> + Serialize
Type of the tool’ context. This context will be saved and loaded from the vector store when ragging the tool. This context can be used to store the tool’s static configuration and local context.
Required Methods§
Sourcefn embedding_docs(&self) -> Vec<String>
fn embedding_docs(&self) -> Vec<String>
A method returning the documents that will be used as embeddings for the tool. This allows for a tool to be retrieved from multiple embedding “directions”. If the tool will not be RAGged, this method should return an empty vector.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.