Spaces:
Sleeping
Sleeping
Update agents/knowledge_base_agent.py
Browse files- agents/knowledge_base_agent.py +34 -36
agents/knowledge_base_agent.py
CHANGED
|
@@ -1,36 +1,34 @@
|
|
| 1 |
-
from autogen import AssistantAgent
|
| 2 |
-
from tools.knowledge_base_tool import search_similar_solution
|
| 3 |
-
from utility.llm_config import llm_config
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
def get_knowledge_base_agent():
|
| 7 |
-
|
| 8 |
-
knowledge_agent = AssistantAgent(
|
| 9 |
-
name="KnowledgeBaseAgent",
|
| 10 |
-
system_message=(
|
| 11 |
-
"You are an IT support assistant that retrieves solutions to user issues. "
|
| 12 |
-
"Always call the 'search_similar_solution' tool with the query to get a matching solution. "
|
| 13 |
-
"After calling, summarize the top solution and respond with TERMINATE."
|
| 14 |
-
|
| 15 |
-
),
|
| 16 |
-
llm_config=llm_config, # Required for tool registration
|
| 17 |
-
code_execution_config={"use_docker": False},
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
# Register tool with LLM and executor
|
| 21 |
-
# 1. LLm knows when to call the tool
|
| 22 |
-
knowledge_agent.register_for_llm(
|
| 23 |
-
name="search_similar_solution",
|
| 24 |
-
description="Searches for top IT solutions from a knowledge base using a vector similarity search. Accepts query and top_k."
|
| 25 |
-
)(search_similar_solution)
|
| 26 |
-
|
| 27 |
-
# 2. Executed the tool
|
| 28 |
-
knowledge_agent.register_for_execution(
|
| 29 |
-
name="search_similar_solution"
|
| 30 |
-
)(search_similar_solution)
|
| 31 |
-
|
| 32 |
-
return knowledge_agent
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
| 1 |
+
from autogen import AssistantAgent
|
| 2 |
+
from tools.knowledge_base_tool import search_similar_solution
|
| 3 |
+
from utility.llm_config import llm_config
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def get_knowledge_base_agent():
|
| 7 |
+
|
| 8 |
+
knowledge_agent = AssistantAgent(
|
| 9 |
+
name="KnowledgeBaseAgent",
|
| 10 |
+
system_message=(
|
| 11 |
+
"You are an IT support assistant that retrieves solutions to user issues. "
|
| 12 |
+
"Always call the 'search_similar_solution' tool with the query to get a matching solution. "
|
| 13 |
+
"After calling, summarize the top solution and respond with TERMINATE."
|
| 14 |
+
|
| 15 |
+
),
|
| 16 |
+
llm_config=llm_config, # Required for tool registration
|
| 17 |
+
code_execution_config={"use_docker": False},
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# Register tool with LLM and executor
|
| 21 |
+
# 1. LLm knows when to call the tool
|
| 22 |
+
knowledge_agent.register_for_llm(
|
| 23 |
+
name="search_similar_solution",
|
| 24 |
+
description="Searches for top IT solutions from a knowledge base using a vector similarity search. Accepts query and top_k."
|
| 25 |
+
)(search_similar_solution)
|
| 26 |
+
|
| 27 |
+
# 2. Executed the tool
|
| 28 |
+
knowledge_agent.register_for_execution(
|
| 29 |
+
name="search_similar_solution"
|
| 30 |
+
)(search_similar_solution)
|
| 31 |
+
|
| 32 |
+
return knowledge_agent
|
| 33 |
+
|
| 34 |
+
|
|
|
|
|
|