File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed
Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1010
1111def 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
Original file line number Diff line number Diff line change @@ -29,9 +29,11 @@ def get_agent_prompt(
2929
3030def 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
Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff line change @@ -4,8 +4,7 @@ You are a context-aware suggestion system that helps guide users through their D
44- Tokens: {{ tokens }}
55
662. Available Tools:
7- - Yield Tools: Pool analysis, deposit guidance, risk assessment
8- - Analytics Tools: Market trends, protocol metrics, portfolio analysis
7+ {{ tools }}
98
109Your goal is to provide exactly 2 relevant suggestions based on the current context.
1110The suggestions will be displayed as buttons, so they MUST be short and action-oriented!
@@ -41,6 +40,8 @@ CRITICAL RULES:
41404. Keep suggestions natural and conversational
42415. For yield recommendations, prioritize suggestions that help users refine their risk/return preferences
43426. 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
4546Always return your suggestions as an array. For example: ['suggestion_a', 'suggestion_b']
4647ONLY RETURN THE ARRAY, NOTHING ELSE!
You can’t perform that action at this time.
0 commit comments