Spaces:
Sleeping
Sleeping
default
Browse files- app_with_mcp.py +30 -6
app_with_mcp.py
CHANGED
@@ -177,20 +177,44 @@ async def get_available_tools() -> List[BrainTool]:
|
|
177 |
# Always add final answer tool
|
178 |
final_answer_tool = create_final_answer_tool()
|
179 |
|
180 |
-
return mcp_tools
|
181 |
|
182 |
# Get preset configurations and default configuration
|
183 |
preset_configs = get_preset_configs()
|
184 |
default_config = get_default_config()
|
185 |
available_routes = get_available_routes()
|
186 |
|
187 |
-
async def minion_respond_async(query: str,
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
"""Respond to query using specified configuration with optional MCP tools"""
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
# Always use the current UI values, regardless of preset selection
|
195 |
# Preset is only used for initializing UI fields, not for actual execution
|
196 |
llm_config_dict = create_custom_llm_config(
|
|
|
177 |
# Always add final answer tool
|
178 |
final_answer_tool = create_final_answer_tool()
|
179 |
|
180 |
+
return mcp_tools #+ [final_answer_tool]
|
181 |
|
182 |
# Get preset configurations and default configuration
|
183 |
preset_configs = get_preset_configs()
|
184 |
default_config = get_default_config()
|
185 |
available_routes = get_available_routes()
|
186 |
|
187 |
+
async def minion_respond_async(query: str,
|
188 |
+
preset_model: str = "gpt-4o",
|
189 |
+
api_type: str = None,
|
190 |
+
api_key: str = None,
|
191 |
+
base_url: str = None,
|
192 |
+
api_version: str = None,
|
193 |
+
model: str = None,
|
194 |
+
temperature: float = None,
|
195 |
+
max_tokens: int = None,
|
196 |
+
route: str = "",
|
197 |
+
query_type: str = "calculate",
|
198 |
+
check_enabled: bool = False,
|
199 |
+
use_tools: bool = True):
|
200 |
"""Respond to query using specified configuration with optional MCP tools"""
|
201 |
|
202 |
+
# Get default config for None values
|
203 |
+
if api_type is None:
|
204 |
+
api_type = default_config.api_type
|
205 |
+
if api_key is None:
|
206 |
+
api_key = default_config.api_key
|
207 |
+
if base_url is None:
|
208 |
+
base_url = default_config.base_url
|
209 |
+
if api_version is None:
|
210 |
+
api_version = default_config.api_version
|
211 |
+
if model is None:
|
212 |
+
model = default_config.model
|
213 |
+
if temperature is None:
|
214 |
+
temperature = default_config.temperature
|
215 |
+
if max_tokens is None:
|
216 |
+
max_tokens = default_config.max_tokens
|
217 |
+
|
218 |
# Always use the current UI values, regardless of preset selection
|
219 |
# Preset is only used for initializing UI fields, not for actual execution
|
220 |
llm_config_dict = create_custom_llm_config(
|