Realtime: documented noise_reduction: null is rejected by TypeScript
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- api, backend-api-design
Direzione di ricerca
Inizia da src/resources/realtime/realtime.ts, dove l’issue indica RealtimeAudioConfigInput.noise_reduction e il relativo JSDoc, poi segui lo schema o la proiezione di generazione menzionati nel report. Aggiungi una regressione in fase di compilazione per RealtimeSessionCreateRequest usando noise_reduction: null; il lavoro è completato quando il tipo pubblico della richiesta accetta null e continuano a compilare sia l’omissione sia i valori near_field e far_field.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library.
Describe the bug
The documented way to disable Realtime input noise reduction does not type-check with strict null checking:
audio: { input: { noise_reduction: null } }
This prevents a typed client.realtime.clientSecrets.create() call from expressing the documented off setting without a cast, suppression, or weakening null checking. Omitting the property, selecting near_field, and selecting far_field all compile in otherwise equivalent controls.
The mismatch is present in the published [email protected] artifact and in a fresh build of main at 93f5f1ca7420fe711ed559eca6405044199f5c50. This is a compile-time SDK contract report, not a claim about a new server failure or a runtime regression introduced by the latest documentation change.
To Reproduce
-
In an empty directory, run:
npm init -y npm install [email protected] npm install --save-dev [email protected] @types/[email protected] -
Save the code below as
repro.ctsand this configuration astsconfig.json:{ "compilerOptions": { "target": "ES2022", "module": "Node16", "moduleResolution": "Node16", "strict": true, "noEmit": true, "skipLibCheck": true, "types": [] }, "files": ["repro.cts"] } -
Run
npx tsc --project tsconfig.json. Compilation fails onnoise_reduction: null:error TS2322: Type 'null' is not assignable to type 'NoiseReduction | undefined'.
The same result occurs with TypeScript 6.0.3 and when the file is .mts. skipLibCheck only skips dependency declaration checking; the failing assignment in this consumer remains checked under strict: true. The compatible Node declaration dependency isolates this SDK check from newer Node declarations that older TypeScript cannot parse.
Code snippets
import OpenAI from 'openai';
import type { RealtimeSessionCreateRequest } from 'openai/resources/realtime/realtime';
declare const client: OpenAI;
const session: RealtimeSessionCreateRequest = {
type: 'realtime',
audio: { input: { noise_reduction: null } },
};
client.realtime.clientSecrets.create({ session });
This example is compile-only; it needs no API key and should not be executed as JavaScript.
Expected and actual behavior / root cause
- Expected: the documented
nulloff setting is representable by the public Realtime request type, while omission and valid object configurations remain supported. - Actual: generated
RealtimeAudioConfigInput.noise_reductionisnoise_reduction?: RealtimeAudioConfigInput.NoiseReduction, with no| null. - The JSDoc immediately above that member explicitly describes
nullas the off setting, both in 7.64.0 and after the clarification in #3192. That merged PR changes documentation, not the nullable type, so it does not resolve this compilation failure. The open release PR #3191 likewise contains the documentation changes rather than a nullable-type fix.
Please reconcile the schema/generation projection with the documented contract and add a compile-time regression for the public request. I have not hand-edited generated resources or proposed a runtime validation change.
Validation
| Target | TypeScript | .cts / .mts with null |
Omitted / near-field / far-field controls |
|---|---|---|---|
| Actual npm 7.64.0 | 4.9.5 | TS2322 | Pass |
| Actual npm 7.64.0 | 6.0.3 | TS2322 | Pass |
Main 93f5f1ca build |
4.9.5 | TS2322 | Pass |
Main 93f5f1ca build |
6.0.3 | TS2322 | Pass |
The released tarball was checked against its registry SHA512 integrity. Synthetic fetch checks on Node 22.0.0 and 24.19.0 preserve the explicit JSON null through the public client-secret endpoint; these checks do not establish live server acceptance or account access. No real API calls or sensitive data were used.
OS
Windows x64.
Node version
Node 24.19.0 for compiler/build validation; additional synthetic runtime checks on Node 22.0.0.
Library version
openai 7.64.0; also reproduced on main 93f5f1ca7420fe711ed559eca6405044199f5c50.
- Lingua principale
- TypeScript
- Stelle
- 11.3k
- Fork
- 1.6k
- Merge medio
- 19h 41m
- PR unite (30g)
- 110
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openai/openai-node
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openai/openai-node#3232 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
openai/openai-node#2962 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openai/openai-node
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
Techiebutler/freeframe#687 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement from-app needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
nightly-labs/openbot#23050 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OHDSI/Data2Evidence#3846 ·
I maintainer di solito rispondono entro 3 giorni
-
frontend: EditorDialog: Save & Apply on an empty or comment-only document reports success and applies nothingForse già presa @shubhamrai9122-creator l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kubernetes-sigs/headlamp#9086 ·
I maintainer di solito rispondono entro 1 giorno
-
bug(c-sdk): boxlite_box_exec does not check runtime liveness before dispatching streaming execApertabug rust SDK & CLI & REST API
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
boxlite-ai/boxlite#3292 ·
I maintainer di solito rispondono entro 1 giorno