akashraut commited on
Commit
477e144
·
verified ·
1 Parent(s): 04a18c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -79,18 +79,16 @@ async def get_agent_executor():
79
 
80
  client = MCPClient(command=sys.executable, args=["server.py"])
81
  tools_raw = await client.get_tools()
 
 
82
  tools = [convert_to_openai_tool(t) for t in tools_raw]
83
-
84
  model = ChatGroq(model="openai/gpt-oss-20b")
85
-
86
- from langchain.agents import AgentExecutor # ⭐ version-safe approach
87
- _agent_executor = AgentExecutor.from_agent_and_tools(
88
- agent=create_react_agent(model=model, tools=tools),
89
- tools=tools,
90
- verbose=True
91
- )
92
- return _agent_executor
93
 
 
 
 
 
94
 
95
 
96
 
 
79
 
80
  client = MCPClient(command=sys.executable, args=["server.py"])
81
  tools_raw = await client.get_tools()
82
+
83
+ # Convert to OpenAI-compatible structured tools (CRITICAL FIX)
84
  tools = [convert_to_openai_tool(t) for t in tools_raw]
85
+
86
  model = ChatGroq(model="openai/gpt-oss-20b")
 
 
 
 
 
 
 
 
87
 
88
+ # Stick to create_react_agent (compatible with your LangChain version)
89
+ _agent_executor = create_react_agent(model, tools)
90
+
91
+ return _agent_executor
92
 
93
 
94