xtrace_sdk.x_vec.inference.embedding¶
Classes¶
This class provides an interface to generate embeddings using different providers. |
Module Contents¶
- class xtrace_sdk.x_vec.inference.embedding.Embedding(provider, model_name, dim)¶
This class provides an interface to generate embeddings using different providers. Supported providers include “ollama”, “openai”, and “sentence_transformer”. It also includes methods to convert float embeddings to binary format.
- dim¶
- provider¶
- url¶
- model_name¶
- async embed(text)¶
Generates an embedding for the given text using the specified provider.
- Parameters:
text (str) – The input text to be embedded.
- Returns:
A numpy array representing the embedding of the input text.
- Return type:
np.ndarray
- Raises:
ValueError – If the embedding dimension does not match the expected dimension.
- static float_2_bin(float_array)¶
Convert a list of floats to a list of binary integers, naive implementation, preserves dimension