Find answers from the community

Updated last month

the way to change the underlying model has changed

At a glance
am i being stupid or has the way to change the underlying model changed? why do I get this

ImportError: cannot import name 'OpenAI' from 'llama_index.core.llms' (/home/runner/workspace/.pythonlibs/lib/python3.11/site-packages/llama_index/core/llms/init.py)
L
t
7 comments
It should be from llama_index.llms.openai import OpenAI
seem to be able to import now but keep getting this..
File "/home/runner/workspace/main.py", line 47, in <module>
Settings.llm = OpenAI(model="gpt-4o", temperature=0.1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: OpenAI.init() got an unexpected keyword argument 'model'
unclear to me how i actually input a custom llm?
πŸ€” Are you sure you didn't import OpenAI twice from two different locations? This works for me

Plain Text
from llama_index.llms.openai import OpenAI
llm = OpenAI(model="gpt-4o", temperature=0.1)


Maybe double check you don't have from openai import OpenAI in your code or similar
my God you are good
heh I've seen it all at this point 😁 Glad that was it!
Add a reply
Sign up and join the conversation on Discord