Skip to main content

HelixDBVectorStore

Struct HelixDBVectorStore 

Source
pub struct HelixDBVectorStore<C, E> { /* private fields */ }
Expand description

A client for easily carrying out Rig-related vector store operations.

If you are unsure what type to use for the client, helix_rs::HelixDB is the typical default.

Usage:

let openai_model =
    rig::providers::openai::Client::from_env().embedding_model("text-embedding-ada-002");

let helixdb_client = HelixDB::new(None, Some(6969), None);
let vector_store = HelixDBVectorStore::new(helixdb_client, openai_model.clone());

Implementations§

Source§

impl<C, E> HelixDBVectorStore<C, E>

Source

pub fn new(client: C, model: E) -> Self

Source

pub fn client(&self) -> &C

Trait Implementations§

Source§

impl<C, E> InsertDocuments for HelixDBVectorStore<C, E>

Source§

async fn insert_documents<Doc: Serialize + Embed + Send>( &self, documents: Vec<(Doc, OneOrMany<Embedding>)>, ) -> Result<(), VectorStoreError>

Source§

impl<C, E> VectorStoreIndex for HelixDBVectorStore<C, E>

Source§

type Filter = Filter<Value>

The filter type for this backend.
Source§

async fn top_n<T: for<'a> Deserialize<'a> + Send>( &self, req: VectorSearchRequest<HelixDBFilter>, ) -> Result<Vec<(f64, String, T)>, VectorStoreError>

Returns the top N most similar documents as (score, id, document) tuples.
Source§

async fn top_n_ids( &self, req: VectorSearchRequest<HelixDBFilter>, ) -> Result<Vec<(f64, String)>, VectorStoreError>

Returns the top N most similar document IDs as (score, id) tuples.

Auto Trait Implementations§

§

impl<C, E> Freeze for HelixDBVectorStore<C, E>
where C: Freeze, E: Freeze,

§

impl<C, E> RefUnwindSafe for HelixDBVectorStore<C, E>

§

impl<C, E> Send for HelixDBVectorStore<C, E>
where C: Send, E: Send,

§

impl<C, E> Sync for HelixDBVectorStore<C, E>
where C: Sync, E: Sync,

§

impl<C, E> Unpin for HelixDBVectorStore<C, E>
where C: Unpin, E: Unpin,

§

impl<C, E> UnsafeUnpin for HelixDBVectorStore<C, E>
where C: UnsafeUnpin, E: UnsafeUnpin,

§

impl<C, E> UnwindSafe for HelixDBVectorStore<C, E>
where C: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, F> Tool for T
where F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>, T: VectorStoreIndex<Filter = F>,

Source§

const NAME: &'static str = "search_vector_store"

The name of the tool. This name should be unique.
Source§

type Error = VectorStoreError

The error type of the tool.
Source§

type Args = VectorSearchRequest<F>

The arguments type of the tool.
Source§

type Output = Vec<VectorStoreOutput>

The output type of the tool.
Source§

async fn definition(&self, _prompt: String) -> ToolDefinition

A method returning the tool definition. The user prompt can be used to tailor the definition to the specific use case.
Source§

async fn call( &self, args: <T as Tool>::Args, ) -> Result<<T as Tool>::Output, <T as Tool>::Error>

The tool execution method. Both the arguments and return value are a String since these values are meant to be the output and input of LLM models (respectively)
Source§

fn name(&self) -> String

A method returning the name of the tool.
Source§

impl<T> ToolDyn for T
where T: Tool,

Source§

fn name(&self) -> String

Source§

fn definition<'a>( &'a self, prompt: String, ) -> Pin<Box<dyn Future<Output = ToolDefinition> + Send + 'a>>

Source§

fn call<'a>( &'a self, args: String, ) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'a>>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<I, F> VectorStoreIndexDyn for I
where I: VectorStoreIndex<Filter = F>, F: Debug + Clone + SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + Serialize + for<'de> Deserialize<'de> + 'static,

Source§

fn top_n<'a>( &'a self, req: VectorSearchRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(f64, String, Value)>, VectorStoreError>> + Send + 'a>>

Source§

fn top_n_ids<'a>( &'a self, req: VectorSearchRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + Send + 'a>>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,