Find answers from the community

Updated last year

Chat engines

Hey guys! Should this example: https://gpt-index.readthedocs.io/en/latest/examples/chat_engine/chat_engine_openai.html, be compatible with version 0.7.6?
L
C
14 comments
It should be, but tbh I haven't confirmed yet personally

Is there an error?
We changed the default chat engine to use an OpenAI function calling agent, or alternatively our react agent
yeah
Plain Text
  File "/opt/homebrew/lib/python3.11/site-packages/llama_index/indices/base.py", line 368, in as_chat_engine
    raise ValueError(f"Unknown chat mode: {chat_mode}")
ValueError: Unknown chat mode: openai
And you are sure you have 0.7.6? I'll check with a fresh env to confirm
this is my code:
Plain Text
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
from llama_index.llms import OpenAI

# Necessary to use the latest OpenAI models that support function calling API
service_context = ServiceContext.from_defaults(llm=OpenAI(model="gpt-3.5-turbo-0613"))
data = SimpleDirectoryReader(input_dir="./data/").load_data()
index = VectorStoreIndex.from_documents(data, service_context=service_context)

chat_engine = index.as_chat_engine(chat_mode="openai", verbose=True)

while True:
    text_input = input("User: ")
    response = chat_engine.chat(text_input)
    print(f'AI Assistant: {response.response}')
Hmmm actually it looks like this was merged in after 0.7.6
But it updated the docs
Plain Text
pip freeze | grep llama-index
llama-index==0.7.6
Can you install from source?

pip install --upgrade git+https://github.com/jerryliu/llama_index
Yeah, it works from the source. Thx
Nice, should have the release on PyPI soon too πŸ™
Add a reply
Sign up and join the conversation on Discord