Skip to content

Commit 05de4e6

Browse files
Adam BaloghAdam Balogh
authored andcommitted
suggestion tools
1 parent 8add998 commit 05de4e6

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

agent/agent_executors.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@
1010

1111
def create_suggestions_executor() -> CompiledGraph:
1212
openai_model = ChatOpenAI(model="gpt-3.5-turbo", temperature=0.0)
13-
agent_executor = create_react_agent(model=openai_model, tools=[])
13+
14+
# Get all available tools from both toolkits
15+
all_tools = create_agent_toolkit() + create_analytics_agent_toolkit()
16+
17+
agent_executor = create_react_agent(
18+
model=openai_model,
19+
tools=[],
20+
config={"tools": all_tools} # Pass raw tools list
21+
)
1422

1523
return agent_executor
1624

agent/prompts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ def get_agent_prompt(
2929

3030
def get_suggestions_prompt(
3131
tokens: List[WalletTokenHolding],
32+
tools: str,
3233
) -> str:
3334
agent_prompt = suggestions_template.render(
3435
tokens=tokens,
36+
tools=tools,
3537
)
3638

3739
return agent_prompt

server/server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,14 @@ def handle_suggestions_request(
189189
request: AgentChatRequest,
190190
suggestions_agent: CompiledGraph,
191191
) -> List[str]:
192+
# Get tools from agent config and format them
193+
tools = suggestions_agent.config["configurable"]["tools"]
194+
tools_list = "\n".join([f"- {tool.name}: {tool.description}" for tool in tools])
195+
192196
# Build suggestions agent system prompt
193197
suggestions_system_prompt = get_suggestions_prompt(
194198
tokens=request.context.tokens,
199+
tools=tools_list,
195200
)
196201

197202
# Prepare message history (last 10 messages)

templates/suggestions.jinja2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ You are a context-aware suggestion system that helps guide users through their D
44
- Tokens: {{ tokens }}
55

66
2. Available Tools:
7-
- Yield Tools: Pool analysis, deposit guidance, risk assessment
8-
- Analytics Tools: Market trends, protocol metrics, portfolio analysis
7+
{{ tools }}
98

109
Your goal is to provide exactly 2 relevant suggestions based on the current context.
1110
The suggestions will be displayed as buttons, so they MUST be short and action-oriented!
@@ -41,6 +40,8 @@ CRITICAL RULES:
4140
4. Keep suggestions natural and conversational
4241
5. For yield recommendations, prioritize suggestions that help users refine their risk/return preferences
4342
6. If the last message was a yield recommendation, focus on helping users narrow down their choice
43+
7. ONLY suggest actions that are supported by the available tools listed above
44+
8. NEVER suggest actions that would require tools not in the available tools list
4445

4546
Always return your suggestions as an array. For example: ['suggestion_a', 'suggestion_b']
4647
ONLY RETURN THE ARRAY, NOTHING ELSE!

0 commit comments

Comments
 (0)