Martin Bär
commited on
Commit
·
82d14b3
1
Parent(s):
1889103
Update sys prompt
Browse files- basic_agent.py +10 -10
- requirements.txt +0 -1
basic_agent.py
CHANGED
@@ -50,22 +50,22 @@ class BasicAgent:
|
|
50 |
|
51 |
# Create Alfred with all the tools
|
52 |
self.agent = AgentWorkflow.from_tools_or_functions( # ReActAgent(
|
53 |
-
wiki_spec.to_tool_list(), # webpage_tool does not work properly - cookies etc
|
54 |
llm=llm,
|
55 |
-
verbose=True
|
|
|
|
|
|
|
|
|
|
|
56 |
)
|
57 |
|
58 |
# self.ctx = Context(self.agent)
|
59 |
|
60 |
async def __call__(self, question: str) -> str:
|
61 |
-
|
62 |
-
"Reply to the user's question below by using tools if necessary. "
|
63 |
-
"Only output the answer to the question, no additional information or explanations. "
|
64 |
-
f"Question: {question}"
|
65 |
-
)
|
66 |
-
print(prompt)
|
67 |
-
response = await self.agent.run(user_msg=prompt) # ctx=self.ctx)
|
68 |
|
69 |
if self.langfuse:
|
70 |
self.instrumentor.flush()
|
71 |
-
|
|
|
|
50 |
|
51 |
# Create Alfred with all the tools
|
52 |
self.agent = AgentWorkflow.from_tools_or_functions( # ReActAgent(
|
53 |
+
wiki_spec.to_tool_list() + [search_tool], # webpage_tool does not work properly - cookies etc
|
54 |
llm=llm,
|
55 |
+
verbose=True,
|
56 |
+
system_prompt = (
|
57 |
+
"You are a helpful assistant that can search the web and wikipedia for information.\n"
|
58 |
+
"Only output the shortest possible answer to the question. "
|
59 |
+
"Avoid additional information or explanations."
|
60 |
+
)
|
61 |
)
|
62 |
|
63 |
# self.ctx = Context(self.agent)
|
64 |
|
65 |
async def __call__(self, question: str) -> str:
|
66 |
+
response = await self.agent.run(user_msg=question) # ctx=self.ctx)
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
if self.langfuse:
|
69 |
self.instrumentor.flush()
|
70 |
+
|
71 |
+
return response.response.content.strip()
|
requirements.txt
CHANGED
@@ -4,7 +4,6 @@ llama-index
|
|
4 |
llama-index-llms-huggingface-api
|
5 |
llama_index-tools-duckduckgo
|
6 |
llama_index-tools-wikipedia
|
7 |
-
llama-index-indices-managed-bge-m3
|
8 |
llama-index-embeddings-huggingface
|
9 |
llama-index-readers-web
|
10 |
langfuse
|
|
|
4 |
llama-index-llms-huggingface-api
|
5 |
llama_index-tools-duckduckgo
|
6 |
llama_index-tools-wikipedia
|
|
|
7 |
llama-index-embeddings-huggingface
|
8 |
llama-index-readers-web
|
9 |
langfuse
|