Spaces:
Runtime error
Runtime error
modify prompt
Browse files
app.py
CHANGED
|
@@ -154,7 +154,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 154 |
# "hwchase17/react-chat" is a prompt template designed for ReAct-style conversational agents.
|
| 155 |
#prompt = hub.pull("hwchase17/react-chat")
|
| 156 |
prompt = PromptTemplate(
|
| 157 |
-
input_variables=["input", "agent_scratchpad", "chat_history", "tool_names"],
|
| 158 |
template="""
|
| 159 |
You are a helpful AI Agent/Assistant that can answer complex questions and perform tasks.
|
| 160 |
It is CRUCIAL that you ALWAYS follow the exact format below. Do not deviate.
|
|
@@ -169,7 +169,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 169 |
Action Input: [input_for_the_tool]
|
| 170 |
Observation: [result_from_the_tool]
|
| 171 |
|
| 172 |
-
NOTE:
|
| 173 |
|
| 174 |
If you have sufficient information and can provide a concise response, or if no tool is needed, you MUST use this precise format:
|
| 175 |
|
|
@@ -203,7 +203,6 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 203 |
{agent_scratchpad}
|
| 204 |
"""
|
| 205 |
)
|
| 206 |
-
|
| 207 |
#summary_memory = ConversationSummaryMemory(llm=llm_client, memory_key="chat_history")
|
| 208 |
summary_memory = ConversationSummaryBufferMemory(llm=llm_client, memory_key="chat_history",
|
| 209 |
max_token_limit=4000) # Adjust this value based on your observations and model's context window
|
|
|
|
| 154 |
# "hwchase17/react-chat" is a prompt template designed for ReAct-style conversational agents.
|
| 155 |
#prompt = hub.pull("hwchase17/react-chat")
|
| 156 |
prompt = PromptTemplate(
|
| 157 |
+
input_variables=["input", "agent_scratchpad", "chat_history", "tool_names"],
|
| 158 |
template="""
|
| 159 |
You are a helpful AI Agent/Assistant that can answer complex questions and perform tasks.
|
| 160 |
It is CRUCIAL that you ALWAYS follow the exact format below. Do not deviate.
|
|
|
|
| 169 |
Action Input: [input_for_the_tool]
|
| 170 |
Observation: [result_from_the_tool]
|
| 171 |
|
| 172 |
+
NOTE: If the input contains the exact phrase "Attachment '{file_name}' available at: {attachment_url}" (where 'file_name' and 'attachment_url' are placeholders for actual values), then you MUST use the 'web_downloader_limited' tool. Otherwise, you should use the 'tavily_search' tool.
|
| 173 |
|
| 174 |
If you have sufficient information and can provide a concise response, or if no tool is needed, you MUST use this precise format:
|
| 175 |
|
|
|
|
| 203 |
{agent_scratchpad}
|
| 204 |
"""
|
| 205 |
)
|
|
|
|
| 206 |
#summary_memory = ConversationSummaryMemory(llm=llm_client, memory_key="chat_history")
|
| 207 |
summary_memory = ConversationSummaryBufferMemory(llm=llm_client, memory_key="chat_history",
|
| 208 |
max_token_limit=4000) # Adjust this value based on your observations and model's context window
|