Find answers from the community

Updated 3 months ago

Hi All: I have an application with two

Hi All: I have an application with two different functions:
one uses openai directly so has "from openai import OpenAI" and a different function using RAG with llamaindex that has:
from llama_index.llms.openai import OpenAI
from llama_index.core import Settings

i want to use settings to change the model but getting runtime errors. any guidance on how to solve this, please?
L
R
S
9 comments
what is the error?
it's probably because he's importing two classes with the same name from different modules
I had that problem with another class
just import the llamaindex openai class as follows:
Plain Text
from llama_index.llms.openai import OpenAI as llamaOpenAI

and import the regular OpenAi class from the openai module as usual
Plain Text
from openai import OpenAI
now the llamaindex implementation of the class is available under llamaOpenAI , and the openai implementation of the class is OpenAI
ah that makes sense
@Roland Tannous
@Roland Tannous , @Logan M Thank you both v much! Your suggestion fixed it and it works now. Much appreciated!
glad to know that helped.
Add a reply
Sign up and join the conversation on Discord