diff --git a/README.md b/README.md index 48c2871..46bdec7 100644 --- a/README.md +++ b/README.md @@ -24,20 +24,19 @@ This project originates from Cursor's lack of support for Azure models that are ## Supported Models -The entire gpt-5 series is supported, although `gpt-5-pro` and `gpt-5-codex` have some limitations on the reasoning effort / verbosity values they accept: +The entire gpt-5 series is supported, although some models have some limitations on the reasoning effort / verbosity / truncation values they accept: -| Model Name | Reasoning Effort | Verbosity | -| ------------------ | ----------------------------------------------- | ----------------------------------- | -| gpt-5 | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | -| gpt-5.1 | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | -| gpt-5-mini | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | -| gpt-5-nano | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | -| gpt-5-pro | ⚠️ _~~`minimal`~~ ~~`low`~~ ~~`medium`~~_ `high` | ✅ `low` `medium` `high` | -| gpt-5-codex | ⚠️ _~~`minimal`~~_ `low` `medium` `high` | ⚠️ _~~`low`~~_ `medium` _~~`high`~~_ | -| gpt-5.1-codex | 🛑 Error on Azure's end | | -| gpt-5.1-codex-mini | 🛑 Error on Azure's end | | +| Model Name | Reasoning Effort | Verbosity | Truncation | +| ------------------ | ----------------------------------------------- | ----------------------------------- | ------------------------- | +| gpt-5 | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | ✅ `auto` `disabled` | +| gpt-5.1 | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | ✅ `auto` `disabled` | +| gpt-5-mini | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | ✅ `auto` `disabled` | +| gpt-5-nano | ✅ `minimal` `low` `medium` `high` | ✅ `low` `medium` `high` | ✅ `auto` `disabled` | +| gpt-5-pro | ⚠️ _~~`minimal`~~ ~~`low`~~ ~~`medium`~~_ `high` | ✅ `low` `medium` `high` | ✅ `auto` `disabled` | +| gpt-5-codex | ⚠️ _~~`minimal`~~_ `low` `medium` `high` | ⚠️ _~~`low`~~_ `medium` _~~`high`~~_ | ✅ `auto` `disabled` | +| gpt-5.1-codex | ⚠️ _~~`minimal`~~_ `low` `medium` `high` | ⚠️ _~~`low`~~_ `medium` _~~`high`~~_ | ⚠️ _~~`auto`~~_ `disabled` | +| gpt-5.1-codex-mini | ⚠️ _~~`minimal`~~_ `low` `medium` `high` | ⚠️ _~~`low`~~_ `medium` _~~`high`~~_ | ⚠️ _~~`auto`~~_ `disabled` | -The `gpt-5.1` series is partially supported, although `gpt-5.1-codex` and `gpt-5.1-codex-mini` are just broken in Azure. ## Feature highlights @@ -65,6 +64,7 @@ Make a copy of the file `.env.example` as `.env` and update the following flags | `AZURE_DEPLOYMENT` | Name of the Azure model deployment to use. | `gpt-5` | | `AZURE_VERBOSITY_LEVEL` | Hint the model to be more or less expansive in its replies. Use either `high` / `medium` / `low` | `medium` | | `AZURE_SUMMARY_LEVEL` | Set to `none` to disable summaries. You might have to disable them if your organization hasn't been approved for this feature. | `detailed` | +| `AZURE_TRUNCATION` | Truncation strategy for long inputs. Either `auto` or `disabled` | `disabled` | Alternatively, you can pass them through the environment where you run the application. @@ -74,7 +74,6 @@ Alternatively, you can pass them through the environment where you run the appli | Flag | Description | Default | | ------------------- | ---------------------------------------------------------------------- | -------------------- | | `AZURE_API_VERSION` | Azure OpenAI Responses API version to call. | `2025-04-01-preview` | -| `AZURE_TRUNCATION` | Truncation strategy for long inputs. | `auto` | | `FLASK_ENV` | Flask environment. Use `development` for dev or `production` for prod. | `production` | | `RECORD_TRAFFIC` | Toggle writing request/response traffic to `recordings/` | `off` | | `LOG_CONTEXT` | Enable rich pretty-printing of request context to console. | `on` | diff --git a/app/azure/request_adapter.py b/app/azure/request_adapter.py index ac2f849..7e3f434 100644 --- a/app/azure/request_adapter.py +++ b/app/azure/request_adapter.py @@ -183,7 +183,9 @@ class RequestAdapter: responses_body["store"] = False responses_body["stream_options"] = {"include_obfuscation": False} - responses_body["truncation"] = settings["AZURE_TRUNCATION"] + + if settings["AZURE_TRUNCATION"] == "auto": + responses_body["truncation"] = settings["AZURE_TRUNCATION"] request_kwargs: Dict[str, Any] = { "method": "POST", diff --git a/app/settings.py b/app/settings.py index 965e4cf..674b21c 100644 --- a/app/settings.py +++ b/app/settings.py @@ -26,7 +26,7 @@ AZURE_DEPLOYMENT = env.str("AZURE_DEPLOYMENT") or "gpt-5" AZURE_API_VERSION = env.str("AZURE_API_VERSION") or "2025-04-01-preview" AZURE_SUMMARY_LEVEL = env.str("AZURE_SUMMARY_LEVEL") or "detailed" AZURE_VERBOSITY_LEVEL = env.str("AZURE_VERBOSITY_LEVEL") or "medium" -AZURE_TRUNCATION = env.str("AZURE_TRUNCATION") or "auto" +AZURE_TRUNCATION = env.str("AZURE_TRUNCATION") or "disabled" AZURE_RESPONSES_API_URL = ( f"{AZURE_BASE_URL}/openai/responses?api-version={AZURE_API_VERSION}" diff --git a/tests/recordings/context_parallel_tool_call/upstream_request.json b/tests/recordings/context_parallel_tool_call/upstream_request.json index a4391c8..fc72f1e 100644 --- a/tests/recordings/context_parallel_tool_call/upstream_request.json +++ b/tests/recordings/context_parallel_tool_call/upstream_request.json @@ -346,6 +346,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/context_single_tool_calls/upstream_request.json b/tests/recordings/context_single_tool_calls/upstream_request.json index 5826cfb..3c2407a 100644 --- a/tests/recordings/context_single_tool_calls/upstream_request.json +++ b/tests/recordings/context_single_tool_calls/upstream_request.json @@ -649,6 +649,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/context_tool_call_invalid_json/upstream_request.json b/tests/recordings/context_tool_call_invalid_json/upstream_request.json index 514d6f3..9fd1874 100644 --- a/tests/recordings/context_tool_call_invalid_json/upstream_request.json +++ b/tests/recordings/context_tool_call_invalid_json/upstream_request.json @@ -649,6 +649,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/default_recording/upstream_request.json b/tests/recordings/default_recording/upstream_request.json index c6db862..d246e49 100644 --- a/tests/recordings/default_recording/upstream_request.json +++ b/tests/recordings/default_recording/upstream_request.json @@ -395,6 +395,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/empty_tools/upstream_request.json b/tests/recordings/empty_tools/upstream_request.json index 2dea819..741ff39 100644 --- a/tests/recordings/empty_tools/upstream_request.json +++ b/tests/recordings/empty_tools/upstream_request.json @@ -32,6 +32,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/multiple_ping_pongs/upstream_request.json b/tests/recordings/multiple_ping_pongs/upstream_request.json index 339b7bd..67ea93d 100644 --- a/tests/recordings/multiple_ping_pongs/upstream_request.json +++ b/tests/recordings/multiple_ping_pongs/upstream_request.json @@ -431,6 +431,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/one_ping_pong/upstream_request.json b/tests/recordings/one_ping_pong/upstream_request.json index c6db862..d246e49 100644 --- a/tests/recordings/one_ping_pong/upstream_request.json +++ b/tests/recordings/one_ping_pong/upstream_request.json @@ -395,6 +395,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/reply_parallel_tool_call/upstream_request.json b/tests/recordings/reply_parallel_tool_call/upstream_request.json index 2dd6b71..8aa3141 100644 --- a/tests/recordings/reply_parallel_tool_call/upstream_request.json +++ b/tests/recordings/reply_parallel_tool_call/upstream_request.json @@ -313,6 +313,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/reply_single_tool_call/upstream_request.json b/tests/recordings/reply_single_tool_call/upstream_request.json index 5c5b628..42e0823 100644 --- a/tests/recordings/reply_single_tool_call/upstream_request.json +++ b/tests/recordings/reply_single_tool_call/upstream_request.json @@ -313,6 +313,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/sse_without_closing_new_lines/upstream_request.json b/tests/recordings/sse_without_closing_new_lines/upstream_request.json index c6db862..d246e49 100644 --- a/tests/recordings/sse_without_closing_new_lines/upstream_request.json +++ b/tests/recordings/sse_without_closing_new_lines/upstream_request.json @@ -395,6 +395,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/recordings/verbosity_level/upstream_request.json b/tests/recordings/verbosity_level/upstream_request.json index 0f18cde..c26a05a 100644 --- a/tests/recordings/verbosity_level/upstream_request.json +++ b/tests/recordings/verbosity_level/upstream_request.json @@ -398,6 +398,5 @@ "store": false, "stream_options": { "include_obfuscation": false - }, - "truncation": "auto" + } } \ No newline at end of file diff --git a/tests/settings.py b/tests/settings.py index b06daf5..6cb2a4b 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -11,7 +11,7 @@ AZURE_API_KEY = "test-api-key" AZURE_DEPLOYMENT = "gpt-5" AZURE_SUMMARY_LEVEL = "detailed" AZURE_VERBOSITY_LEVEL = "medium" -AZURE_TRUNCATION = "auto" +AZURE_TRUNCATION = "disabled" RECORD_TRAFFIC = False LOG_CONTEXT = True diff --git a/tests/test_azure_errors.py b/tests/test_azure_errors.py index 6366fbf..b16f285 100644 --- a/tests/test_azure_errors.py +++ b/tests/test_azure_errors.py @@ -35,8 +35,7 @@ Check "azure_response" for the error details: \t "store": false, \t "stream_options": { \t "include_obfuscation": false -\t }, -\t "truncation": "auto" +\t } \t } \t} If the issue persists, report it to: @@ -73,8 +72,7 @@ Check "azure_response" for the error details: \t "store": false, \t "stream_options": { \t "include_obfuscation": false -\t }, -\t "truncation": "auto" +\t } \t } \t} If the issue persists, report it to: @@ -109,8 +107,7 @@ Check "azure_response" for the error details: \t "store": false, \t "stream_options": { \t "include_obfuscation": false -\t }, -\t "truncation": "auto" +\t } \t } \t} If the issue persists, report it to: @@ -122,7 +119,8 @@ class TestCompletionError(ReplyBase): """Test a successful HTTP request but with a streamed response.error event.""" def modify_settings(self, app) -> None: - """Set gpt-5.1-codex model, which is currently causing this issue.""" + """Set gpt-5.1-codex model and auto truncation, which is currently causing this issue.""" app.config["AZURE_DEPLOYMENT"] = "gpt-5.1-codex" + app.config["AZURE_TRUNCATION"] = "auto" recording = "response_error"