TextEmbedEmbeddings#

class langchain_community.embeddings.textembed.TextEmbedEmbeddings[source]#

Bases: BaseModel, Embeddings

A class to handle embedding requests to the TextEmbed API.

model#

The TextEmbed model ID to use for embeddings.

api_url#

The base URL for the TextEmbed API.

api_key#

The API key for authenticating with the TextEmbed API.

client#

The TextEmbed client instance.

Example

from langchain_community.embeddings import TextEmbedEmbeddings

embeddings = TextEmbedEmbeddings(
    model="sentence-transformers/clip-ViT-B-32",
    api_url="http://localhost:8000/v1",
    api_key="<API_KEY>"
)

For more information: kevaldekivadiya2415/textembed

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param api_key: SecretStr [Optional]#

API Key for authentication

param api_url: str [Optional]#

Endpoint URL to use.

param client: Any = None#

TextEmbed client.

param model: str [Required]#

Underlying TextEmbed model id.

async aembed_documents(texts: List[str]) List[List[float]][source]#

Async call out to TextEmbed’s embedding endpoint.

Parameters:

texts (List[str]) – The list of texts to embed.

Returns:

List of embeddings, one for each text.

Return type:

List[List[float]]

async aembed_query(text: str) List[float][source]#

Async call out to TextEmbed’s embedding endpoint for a single query.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

embed_documents(texts: List[str]) List[List[float]][source]#

Call out to TextEmbed’s embedding endpoint.

Parameters:

texts (List[str]) – The list of texts to embed.

Returns:

List of embeddings, one for each text.

Return type:

List[List[float]]

embed_query(text: str) List[float][source]#

Call out to TextEmbed’s embedding endpoint for a single query.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

Examples using TextEmbedEmbeddings