Closed ssocean closed 1 week ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
this is a deprecated implementation, main implementation now lives in libs/partners/openai/langchain_openai/chat_models/base.py. can we make all changes there?
this is a deprecated implementation, main implementation now lives in libs/partners/openai/langchain_openai/chat_models/base.py. can we make all changes there?
Thank you for pointing out the correct location for the implementation. I apologize for the oversight and for making changes in a deprecated file. I have now applied the necessary modifications to libs/partners/openai/langchain_openai/chat_models/base.py as suggested. Please let me know if there are any further adjustments needed~
PR Title:
community: improve error handling for missing choices and API errors
PR Message:
Description: This update introduces clearer error handling in the response processing logic. Specifically, it adds explicit exceptions for cases where the API response lacks the
choices
field or contains error messages, enhancing the debuggability of the integration.For instance, if there is an issue with the API response (possibly due to excessively long tokens, insufficient balance, or service unavailability, etc.), it previously triggered a "TypeError: 'NoneType' object is not iterable" error. Now, it generates a ValueError stating "This model's maximum context length is 16385 tokens. However, your messages resulted in 19223 tokens. Please reduce the length of the messages. (request id: xxx)."
Issue: N/A
Dependencies: None
Twitter handle: N/A