Find answers from the community

Updated 3 months ago

Hey community,

Hey community,

I'm currently working on customizing the REACT_CHAT_SYSTEM_HEADER in ReActAgent. I followed the initial setup using the prompt from llama_index.agent.react.prompts import REACT_CHAT_SYSTEM_HEADER. However, it appears that my changes to the prompt are not taking effect. query_engine_tools = [
QueryEngineTool(
query_engine=query_engine,
metadata=ToolMetadata(
name="General",
description=("Build to provide geeneral answers "),
),
)
]

agent = ReActAgent.from_tools(
tools=query_engine_tools,
llm=llm,
verbose=False,
system_prompt=REACT_CHAT_SYSTEM_HEADER,
)
W
a
5 comments
Did not find system_prompt in the ReactAgent.
Also from_tools is not returning any prompt related keyword.

https://github.com/run-llama/llama_index/blob/53b336d2eb38cf186541fa4fa797a3c9567f1b16/llama_index/agent/react/base.py#L88
Can you share the example that you are follwoing
Indeed, I must clarify that I attempted to customize the prompt to provide specific instructions to the system, deviating from the default REACT_CHAT_SYSTEM_HEADER utilized in the ReActChatFormatter. https://github.com/run-llama/llama_index/blob/53b336d2eb38cf186541fa4fa797a3c9567f1b16/llama_index/agent/react/formatter.py https://github.com/run-llama/llama_index/blob/53b336d2eb38cf186541fa4fa797a3c9567f1b16/llama_index/agent/react/prompts.py
Oh okay, I think you can customize this like.

Plain Text
from llama_index.agent.react.formatter import ReActChatFormatter

rchf = ReActChatFormatter()
rchf.system_header = "ADD YOUR PROMPT HERE"


agent = ReActAgent.from_tools(
    tools=query_engine_tools,
    llm=llm,
    verbose=False,
    react_chat_formatter = rchf
)


This should work
thanks a lot
Add a reply
Sign up and join the conversation on Discord