Spaces:
Sleeping
Sleeping
Prompt changes
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import asyncio
|
|
| 8 |
from llama_index.core import SimpleDirectoryReader
|
| 9 |
|
| 10 |
from llama_index.llms.groq import Groq
|
| 11 |
-
from llama_index.core.agent.workflow import
|
| 12 |
|
| 13 |
from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
|
| 14 |
from llama_index.core.tools import FunctionTool
|
|
@@ -24,13 +24,15 @@ class BasicAgent:
|
|
| 24 |
tool_spec = DuckDuckGoSearchToolSpec()
|
| 25 |
search_tool = FunctionTool.from_defaults(tool_spec.duckduckgo_full_search)
|
| 26 |
llm = Groq(model="deepseek-r1-distill-llama-70b", api_key=api_key)
|
| 27 |
-
self.agent =
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
print("BasicAgent initialized.")
|
| 35 |
async def __call__(self, question: str) -> str:
|
| 36 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 8 |
from llama_index.core import SimpleDirectoryReader
|
| 9 |
|
| 10 |
from llama_index.llms.groq import Groq
|
| 11 |
+
from llama_index.core.agent.workflow import ReActAgent
|
| 12 |
|
| 13 |
from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
|
| 14 |
from llama_index.core.tools import FunctionTool
|
|
|
|
| 24 |
tool_spec = DuckDuckGoSearchToolSpec()
|
| 25 |
search_tool = FunctionTool.from_defaults(tool_spec.duckduckgo_full_search)
|
| 26 |
llm = Groq(model="deepseek-r1-distill-llama-70b", api_key=api_key)
|
| 27 |
+
self.agent = ReActAgent(tools=[search_tool], llm=llm, system_prompt='''
|
| 28 |
+
You are a general AI assistant.
|
| 29 |
+
I will ask you a question. You can use the search tool to help you with an answer.
|
| 30 |
+
Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 31 |
+
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 32 |
+
If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
|
| 33 |
+
If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
|
| 34 |
+
If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.'''
|
| 35 |
+
)
|
| 36 |
print("BasicAgent initialized.")
|
| 37 |
async def __call__(self, question: str) -> str:
|
| 38 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|