mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
community: fix dashcope embeddings embed_query func post too much req to api (#24707)
the fuc of embed_query of dashcope embeddings send a str param, and in the embed_with_retry func will send error content to api
This commit is contained in:
parent
b65ac8d39c
commit
5f593c172a
@ -48,8 +48,11 @@ def embed_with_retry(embeddings: DashScopeEmbeddings, **kwargs: Any) -> Any:
|
||||
result = []
|
||||
i = 0
|
||||
input_data = kwargs["input"]
|
||||
while i < len(input_data):
|
||||
kwargs["input"] = input_data[i : i + 25]
|
||||
input_len = len(input_data) if isinstance(input_data, list) else 1
|
||||
while i < input_len:
|
||||
kwargs["input"] = (
|
||||
input_data[i : i + 25] if isinstance(input_data, list) else input_data
|
||||
)
|
||||
resp = embeddings.client.call(**kwargs)
|
||||
if resp.status_code == 200:
|
||||
result += resp.output["embeddings"]
|
||||
|
Loading…
Reference in New Issue
Block a user