mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 20:28:10 +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)):
|
||||
_result = results[i]
|
||||
if len(_result) == 0:
|
||||
average_embedded = embed_with_retry(
|
||||
average_embedded = await async_embed_with_retry(
|
||||
self,
|
||||
input="",
|
||||
**self._invocation_params,
|
||||
|
Loading…
Reference in New Issue
Block a user