patdev commited on
Commit
716d237
·
verified ·
1 Parent(s): 6754593

pont: effort -> thinking_token_budget (memes seuils que le patch natif)

Browse files
Files changed (1) hide show
  1. anthropic_proxy.py +8 -0
anthropic_proxy.py CHANGED
@@ -329,6 +329,14 @@ def to_openai(body: dict) -> dict:
329
  out["thinking_token_budget"] = max(1, int(th["budget_tokens"]))
330
  except (TypeError, ValueError):
331
  pass
 
 
 
 
 
 
 
 
332
 
333
  if body.get("tools"):
334
  out["tools"] = [{
 
329
  out["thinking_token_budget"] = max(1, int(th["budget_tokens"]))
330
  except (TypeError, ValueError):
331
  pass
332
+ # Niveau d'effort (output_config.effort) -> plafond de jetons de raisonnement,
333
+ # memes seuils que le patch natif (vllm_anthropic_effort_patch.py). Le budget
334
+ # explicite ci-dessus gagne ; `disabled` aussi.
335
+ _eff = (body.get("output_config") or {}).get("effort") if isinstance(body.get("output_config"), dict) else None
336
+ _BUDGET = {"low": 1024, "medium": 4096, "high": 16384, "xhigh": 32768, "max": None}
337
+ if _eff in _BUDGET and "thinking_token_budget" not in out and "chat_template_kwargs" not in out:
338
+ if _BUDGET[_eff] is not None:
339
+ out["thinking_token_budget"] = _BUDGET[_eff]
340
 
341
  if body.get("tools"):
342
  out["tools"] = [{