You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
Getting error for this code -
fromlangchain_openaiimportOpenAIllm=OpenAI(model='gpt-3.5-turbo', temperature=0, streaming=True)
llm('how are you?')
Error Message and Stack Trace (if applicable)
NotFoundError: Error code: 404 - {'error': {'message': 'This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}
Description
Getting above specified error when configuring gpt-3.5-turbo model with OpenAI
However, this model works as expected with ChatOpenAI
On the other hand, gpt-3.5-turbo-instruct model also works as expected with OpenAI, code is mentioned below -
fromlangchain_openaiimportOpenAIllm=OpenAI(model='gpt-3.5-turbo-instruct',temperature=0, streaming=True)
llm('how are you?')
Here is the screenshot for reference -
I believe this issue is due to configuring non-supported model with OpenAI instead of ChatOpenAI
Observation 🔍
I referred the codebase of openai python package and observed that there are some set of models which has only support of v1/chat/completions (ChatOpenAI as implemented within langchain). Check these files for more details -
Potential Fix 🤔
Should we validate the model name by referring to the same list when handling parameters for OpenAI, and raise an error accordingly?
I can work on this, please check and let me know
System Info
System Information
OS: Darwin
OS Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64
Python Version: 3.11.8 (main, Feb 26 2024, 15:43:17) [Clang 14.0.6 ]
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
langgraph
langserve
The text was updated successfully, but these errors were encountered:
dosubotbot
added
🔌: openai
Primarily related to OpenAI integrations
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
labels
Apr 14, 2024
@baskaryan Yeah, I got this. However, the problem is lack of documentation regarding which model serves as the chat model which might cause confusion. It might be beneficial to either clarify this in the documentation or implement an explicit error message. What are your thoughts on this?
Checked other resources
Example Code
Getting error for this code -
Error Message and Stack Trace (if applicable)
NotFoundError: Error code: 404 - {'error': {'message': 'This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}
Description
Getting above specified error when configuring
gpt-3.5-turbo
model withOpenAI
However, this model works as expected with
ChatOpenAI
On the other hand,
gpt-3.5-turbo-instruct
model also works as expected withOpenAI
, code is mentioned below -Here is the screenshot for reference -
I believe this issue is due to configuring non-supported model with
OpenAI
instead ofChatOpenAI
Observation 🔍
I referred the codebase of openai python package and observed that there are some set of models which has only support of
v1/chat/completions
(ChatOpenAI
as implemented within langchain). Check these files for more details -v1/chat/completions
: src/openai/resources/chat/completions.py (list of specific models mentioned here)v1/completions
: src/openai/resources/completions.pyPotential Fix 🤔
Should we validate the model name by referring to the same list when handling parameters for OpenAI, and raise an error accordingly?
I can work on this, please check and let me know
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
The text was updated successfully, but these errors were encountered: