Closed realoptimal closed 2 months ago
🤖
Hello @realoptimal,
I'm Dosu, a friendly bot here to assist you. I can help with troubleshooting, answer your queries, and guide you on becoming a contributor to LangChain. While we wait for a human maintainer, I'm your first point of contact.
I'm currently reviewing your issue and will provide a detailed response shortly.
same
🤖
Based on the error message you're encountering, it seems like the 'openai' module does not have an attribute or method named 'Completion'. This could be due to a change in the OpenAI API or the 'openai' Python package that is not reflected in the LangChain code.
The 'openai' module is typically used to interact with the OpenAI API, and the 'Completion' attribute might be related to generating completions from a language model. However, in the provided code, there is no direct usage of 'Completion'.
It's possible that the 'Completion' attribute is being used in the 'OpenAI' class from 'langchain.llms', which is not shown in the provided code. To resolve the issue, please check the 'OpenAI' class in 'langchain.llms' to see if they are using 'Completion' from 'openai'. If they are, you might need to update the 'openai' module or the 'OpenAI' class to match the current API of 'openai'.
In the context shared, the 'openai' module is used in the test functions 'test_openai_retries' and 'test_openai_async_retries' where it raises an 'openai.error.APIError'. However, there is no usage of 'Completion' in these functions. Therefore, the error might be coming from the 'OpenAI' class in 'langchain.llms' or another part of the code not shown in the context shared.
Here are the relevant sources for your reference:
Please let me know if you need further assistance.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
openai just dropped their 1.0 which have changes in the API interfaces: https://github.com/openai/openai-python/discussions/631
Langchain currently doesn't support openai 1.0 API.
Hi i hust trying to install it and got the same error. any fixes ?
if fixed this,call me,please
Should have filed this differently. Fix is to use a OpenAI v0.28.1
Is moving to 0.28.1 the only way?
O installed a version of open ai smaller that 1 and it works
Στις Παρ 10 Νοε 2023, 5:22 π.μ. ο χρήστης rajib @.***> έγραψε:
Is moving to 0.28.1 the only way?
— Reply to this email directly, view it on GitHub https://github.com/langchain-ai/langchain/issues/12958#issuecomment-1805014694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK2UUK3KHJLBGYE3BHK5BA3YDWMWRAVCNFSM6AAAAAA7AGC7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBVGAYTINRZGQ . You are receiving this because you commented.Message ID: @.***>
Hi, @realoptimal,
I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, you encountered a compatibility problem between Langchain and OpenAI versions, which was later resolved by using OpenAI v0.28.1 as suggested by you.
Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your understanding and assistance in keeping the repository's issue tracker up to date.
I appreciate your cooperation.
Facing the same problem.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
@realoptimal
Does using ChatOpenAI instead of OpenAI solve your problem?
I was facing the same kind of error, but I solved it by introducing the langchain-openai
library and using ChatOpenAI.
System Info
Langchain: v0.0.331 openai: v1.1.0 platform: Mac M2 python: 3.11.2
Who can help?
No response
Information
Related Components
Reproduction
Expected behavior
It correctly instantiates provided an API key is present in the environment