Aurelio Docs
Client Reference

semantic_router.schema

EncoderType Objects

class EncoderType(Enum)

The type of encoder.

EncoderInfo Objects

class EncoderInfo(BaseModel)

Information about an encoder.

RouteChoice Objects

class RouteChoice(BaseModel)

A route choice output by the routers.

Utterance Objects

class Utterance(BaseModel)

One record in an index: a route name, one of its utterances, and the record's metadata (the route's own metadata plus the reserved sr_ keys).

Metric Objects

class Metric(Enum)

The metric to use in vector-based similarity search indexes.

SparseEmbedding Objects

class SparseEmbedding(BaseModel)

Sparse embedding interface. Primarily uses numpy operations for faster operations.

from_compact_array

@classmethod
def from_compact_array(cls, array: np.ndarray)

Create a SparseEmbedding object from a compact array.

Arguments:

  • array (np.ndarray): A compact array.

Returns:

SparseEmbedding: A SparseEmbedding object.

from_vector

@classmethod
def from_vector(cls, vector: np.ndarray)

Consumes an array of sparse vectors containing zero-values.

Arguments:

  • vector (np.ndarray): A sparse vector.

Returns:

SparseEmbedding: A SparseEmbedding object.

from_aurelio

@classmethod
def from_aurelio(cls, embedding: "BM25SparseEmbedding")

Create a SparseEmbedding object from an AurelioSparseEmbedding object.

Arguments:

  • embedding (BM25SparseEmbedding): An AurelioSparseEmbedding object.

Returns:

SparseEmbedding: A SparseEmbedding object.

from_dict

@classmethod
def from_dict(cls, sparse_dict: dict)

Create a SparseEmbedding object from a dictionary.

Arguments:

  • sparse_dict (dict): A dictionary of sparse values.

Returns:

SparseEmbedding: A SparseEmbedding object.

from_pinecone_dict

@classmethod
def from_pinecone_dict(cls, sparse_dict: dict)

Create a SparseEmbedding object from a Pinecone dictionary.

Arguments:

  • sparse_dict (dict): A Pinecone dictionary.

Returns:

SparseEmbedding: A SparseEmbedding object.

to_dict

def to_dict()

Convert a SparseEmbedding object to a dictionary.

Returns:

dict: A dictionary of sparse values.

to_pinecone

def to_pinecone()

Convert a SparseEmbedding object to a Pinecone dictionary.

Returns:

dict: A Pinecone dictionary.

items

def items()

Return a list of (index, value) tuples from the SparseEmbedding object.

Returns:

list: A list of (index, value) tuples.

On this page