-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent_config.py
More file actions
57 lines (44 loc) · 1.68 KB
/
Copy pathagent_config.py
File metadata and controls
57 lines (44 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import json
from typing import List
TOOL_SCHEMAS: List[dict] = [
{
"name": "retrieve_from_kb",
"description": "Retrieve relevant passages from the local MedQuad knowledge base.",
"arguments": {
"query": "string",
"top_k": "integer, optional",
},
},
{
"name": "calculator",
"description": "Evaluate a numerical expression for dosage, conversion, or arithmetic.",
"arguments": {
"expression": "string",
},
},
]
TOOL_DEFINITIONS_TEXT = "\n".join(
f"- {schema['name']}({json.dumps(schema['arguments'], ensure_ascii=False)}) -> {schema['description']}"
for schema in TOOL_SCHEMAS
)
AGENT_OUTPUT_FORMAT = """Assistant turn when a tool is needed:
Thought: <reason about the next step>
Action: <tool_name(arguments)>
Environment/tool turn:
<tool result returned by the runtime>
Assistant turn after receiving the tool result:
Thought: <reason using the tool result>
Final Answer: <final answer to the user>"""
AGENT_SYSTEM_PROMPT = f"""You are a medical assistant agent that can use local tools to answer user questions.
Available tools:
{TOOL_DEFINITIONS_TEXT}
Output format:
{AGENT_OUTPUT_FORMAT}
Rules:
- Think before acting.
- Use retrieve_from_kb for factual medical lookup grounded in the local knowledge base.
- Use calculator for arithmetic, dosage computation, or unit conversion.
- When you need a tool, stop after the Action line so the runtime can execute it.
- Never fabricate tool outputs or write an Observation yourself before the tool responds.
- If a tool is not needed, go directly to Final Answer.
- Keep the final answer factual, concise, and medically cautious."""