The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: parse Azure output-cap rejection wording (#78405)
David Metcalfe2641d416c8fe
diff --git a/agent/model_metadata.py b/agent/model_metadata.pyindex 26419717ad7..bfdd4391833 100644--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@ -1284,6 +1284,8 @@ def parse_available_output_tokens_from_error(error_msg: str) -> Optional[int]:r'available\s+tokens[:\s]+(\d+)',# Switchyard: "max_tokens cannot exceed the configured model output limit of 16384".r'output limit (?:of|is)\s*(\d+)',+ # Azure OpenAI: "max_tokens is too large: 65536. This model supports at most 32768 completion tokens."+ r'supports at most\s+(\d+)\s*(?:completion\s+)?tokens',r'=\s*(\d+)\s*$',):match = re.search(pattern, error_lower)@@ -1329,6 +1331,7 @@ _OUTPUT_CAP_SIGNALS = (("in the output", "maximum context length"), ("requested", "output tokens"),("should be",), ("less than or equal",), ("must be",), ("exceeds model", "maximum output tokens"),("output limit",), ("maximum allowed number of output tokens",),+ ("max_tokens is too large", "supports at most"),)_INPUT_OVERFLOW_SIGNALS = ("prompt is too long", "prompt too long", "input is too long", "input token",@@ -1344,6 +1347,7 @@ _PARSEABLE_OUTPUT_CAP_SIGNALS = (("maximum context length", "requested", "output tokens"),("range of max_tokens should be",), ("exceeds model", "maximum output tokens"),("output limit",), ("max_tokens", "maximum allowed number of output tokens"),+ ("max_tokens is too large", "supports at most"),)