pub struct Embeddings { /* private fields */ }
Expand description

Embeddings definition

Implementations

Embeddings implementation

Creates an Embeddings instance.

Arguments
  • url - base url of txtai API

Runs an Embeddings search. Returns Response. This method allows callers to customize the serialization of the response.

Arguments
  • query - query text
  • limit - maximum results

Finds documents in the embeddings model most similar to the input query. Returns a list of {id: value, score: value} sorted by highest score, where id is the document id in the embeddings model.

Arguments
  • query - query text
  • limit - maximum results

Finds documents in the embeddings model most similar to the input queries. Returns a list of {id: value, score: value} sorted by highest score per query, where id is the document id in the embeddings model.

Arguments
  • queries - queries text
  • limit - maximum results

Adds a batch of documents for indexing.

Arguments
  • documents - list of {id: value, text: value}

Builds an embeddings index for previously batched documents.

Runs an embeddings upsert operation for previously batched documents.

Deletes from an embeddings index. Returns list of ids deleted.

Arguments
  • ids - list of ids to delete

Total number of elements in this embeddings index.

Computes the similarity between query and list of text. Returns a list of {id: value, score: value} sorted by highest score, where id is the index in texts.

Arguments
  • query - query text
  • texts - list of text

Computes the similarity between list of queries and list of text. Returns a list of {id: value, score: value} sorted by highest score per query, where id is the index in texts.

Arguments
  • queries - queries text
  • texts - list of text

Transforms text into an embeddings array.

Arguments
  • text - input text

Transforms list of text into embeddings arrays.

Arguments
  • texts - lists of text

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

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

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

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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