-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 简洁阐述问题 接入zhipu-api的在线大模型报错/ Concise description of the issue #4002
Comments
The error you're encountering, "TypeError: object of type 'NoneType' has no len()", suggests that the code is attempting to measure the length of an object that is To resolve this, ensure if chunk is not None and "choices" in chunk and len(chunk["choices"]) == 0:
# Your logic here This code snippet checks that If try:
if chunk is not None and "choices" in chunk and len(chunk["choices"]) == 0:
# Your logic here
except Exception as e:
logging.exception("Error while processing chunk: %s", e) This approach will help identify why
|
同样,我也碰到这个,改了老半天,还是不能跑。 |
接入zhipu-api的在线大模型进行LLM对话报错,报错信息如下,请问是什么原因
Traceback (most recent call last):
File "/usr/local/serving/serving/server/utils.py", line 36, in wrap_done
await fn
File "/opt/conda/lib/python3.10/site-packages/langchain/chains/base.py", line 385, in acall
raise e
File "/opt/conda/lib/python3.10/site-packages/langchain/chains/base.py", line 379, in acall
await self._acall(inputs, run_manager=run_manager)
File "/opt/conda/lib/python3.10/site-packages/langchain/chains/llm.py", line 275, in _acall
response = await self.agenerate([inputs], run_manager=run_manager)
File "/opt/conda/lib/python3.10/site-packages/langchain/chains/llm.py", line 142, in agenerate
return await self.llm.agenerate_prompt(
File "/opt/conda/lib/python3.10/site-packages/langchain_core/language_models/chat_models.py", line 554, in agenerate_prompt
return await self.agenerate(
File "/opt/conda/lib/python3.10/site-packages/langchain_core/language_models/chat_models.py", line 514, in agenerate
raise exceptions[0]
File "/opt/conda/lib/python3.10/site-packages/langchain_core/language_models/chat_models.py", line 617, in _agenerate_with_cache
return await self._agenerate(
File "/opt/conda/lib/python3.10/site-packages/langchain_community/chat_models/openai.py", line 522, in _agenerate
return await agenerate_from_stream(stream_iter)
File "/opt/conda/lib/python3.10/site-packages/langchain_core/language_models/chat_models.py", line 87, in agenerate_from_stream
async for chunk in stream:
File "/opt/conda/lib/python3.10/site-packages/langchain_community/chat_models/openai.py", line 493, in _astream
if len(chunk["choices"]) == 0:
TypeError: object of type 'NoneType' has no len()
The text was updated successfully, but these errors were encountered: