feat(openai): add getModelSetup() and typed provider options for OpenAI reasoning settings

This commit is contained in:
2026-05-06 19:09:58 +00:00
parent 8ad0b90f95
commit 5c871242b0
10 changed files with 952 additions and 1178 deletions
+7 -4
View File
@@ -6,6 +6,7 @@ The package is a **provider registry** built on the Vercel AI SDK (`ai` v6). The
### Core Entry (`ts/`)
- `getModel(options)` → returns `LanguageModelV3` for any supported provider
- `getModelSetup(options)` → returns `{ model, providerOptions }` for request-time AI SDK provider options
- Providers: anthropic, openai, google, groq, mistral, xai, perplexity, ollama
- Anthropic prompt caching via `wrapLanguageModel` middleware (enabled by default)
- Custom Ollama provider implementing `LanguageModelV3` directly (for think, num_ctx support)
@@ -19,11 +20,11 @@ The package is a **provider registry** built on the Vercel AI SDK (`ai` v6). The
## Dependencies
- `ai` ^6.0.116 — Vercel AI SDK core
- `ai` ^6.0.175 — Vercel AI SDK core
- `@ai-sdk/*` — Provider packages (anthropic, openai, google, groq, mistral, xai, perplexity)
- `@ai-sdk/provider` ^3.0.8 — LanguageModelV3 types
- `@anthropic-ai/sdk` ^0.78.0 — Direct SDK for research (web search tool)
- `openai` ^6.25.0 — Direct SDK for audio TTS and image generation/editing
- `@ai-sdk/provider` ^3.0.10 — LanguageModelV3 types
- `@anthropic-ai/sdk` ^0.95.0 — Direct SDK for research (web search tool)
- `openai` ^6.36.0 — Direct SDK for audio TTS and image generation/editing
- `@push.rocks/smartpdf` ^4.1.3 — PDF to PNG conversion for document analysis
## Build
@@ -40,6 +41,8 @@ The package is a **provider registry** built on the Vercel AI SDK (`ai` v6). The
- Ollama `think` param goes at request body top level, not inside `options`
- Qwen models get default temperature 0.55 in the custom Ollama provider
- `qenv.getEnvVarOnDemand()` returns a Promise — must be awaited in tests
- OpenAI reasoning options belong in AI SDK `providerOptions`, not model construction options
- SmartAI accepts OpenAI model IDs as plain strings, including `gpt-5.5`
## Testing