Find answers from the community

Updated 11 months ago

Hello @Logan M and everybody

Hello @Logan M and everybody
I want my llama-index RAG chatbot to remember past question for context, can I follow the format openai has for chat completion? here message will go to llama-index bot instead of this?

response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"},
{"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
{"role": "user", "content": "Where was it played?"}
])

also, how to manage if message get close to context length for give openai model? is there any better way to make model remember past questions?
W
p
4 comments
You can try Chat Engine: https://docs.llamaindex.ai/en/stable/module_guides/deploying/chat_engines/root.html#concept

It will help your bot remember past conversations while answering.

Plus there are different modes of chat engine that you can see which fits your case
Hello @WhiteFang_Jr what you're saying is correct but I am using multi llm architecture so how can I pass last/final output to this first llm for it to remember past question? is there any way? really appreciate your help.
chat engine provides a way to extract all the conversations, After final output you can extract that and pass it to First llm.
https://github.com/run-llama/llama_index/blob/c058f2531ea86ee74822cb1421ceaeee7098a99f/llama_index/chat_engine/condense_plus_context.py#L360
Thank you so much for your help @WhiteFang_Jr
Add a reply
Sign up and join the conversation on Discord