Spaces:
Sleeping
Sleeping
Function agent
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,7 +24,7 @@ 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 |
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].
|
|
|
|
| 8 |
from llama_index.core import SimpleDirectoryReader
|
| 9 |
|
| 10 |
from llama_index.llms.groq import Groq
|
| 11 |
+
from llama_index.core.agent.workflow import FunctionAgent
|
| 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 = FunctionAgent(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].
|