Add gpt-5.1 support by suryabdev · Pull Request #1868 · huggingface/smolagents (original) (raw)

gpt-5.1 does not support the stop parameter. This PR adds it to the exclusion regex in supports_stop_parameter

Before change

smolagents.utils.AgentGenerationError: Error in generating model output:
Error code: 400 - {'error': {'message': "Unsupported parameter: 'stop' is not supported with this model.", 'type': 'invalid_request_error', 'param': 'stop', 'code': 'unsupported_parameter'}}

After change

╭──────────────────────────────────────────────────────────────────────── New run ─────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                          │
│ Could you give me the 118th number in the Fibonacci sequence?                                                                                            │
│                                                                                                                                                          │
╰─ OpenAIModel - gpt-5.1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Step 1 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ─ Executing parsed code: ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  def fib(n):
      a, b = 0, 1
      for _ in range(n):
          a, b = b, a + b
      return a

  result_118 = fib(118)
  final_answer(result_118)
 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────