Closed solon-ma closed 1 year ago
Langchain Version: 0.0.74 is 6 months old. Upgrading should fix this.
Run pip install langchain --upgrade
Run pip install langchain --upgrade
These doesn't fix the issue
import os
api_key = os.environ.get('OPENAI_API_KEY')
from langchain.llms import OpenAI
llm = OpenAI(openai_api_key=api_key,model_name="text-davinci-003",temperature=0.9)
x = llm(prompt='"What would be a good company name for a company that makes colorful socks?"')
print(x)
pip install langchain --upgrade --user try this
Do not use
llm.predict
Just use ArunD's solution and it worked.
x = llm(prompt='xxx')
Do not use
llm.predict
Just use ArunD's solution and it worked.x = llm(prompt='xxx')
LLM.predict is recommended by official langchain document in the latest version
pip install langchain --upgrade --user
This worked.
pip install langchain --upgrade --user
This worked.
Upgrade the langchain version to the latest version(0.0.272), the same problem is fixed!
Those experiencing issues have likely installed Langchain in an environment alongside other Python libraries, leading to compatibility problems. My recommendation is to start fresh. According to its documentation, Langchain comes bundled with all the necessary libraries and requires Python version 3.8.1 or higher, but lower than 4.0. Therefore, create a new environment with a compatible Python version, and then only install Langchain using pip. You can add other required libraries afterward and remove if again issues arise
System Info
Langchain Version: 0.0.74 openai Version: 0.27.8
Who can help?
No response
Information
Related Components
Reproduction
from langchain.llms import OpenAI llm = OpenAI(openai_api_key=INSERT_API_KEY, temperature=0.9) llm.predict("What would be a good company name for a company that makes colorful socks?")
Expected behavior
I was following the langchain quickstart guide, expected to see something similar to the output.