Nymbo commited on
Commit
b2cd6d1
·
verified ·
1 Parent(s): 8840c3f

Update mcp_client.py

Browse files
Files changed (1) hide show
  1. mcp_client.py +22 -17
mcp_client.py CHANGED
@@ -257,23 +257,28 @@ class UniversalMCPClient:
257
  # Add any remaining kwargs (highest precedence)
258
  params.update(kwargs)
259
 
260
- # Add reasoning effort if specified (GPT OSS feature)
261
- reasoning_effort = kwargs.pop("reasoning_effort", self.generation_params.get("reasoning_effort", AppConfig.DEFAULT_REASONING_EFFORT))
262
- if reasoning_effort:
263
- # For GPT OSS models, we can set reasoning in system prompt
264
- system_message = None
265
- for msg in messages:
266
- if msg.get("role") == "system":
267
- system_message = msg
268
- break
269
-
270
- if system_message:
271
- system_message["content"] += f"\n\nReasoning: {reasoning_effort}"
272
- else:
273
- messages.insert(0, {
274
- "role": "system",
275
- "content": f"You are a helpful AI assistant. Reasoning: {reasoning_effort}"
276
- })
 
 
 
 
 
277
 
278
  try:
279
  logger.info(f"🤖 Calling {model_endpoint} via {self.current_provider}")
 
257
  # Add any remaining kwargs (highest precedence)
258
  params.update(kwargs)
259
 
260
+ # Add reasoning effort only for GPT-OSS models
261
+ if AppConfig.is_gpt_oss_model(self.current_model):
262
+ reasoning_effort = kwargs.pop("reasoning_effort", self.generation_params.get("reasoning_effort", AppConfig.DEFAULT_REASONING_EFFORT))
263
+ if reasoning_effort:
264
+ # For GPT OSS models, we can set reasoning in system prompt
265
+ system_message = None
266
+ for msg in messages:
267
+ if msg.get("role") == "system":
268
+ system_message = msg
269
+ break
270
+
271
+ if system_message:
272
+ system_message["content"] += f"\n\nReasoning: {reasoning_effort}"
273
+ else:
274
+ messages.insert(0, {
275
+ "role": "system",
276
+ "content": f"You are a helpful AI assistant. Reasoning: {reasoning_effort}"
277
+ })
278
+ else:
279
+ # Ensure reasoning_effort is not sent in params for non-GPT-OSS
280
+ if "reasoning_effort" in params:
281
+ params.pop("reasoning_effort", None)
282
 
283
  try:
284
  logger.info(f"🤖 Calling {model_endpoint} via {self.current_provider}")