langchain_community.embeddings.infinity.InfinityEmbeddings¶
class langchain_community.embeddings.infinity.InfinityEmbeddings[source]¶
Bases: BaseModel, Embeddings
Embedding models for self-hosted https://github.com/michaelfeil/infinity
This should also work for text-embeddings-inference and other
self-hosted openai-compatible servers.
Infinity is a class to interact with Embedding Models on https://github.com/michaelfeil/infinity
Example
from langchain_community.embeddings import InfinityEmbeddings
InfinityEmbeddings(
    model="BAAI/bge-small",
    infinity_api_url="http://localhost:7797/v1",
)
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param client: Any = None¶
Infinity client.
param infinity_api_url: str = 'http://localhost:7797/v1'¶
Endpoint URL to use.
param model: str [Required]¶
Underlying Infinity model id.
async aembed_documents(texts: List[str]) → List[List[float]][source]¶
Async call out to Infinity’s embedding endpoint.
Parameters
texts – The list of texts to embed.
Returns
List of embeddings, one for each text.
async aembed_query(text: str) → List[float][source]¶
Async call out to Infinity’s embedding endpoint.
Parameters
text – The text to embed.
Returns
Embeddings for the text.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.