From af9a30f9bcd880215c8029859ab733c09c350b77 Mon Sep 17 00:00:00 2001 From: gabrii Date: Mon, 15 Sep 2025 10:49:29 +0200 Subject: [PATCH] Allow disabling reasoning summaries --- README.md | 28 ++++++++++++++-------------- app/azure/request_adapter.py | 6 +++++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 19d861a..1abd514 100644 --- a/README.md +++ b/README.md @@ -37,27 +37,27 @@ If you prefer to deploy the service (for example, to allow multiple members of y ### 1. Service configuration -Make a copy of the file `.env.example` as `.env` and update the following flags: +Make a copy of the file `.env.example` as `.env` and update the following flags as needed: -| Flag | Description | Default | -| ------------------ | ---------------------------------------------------------------------------------------------------- | ----------- | -| `AZURE_BASE_URL` | Your Azure OpenAI endpoint base URL (no trailing slash), e.g. `https://.openai.azure.com`. | required | -| `AZURE_API_KEY` | Azure OpenAI API key. | required | -| `AZURE_DEPLOYMENT` | Name of the Azure model deployment to use. | `gpt-5` | -| `SERVICE_API_KEY` | Arbitrary API key to protect your service. Set it to a random string. | `change-me` | +| Flag | Description | Default | +| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------- | +| `AZURE_BASE_URL` | Your Azure OpenAI endpoint base URL (no trailing slash), e.g. `https://.openai.azure.com`. | required | +| `AZURE_API_KEY` | Azure OpenAI API key. | required | +| `AZURE_DEPLOYMENT` | Name of the Azure model deployment to use. | `gpt-5` | +| `SERVICE_API_KEY` | Arbitrary API key to protect your service. Set it to a random string. | `change-me` | +| `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` | Alternatively, you can pass them through the environment where you run the application.
Optional Configuration -| Flag | Description | Default | -| --------------------- | ---------------------------------------------------------------------- | -------------------- | -| `AZURE_API_VERSION` | Azure OpenAI Responses API version to call. | `2025-04-01-preview` | -| `AZURE_SUMMARY_LEVEL` | Reasoning summary level for responses. | `detailed` | -| `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` | +| 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` |
diff --git a/app/azure/request_adapter.py b/app/azure/request_adapter.py index 1e56272..619c647 100644 --- a/app/azure/request_adapter.py +++ b/app/azure/request_adapter.py @@ -241,9 +241,13 @@ class RequestAdapter: responses_body["reasoning"] = { "effort": reasoning_effort, - "summary": settings["AZURE_SUMMARY_LEVEL"], } + # Concise is not supported by GPT-5, + # but allowing it for now to be able to test it on other models + if settings["AZURE_SUMMARY_LEVEL"] in {"auto", "detailed", "concise"}: + responses_body["reasoning"]["summary"] = settings["AZURE_SUMMARY_LEVEL"] + responses_body["store"] = False responses_body["stream_options"] = {"include_obfuscation": False} responses_body["truncation"] = settings["AZURE_TRUNCATION"]