waveterm/schema
Geoff Hudik 78ab9e0b94
Add configurable verbosity for OpenAI Responses API (#2776)
# Add configurable verbosity for OpenAI Responses API

Fixes #2775

## Problem

Models like `gpt-5.2-codex` and other newer OpenAI models only support
`medium` reasoning and verbosity levels, but the codebase was using
`low` by default. This caused 400 Bad Request errors:

```
Failed to stream openai-responses chat: openai 400 Bad Request:
Unsupported value: 'low' is not supported with the 'gpt-5.2-codex' model.
Supported values are: 'medium'.
```


## Solution

This PR implements a scalable, user-configurable approach instead of
hardcoding model-specific constraints:

1. **Changed default verbosity** from `"low"` to `"medium"` - more
widely supported across OpenAI models
2. **Added `ai:verbosity` config option** - allows users to configure
verbosity per model in `waveai.json`
3. **Changed rate limit fallback** from `low` to `medium` thinking level
for better compatibility
4. **Removed hardcoded model checks** - solution is scalable for future
models

## Changes

### Backend Changes
- `pkg/aiusechat/openai/openai-convertmessage.go` - Use configurable
verbosity with safe defaults
- `pkg/aiusechat/uctypes/uctypes.go` - Add `Verbosity` field to
`AIOptsType`
- `pkg/aiusechat/usechat.go` - Pass verbosity from config to options
- `pkg/wconfig/settingsconfig.go` - Add `Verbosity` to
`AIModeConfigType`

### Schema Changes
- `schema/waveai.json` - Add `ai:verbosity` with enum values
(low/medium/high)
- `frontend/types/gotypes.d.ts` - Auto-generated TypeScript types

### Configuration Example

Users can now configure both thinking level and verbosity per model:

```json
{
  "openai-gpt52-codex": {
    "display:name": "GPT-5.2 Codex",
    "ai:provider": "openai",
    "ai:model": "gpt-5.2-codex",
    "ai:thinkinglevel": "medium",
    "ai:verbosity": "medium"
  }
}
```
2026-02-04 18:31:57 -08:00
..
aipresets.json implement ai:proxyurl for proxy url access to different models (#2263) 2025-08-19 10:19:27 -07:00
bgpresets.json more config updates (secrets, waveai, ai:provider) (#2631) 2025-12-05 10:10:43 -08:00
connections.json Session Durability Checkpoint (#2821) 2026-02-03 11:49:52 -08:00
settings.json Session Durability Checkpoint (#2821) 2026-02-03 11:49:52 -08:00
waveai.json Add configurable verbosity for OpenAI Responses API (#2776) 2026-02-04 18:31:57 -08:00
widgets.json feat: add schema for widgets.json (#1929) 2025-02-07 15:39:57 -08:00