waveterm/pkg/aiusechat
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
..
aiutil Add Google Gemini backend for AI chat (#2602) 2025-12-05 12:43:42 -08:00
anthropic more config updates (secrets, waveai, ai:provider) (#2631) 2025-12-05 10:10:43 -08:00
chatstore Implement AI "stop" -- in the client, open ai responses/chat, and gemini backends (#2704) 2025-12-19 16:59:31 -08:00
gemini Implement AI "stop" -- in the client, open ai responses/chat, and gemini backends (#2704) 2025-12-19 16:59:31 -08:00
google Add Google AI file summarization package (#2455) 2025-10-17 17:24:06 -07:00
openai Add configurable verbosity for OpenAI Responses API (#2776) 2026-02-04 18:31:57 -08:00
openaichat Implement AI "stop" -- in the client, open ai responses/chat, and gemini backends (#2704) 2025-12-19 16:59:31 -08:00
uctypes Add configurable verbosity for OpenAI Responses API (#2776) 2026-02-04 18:31:57 -08:00
toolapproval.go fix tool approval lifecycle to match SSE connection, not keep-alives (#2693) 2025-12-18 16:43:59 -08:00
tools.go Add Google Gemini backend for AI chat (#2602) 2025-12-05 12:43:42 -08:00
tools_builder.go more builder updates (#2553) 2025-11-13 22:47:46 -08:00
tools_readdir.go implement openai chat completions api -- enables local model support (#2600) 2025-11-26 11:43:19 -08:00
tools_readdir_test.go better tool input descriptions (#2507) 2025-11-02 12:33:59 -08:00
tools_readfile.go implement openai chat completions api -- enables local model support (#2600) 2025-11-26 11:43:19 -08:00
tools_screenshot.go implement openai chat completions api -- enables local model support (#2600) 2025-11-26 11:43:19 -08:00
tools_term.go better tool input descriptions (#2507) 2025-11-02 12:33:59 -08:00
tools_tsunami.go fix tsunami scaffold in build (#2564) 2025-11-14 16:35:37 -08:00
tools_web.go better tool input descriptions (#2507) 2025-11-02 12:33:59 -08:00
tools_writefile.go implement openai chat completions api -- enables local model support (#2600) 2025-11-26 11:43:19 -08:00
usechat-backend.go Implement AI "stop" -- in the client, open ai responses/chat, and gemini backends (#2704) 2025-12-19 16:59:31 -08:00
usechat-mode.go updates to allow wave ai panel to function without telemetry with BYOK/local models (#2685) 2025-12-16 09:06:56 -08:00
usechat-prompts.go minor v0.13 fixes (#2649) 2025-12-08 21:58:54 -08:00
usechat-utils.go Create Interface for Backend AI Providers (#2572) 2025-11-19 11:38:56 -08:00
usechat.go Add configurable verbosity for OpenAI Responses API (#2776) 2026-02-04 18:31:57 -08:00