Find answers from the community

Updated 3 months ago

Where did prepend messages go

Where did prepend_messages go?
L
t
e
7 comments
🌫️ its gone!

It was an extremely hacky implementation, error prone, and was never fully supported.

We just recently added the same feature to the agents / chat engines though.
https://gpt-index.readthedocs.io/en/latest/examples/chat_engine/chat_engine_react.html#customize-personality-via-system-prompt

https://gpt-index.readthedocs.io/en/latest/examples/agent/openai_agent.html#agent-with-personality

https://github.com/jerryjliu/llama_index/blob/main/llama_index/prompts/system.py

Should be added officially to query engines at some point in the near future. Workaround for query engines is just creating a custom text_qa_template and refine_template
is there any example for adding chat history?
Yea you can set chat_history as a kwarg through any chat() function

The chat history is just a list of chat_message object

Plain Text
from llama_index.llms import ChatMessage, MessageRole

chat_history = [
    ChatMessage(role=MessageRole.SYSTEM, content="text"),
  ChatMessage(role=MessageRole.USER, content="hello!"),
  ChatMessage(role=MessageRole.ASSISTANT, content="Hi!")
]
oooooooooohh
thank you very much
@Logan M I came across this answer when updating chat_history on my app. It's the only place I see MessageRole.SYSTEM mentioned. Can you point me to any info on what the SYSTEM content does?
It's specific to openai models. It's supposed to be a place to put extra rules for how the model should act
Add a reply
Sign up and join the conversation on Discord