Find answers from the community

Updated last year

from llama index llms import OpenAI

from llama_index.llms import OpenAI
llm = OpenAI(temperature=0, model="text-davinci-002")
service_context = ServiceContext.from_defaults(llm=llm)

When I use this example from the doc I get the following error: how can I solve it?
File "main.py", line 5, in <module>
from llama_index.llms import OpenAI
ModuleNotFoundError: There is no module named 'llama_index.llms'
L
2 comments
The docs are updated, but the latest release is not published to pip yet (should be out today)
You can refer to an older version of the docs to see examples that match your installed version, or install llama-index from source to update to the latest code
Add a reply
Sign up and join the conversation on Discord