AsyncOpenAITextEmbedEmbeddingClient#

class langchain_community.embeddings.textembed.AsyncOpenAITextEmbedEmbeddingClient(
host: str = 'http://localhost:8000/v1',
api_key: str | None = None,
aiosession: ClientSession | None = None,
)[source]#

A client to handle synchronous and asynchronous requests to the TextEmbed API.

Parameters:
  • host (str)

  • api_key (str | None)

  • aiosession (ClientSession | None)

host#

The base URL for the TextEmbed API.

Type:

str

api_key#

The API key for authenticating with the TextEmbed API.

Type:

str

aiosession#

The aiohttp session for async requests.

Type:

Optional[aiohttp.ClientSession]

_batch_size#

Maximum batch size for a single request.

Type:

int

Methods

__init__([host, api_key, aiosession])

aembed(model, texts)

Embeds a list of texts asynchronously.

embed(model, texts)

Embeds a list of texts synchronously.

__init__(
host: str = 'http://localhost:8000/v1',
api_key: str | None = None,
aiosession: ClientSession | None = None,
) None[source]#
Parameters:
  • host (str)

  • api_key (str | None)

  • aiosession (ClientSession | None)

Return type:

None

async aembed(
model: str,
texts: List[str],
) List[List[float]][source]#

Embeds a list of texts asynchronously.

Parameters:
  • model (str) – The model to use for embedding.

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

Returns:

List of embeddings for the texts.

Return type:

List[List[float]]

embed(
model: str,
texts: List[str],
) List[List[float]][source]#

Embeds a list of texts synchronously.

Parameters:
  • model (str) – The model to use for embedding.

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

Returns:

List of embeddings for the texts.

Return type:

List[List[float]]