mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 12:18:24 +00:00
langchain[patch]: use async_embed_with_retry in _aget_len_safe_embeddings (#14110)
**Description** `embed_with_retry` is for sync operations and not for async operations. Use `async_embed_with_retry` for appropriate async operations. I'm using `OpenAIEmbedding(http_client=httpx.AsyncClient())` with only async operations. However, I got an error when I use `embedding.aembed_documents` because `embed_with_retry` uses sync OpenAI client with async http client.
This commit is contained in:
parent
371bcb7580
commit
32da0a4d71
@ -523,7 +523,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
|
|||||||
for i in range(len(texts)):
|
for i in range(len(texts)):
|
||||||
_result = results[i]
|
_result = results[i]
|
||||||
if len(_result) == 0:
|
if len(_result) == 0:
|
||||||
average_embedded = embed_with_retry(
|
average_embedded = await async_embed_with_retry(
|
||||||
self,
|
self,
|
||||||
input="",
|
input="",
|
||||||
**self._invocation_params,
|
**self._invocation_params,
|
||||||
|
Loading…
Reference in New Issue
Block a user