Find answers from the community

Updated 3 months ago

Hi, after updating LlamaIndex to the

Hi, after updating LlamaIndex to the latest I see the exception "'openai' has no attribute 'error'" fired here "site-packages\langchain\chat_models\openai.py", line 77" but not sure how to fix it. Thanks!
L
S
20 comments
Try pip uninstall llama-index openai and then pip install llama-index
Thanks, I will try!
@Logan M Tried but it still installs openai 1.2.0 and this version already doesn't have error in their init.py file
right, and the latest version of llama-index doesn't import from error
the traceback is from langchain
is there a reason you are using langchain here?
we have our own LLM objects
No reason at all, I thought it's from you πŸ€”
site-packages\langchain\chat_models\openai.py
langchain πŸ™‚
Plain Text
from llama_index.llms import OpenAI

llm = OpenAI(model="gpt-4", temperature=0.1)
Not sure what is that
I pointed out the error was coming from langchains files, and then gave an example of how to use our LLM instead πŸ‘
Ahhh okay, I see. In my code I can see these imports:
Plain Text
from langchain.prompts.chat import (
    AIMessagePromptTemplate,
    ChatPromptTemplate,
    HumanMessagePromptTemplate
)

from langchain.chains.prompt_selector import ConditionalPromptSelector, is_chat_model
from langchain.chat_models import ChatOpenAI

I copied all of them some time ago from examples on your website...
times change I suppose πŸ™‚
So, do you think I can find all these classes/functions in LlamaIndex without using langchain?
Depends what you are doing with all those. At the very least, you can probably replace ChatOpenAI with our OpenAI module and avoid the error I think?
Okay, gotcha! Thanks for your help!!
Add a reply
Sign up and join the conversation on Discord