[bug]TypeError: object of type 'NoneType' has no len()
Sometimes the chunk.choices is None, and I got exception like: ``` TypeError: object of type 'NoneType' has no len() ```
This commit is contained in:
@@ -221,7 +221,7 @@ class BaseOpenAILLMService(LLMService):
|
|||||||
)
|
)
|
||||||
await self.start_llm_usage_metrics(tokens)
|
await self.start_llm_usage_metrics(tokens)
|
||||||
|
|
||||||
if len(chunk.choices) == 0:
|
if chunk.choices is None or len(chunk.choices) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
await self.stop_ttfb_metrics()
|
await self.stop_ttfb_metrics()
|
||||||
|
|||||||
Reference in New Issue
Block a user