123
This commit is contained in:
22
backend/.env.example
Executable file
22
backend/.env.example
Executable file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Author: Yutang LI
|
||||
Institution: SIAT-MIC
|
||||
Contact: yt.li2@siat.ac.cn
|
||||
"""
|
||||
|
||||
# Model Config
|
||||
OPENAI_API_KEY = ""
|
||||
OPENAI_BASE_URL = ""
|
||||
# MODEL = "chatgpt-4o-latest"
|
||||
MODEL = "gpt-4o-2024-11-20"
|
||||
# MODEL = "deepseek-chat"
|
||||
|
||||
# path
|
||||
CODING_DIR = ".coding"
|
||||
|
||||
# MinIO
|
||||
MINIO_ENDPOINT=
|
||||
INTERNAL_MINIO_ENDPOINT=
|
||||
MINIO_ACCESS_KEY=
|
||||
MINIO_SECRET_KEY=
|
||||
MINIO_BUCKET=
|
||||
@@ -19,6 +19,8 @@ SILENT = True # 关闭嵌套智能体的输出
|
||||
STREAM = True # stream on console
|
||||
CACHE = None # None 就是关闭 41是默认值开启
|
||||
|
||||
GRAPH_RAG = "/root/data50T/LYT/matagent/backend/psk-graphrag/settings.yaml"
|
||||
|
||||
WORK_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".coding")
|
||||
if not os.path.exists(WORK_DIR):
|
||||
os.mkdir(WORK_DIR)
|
||||
|
||||
@@ -7,7 +7,8 @@ from autogen_agentchat.messages import AgentEvent, ChatMessage, TextMessage, Too
|
||||
from autogen_agentchat.teams import SelectorGroupChat, RoundRobinGroupChat, Swarm
|
||||
from autogen_agentchat.ui import Console
|
||||
from autogen_ext.models.openai import OpenAIChatCompletionClient
|
||||
from backend.constant import MODEL, OPENAI_API_KEY, OPENAI_BASE_URL
|
||||
from backend.constant import MODEL, OPENAI_API_KEY, OPENAI_BASE_URL, GRAPH_RAG
|
||||
from autogen_ext.tools.graphrag import GlobalSearchTool
|
||||
from backend.tools import hybird_retrieval_from_knowledge_base, search_from_oqmd_by_composition
|
||||
from backend.custom import SocietyOfMindAgent
|
||||
|
||||
@@ -47,6 +48,7 @@ def create_scientist_team(user_input_func: Callable[[str, Optional[CancellationT
|
||||
handoffs=["Synthesis_Scientist", "Structure_Scientist", "Property_Scientist", "Application_Scientist"]
|
||||
)
|
||||
|
||||
graph_rag_search = GlobalSearchTool.from_settings(settings_path=GRAPH_RAG)
|
||||
synthesis_agent = AssistantAgent(
|
||||
"Synthesis_Scientist",
|
||||
description="An experienced materials scientist agent who is particularly good at coming up with detailed synthesis schemes, and should be called when the task around a material synthesis topic.",
|
||||
@@ -86,7 +88,7 @@ def create_scientist_team(user_input_func: Callable[[str, Optional[CancellationT
|
||||
Always handoff back to Scientist_Admin when synthesis scheme is complete.
|
||||
Let's think step by step and answer with {lang}:
|
||||
""",
|
||||
tools=[hybird_retrieval_from_knowledge_base],
|
||||
tools=[hybird_retrieval_from_knowledge_base, search_from_oqmd_by_composition, graph_rag_search],
|
||||
reflect_on_tool_use=True,
|
||||
handoffs=["Scientist_Admin"]
|
||||
)
|
||||
@@ -106,7 +108,7 @@ def create_scientist_team(user_input_func: Callable[[str, Optional[CancellationT
|
||||
Always handoff back to Scientist_Admin when response is complete.
|
||||
Answer with {lang}:
|
||||
""",
|
||||
tools=[hybird_retrieval_from_knowledge_base],
|
||||
tools=[hybird_retrieval_from_knowledge_base, search_from_oqmd_by_composition, graph_rag_search],
|
||||
reflect_on_tool_use=True,
|
||||
handoffs=["Scientist_Admin"]
|
||||
)
|
||||
@@ -127,7 +129,7 @@ def create_scientist_team(user_input_func: Callable[[str, Optional[CancellationT
|
||||
Always handoff back to Scientist_Admin when response is complete.
|
||||
Answer with {lang}:
|
||||
""",
|
||||
tools=[hybird_retrieval_from_knowledge_base],
|
||||
tools=[hybird_retrieval_from_knowledge_base, search_from_oqmd_by_composition, graph_rag_search],
|
||||
reflect_on_tool_use=True,
|
||||
handoffs=["Scientist_Admin"]
|
||||
)
|
||||
@@ -148,7 +150,7 @@ def create_scientist_team(user_input_func: Callable[[str, Optional[CancellationT
|
||||
Always handoff back to Scientist_Admin when response is complete.
|
||||
Answer with {lang}:
|
||||
""",
|
||||
tools=[hybird_retrieval_from_knowledge_base],
|
||||
tools=[hybird_retrieval_from_knowledge_base, search_from_oqmd_by_composition, graph_rag_search],
|
||||
reflect_on_tool_use=True,
|
||||
handoffs=["Scientist_Admin"]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user