openai 4.78.1 → 4.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +87 -0
  3. package/beta/realtime/index.d.ts +2 -0
  4. package/beta/realtime/index.d.ts.map +1 -0
  5. package/beta/realtime/index.js +6 -0
  6. package/beta/realtime/index.js.map +1 -0
  7. package/beta/realtime/index.mjs +2 -0
  8. package/beta/realtime/index.mjs.map +1 -0
  9. package/beta/realtime/internal-base.d.ts +47 -0
  10. package/beta/realtime/internal-base.d.ts.map +1 -0
  11. package/beta/realtime/internal-base.js +43 -0
  12. package/beta/realtime/internal-base.js.map +1 -0
  13. package/beta/realtime/internal-base.mjs +37 -0
  14. package/beta/realtime/internal-base.mjs.map +1 -0
  15. package/beta/realtime/websocket.d.ts +22 -0
  16. package/beta/realtime/websocket.d.ts.map +1 -0
  17. package/beta/realtime/websocket.js +91 -0
  18. package/beta/realtime/websocket.js.map +1 -0
  19. package/beta/realtime/websocket.mjs +64 -0
  20. package/beta/realtime/websocket.mjs.map +1 -0
  21. package/beta/realtime/ws.d.ts +19 -0
  22. package/beta/realtime/ws.d.ts.map +1 -0
  23. package/beta/realtime/ws.js +66 -0
  24. package/beta/realtime/ws.js.map +1 -0
  25. package/beta/realtime/ws.mjs +59 -0
  26. package/beta/realtime/ws.mjs.map +1 -0
  27. package/core.d.ts.map +1 -1
  28. package/core.js +28 -1
  29. package/core.js.map +1 -1
  30. package/core.mjs +28 -1
  31. package/core.mjs.map +1 -1
  32. package/index.d.mts +6 -6
  33. package/index.d.ts +6 -6
  34. package/index.d.ts.map +1 -1
  35. package/lib/EventEmitter.d.ts +45 -0
  36. package/lib/EventEmitter.d.ts.map +1 -0
  37. package/lib/EventEmitter.js +83 -0
  38. package/lib/EventEmitter.js.map +1 -0
  39. package/lib/EventEmitter.mjs +79 -0
  40. package/lib/EventEmitter.mjs.map +1 -0
  41. package/package.json +5 -1
  42. package/resources/beta/beta.d.ts +2 -2
  43. package/resources/beta/beta.d.ts.map +1 -1
  44. package/resources/beta/index.d.ts +1 -1
  45. package/resources/beta/index.d.ts.map +1 -1
  46. package/resources/beta/vector-stores/index.d.ts +1 -1
  47. package/resources/beta/vector-stores/index.d.ts.map +1 -1
  48. package/resources/beta/vector-stores/vector-stores.d.ts +3 -3
  49. package/resources/beta/vector-stores/vector-stores.d.ts.map +1 -1
  50. package/src/beta/realtime/index.ts +1 -0
  51. package/src/beta/realtime/internal-base.ts +83 -0
  52. package/src/beta/realtime/websocket.ts +97 -0
  53. package/src/beta/realtime/ws.ts +69 -0
  54. package/src/core.ts +35 -1
  55. package/src/index.ts +6 -6
  56. package/src/lib/EventEmitter.ts +98 -0
  57. package/src/resources/beta/beta.ts +2 -2
  58. package/src/resources/beta/index.ts +1 -1
  59. package/src/resources/beta/vector-stores/index.ts +1 -1
  60. package/src/resources/beta/vector-stores/vector-stores.ts +3 -3
  61. package/src/version.ts +1 -1
  62. package/version.d.ts +1 -1
  63. package/version.js +1 -1
  64. package/version.mjs +1 -1
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _EventEmitter_listeners;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EventEmitter = void 0;
10
+ class EventEmitter {
11
+ constructor() {
12
+ _EventEmitter_listeners.set(this, {});
13
+ }
14
+ /**
15
+ * Adds the listener function to the end of the listeners array for the event.
16
+ * No checks are made to see if the listener has already been added. Multiple calls passing
17
+ * the same combination of event and listener will result in the listener being added, and
18
+ * called, multiple times.
19
+ * @returns this, so that calls can be chained
20
+ */
21
+ on(event, listener) {
22
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] || (__classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] = []);
23
+ listeners.push({ listener });
24
+ return this;
25
+ }
26
+ /**
27
+ * Removes the specified listener from the listener array for the event.
28
+ * off() will remove, at most, one instance of a listener from the listener array. If any single
29
+ * listener has been added multiple times to the listener array for the specified event, then
30
+ * off() must be called multiple times to remove each instance.
31
+ * @returns this, so that calls can be chained
32
+ */
33
+ off(event, listener) {
34
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event];
35
+ if (!listeners)
36
+ return this;
37
+ const index = listeners.findIndex((l) => l.listener === listener);
38
+ if (index >= 0)
39
+ listeners.splice(index, 1);
40
+ return this;
41
+ }
42
+ /**
43
+ * Adds a one-time listener function for the event. The next time the event is triggered,
44
+ * this listener is removed and then invoked.
45
+ * @returns this, so that calls can be chained
46
+ */
47
+ once(event, listener) {
48
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] || (__classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] = []);
49
+ listeners.push({ listener, once: true });
50
+ return this;
51
+ }
52
+ /**
53
+ * This is similar to `.once()`, but returns a Promise that resolves the next time
54
+ * the event is triggered, instead of calling a listener callback.
55
+ * @returns a Promise that resolves the next time given event is triggered,
56
+ * or rejects if an error is emitted. (If you request the 'error' event,
57
+ * returns a promise that resolves with the error).
58
+ *
59
+ * Example:
60
+ *
61
+ * const message = await stream.emitted('message') // rejects if the stream errors
62
+ */
63
+ emitted(event) {
64
+ return new Promise((resolve, reject) => {
65
+ // TODO: handle errors
66
+ this.once(event, resolve);
67
+ });
68
+ }
69
+ _emit(event, ...args) {
70
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event];
71
+ if (listeners) {
72
+ __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] = listeners.filter((l) => !l.once);
73
+ listeners.forEach(({ listener }) => listener(...args));
74
+ }
75
+ }
76
+ _hasListener(event) {
77
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event];
78
+ return listeners && listeners.length > 0;
79
+ }
80
+ }
81
+ exports.EventEmitter = EventEmitter;
82
+ _EventEmitter_listeners = new WeakMap();
83
+ //# sourceMappingURL=EventEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEmitter.js","sourceRoot":"","sources":["../src/lib/EventEmitter.ts"],"names":[],"mappings":";;;;;;;;;AAWA,MAAa,YAAY;IAAzB;QACE,kCAEI,EAAE,EAAC;IAmFT,CAAC;IAjFC;;;;;;OAMG;IACH,EAAE,CAAiC,KAAY,EAAE,QAA0C;QACzF,MAAM,SAAS,GACb,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1D,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAiC,KAAY,EAAE,QAA0C;QAC1F,MAAM,SAAS,GAAG,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;QAClE,IAAI,KAAK,IAAI,CAAC;YAAE,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAiC,KAAY,EAAE,QAA0C;QAC3F,MAAM,SAAS,GACb,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1D,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CACL,KAAY;QAMZ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,sBAAsB;YACtB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAc,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAEb,KAAY,EACZ,GAAG,IAAwC;QAE3C,MAAM,SAAS,GAAkD,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,CAAC;QACxF,IAAI,SAAS,EAAE;YACb,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAQ,CAAC;YACjE,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAI,IAAY,CAAC,CAAC,CAAC;SACtE;IACH,CAAC;IAES,YAAY,CAAC,KAAuB;QAC5C,MAAM,SAAS,GAAG,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3C,CAAC;CACF;AAtFD,oCAsFC"}
@@ -0,0 +1,79 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _EventEmitter_listeners;
7
+ export class EventEmitter {
8
+ constructor() {
9
+ _EventEmitter_listeners.set(this, {});
10
+ }
11
+ /**
12
+ * Adds the listener function to the end of the listeners array for the event.
13
+ * No checks are made to see if the listener has already been added. Multiple calls passing
14
+ * the same combination of event and listener will result in the listener being added, and
15
+ * called, multiple times.
16
+ * @returns this, so that calls can be chained
17
+ */
18
+ on(event, listener) {
19
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] || (__classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] = []);
20
+ listeners.push({ listener });
21
+ return this;
22
+ }
23
+ /**
24
+ * Removes the specified listener from the listener array for the event.
25
+ * off() will remove, at most, one instance of a listener from the listener array. If any single
26
+ * listener has been added multiple times to the listener array for the specified event, then
27
+ * off() must be called multiple times to remove each instance.
28
+ * @returns this, so that calls can be chained
29
+ */
30
+ off(event, listener) {
31
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event];
32
+ if (!listeners)
33
+ return this;
34
+ const index = listeners.findIndex((l) => l.listener === listener);
35
+ if (index >= 0)
36
+ listeners.splice(index, 1);
37
+ return this;
38
+ }
39
+ /**
40
+ * Adds a one-time listener function for the event. The next time the event is triggered,
41
+ * this listener is removed and then invoked.
42
+ * @returns this, so that calls can be chained
43
+ */
44
+ once(event, listener) {
45
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] || (__classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] = []);
46
+ listeners.push({ listener, once: true });
47
+ return this;
48
+ }
49
+ /**
50
+ * This is similar to `.once()`, but returns a Promise that resolves the next time
51
+ * the event is triggered, instead of calling a listener callback.
52
+ * @returns a Promise that resolves the next time given event is triggered,
53
+ * or rejects if an error is emitted. (If you request the 'error' event,
54
+ * returns a promise that resolves with the error).
55
+ *
56
+ * Example:
57
+ *
58
+ * const message = await stream.emitted('message') // rejects if the stream errors
59
+ */
60
+ emitted(event) {
61
+ return new Promise((resolve, reject) => {
62
+ // TODO: handle errors
63
+ this.once(event, resolve);
64
+ });
65
+ }
66
+ _emit(event, ...args) {
67
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event];
68
+ if (listeners) {
69
+ __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event] = listeners.filter((l) => !l.once);
70
+ listeners.forEach(({ listener }) => listener(...args));
71
+ }
72
+ }
73
+ _hasListener(event) {
74
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f")[event];
75
+ return listeners && listeners.length > 0;
76
+ }
77
+ }
78
+ _EventEmitter_listeners = new WeakMap();
79
+ //# sourceMappingURL=EventEmitter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEmitter.mjs","sourceRoot":"","sources":["../src/lib/EventEmitter.ts"],"names":[],"mappings":";;;;;;AAWA,MAAM,OAAO,YAAY;IAAzB;QACE,kCAEI,EAAE,EAAC;IAmFT,CAAC;IAjFC;;;;;;OAMG;IACH,EAAE,CAAiC,KAAY,EAAE,QAA0C;QACzF,MAAM,SAAS,GACb,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1D,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAiC,KAAY,EAAE,QAA0C;QAC1F,MAAM,SAAS,GAAG,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;QAClE,IAAI,K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package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openai",
3
- "version": "4.78.1",
3
+ "version": "4.79.0",
4
4
  "description": "The official TypeScript library for the OpenAI API",
5
5
  "author": "OpenAI <support@openai.com>",
6
6
  "types": "./index.d.ts",
@@ -102,9 +102,13 @@
102
102
  },
103
103
  "bin": "./bin/cli",
104
104
  "peerDependencies": {
105
+ "ws": "^8.18.0",
105
106
  "zod": "^3.23.8"
106
107
  },
107
108
  "peerDependenciesMeta": {
109
+ "ws": {
110
+ "optional": true
111
+ },
108
112
  "zod": {
109
113
  "optional": true
110
114
  }
@@ -7,7 +7,7 @@ import { Realtime } from "./realtime/realtime.js";
7
7
  import * as ThreadsAPI from "./threads/threads.js";
8
8
  import { AssistantResponseFormatOption, AssistantToolChoice, AssistantToolChoiceFunction, AssistantToolChoiceOption, Thread, ThreadCreateAndRunParams, ThreadCreateAndRunParamsNonStreaming, ThreadCreateAndRunParamsStreaming, ThreadCreateAndRunPollParams, ThreadCreateAndRunStreamParams, ThreadCreateParams, ThreadDeleted, ThreadUpdateParams, Threads } from "./threads/threads.js";
9
9
  import * as VectorStoresAPI from "./vector-stores/vector-stores.js";
10
- import { AutoFileChunkingStrategyParam, FileChunkingStrategy, FileChunkingStrategyParam, OtherFileChunkingStrategyObject, StaticFileChunkingStrategy, StaticFileChunkingStrategyObject, StaticFileChunkingStrategyParam, VectorStore, VectorStoreCreateParams, VectorStoreDeleted, VectorStoreListParams, VectorStoreUpdateParams, VectorStores, VectorStoresPage } from "./vector-stores/vector-stores.js";
10
+ import { AutoFileChunkingStrategyParam, FileChunkingStrategy, FileChunkingStrategyParam, OtherFileChunkingStrategyObject, StaticFileChunkingStrategy, StaticFileChunkingStrategyObject, StaticFileChunkingStrategyObjectParam, VectorStore, VectorStoreCreateParams, VectorStoreDeleted, VectorStoreListParams, VectorStoreUpdateParams, VectorStores, VectorStoresPage } from "./vector-stores/vector-stores.js";
11
11
  import { Chat } from "./chat/chat.js";
12
12
  export declare class Beta extends APIResource {
13
13
  realtime: RealtimeAPI.Realtime;
@@ -18,7 +18,7 @@ export declare class Beta extends APIResource {
18
18
  }
19
19
  export declare namespace Beta {
20
20
  export { Realtime as Realtime };
21
- export { VectorStores as VectorStores, type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, };
21
+ export { VectorStores as VectorStores, type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, };
22
22
  export { Chat };
23
23
  export { Assistants as Assistants, type Assistant as Assistant, type AssistantDeleted as AssistantDeleted, type AssistantStreamEvent as AssistantStreamEvent, type AssistantTool as AssistantTool, type CodeInterpreterTool as CodeInterpreterTool, type FileSearchTool as FileSearchTool, type FunctionTool as FunctionTool, type MessageStreamEvent as MessageStreamEvent, type RunStepStreamEvent as RunStepStreamEvent, type RunStreamEvent as RunStreamEvent, type ThreadStreamEvent as ThreadStreamEvent, AssistantsPage as AssistantsPage, type AssistantCreateParams as AssistantCreateParams, type AssistantUpdateParams as AssistantUpdateParams, type AssistantListParams as AssistantListParams, };
24
24
  export { Threads as Threads, type AssistantResponseFormatOption as AssistantResponseFormatOption, type AssistantToolChoice as AssistantToolChoice, type AssistantToolChoiceFunction as AssistantToolChoiceFunction, type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, type ThreadCreateAndRunParamsNonStreaming as ThreadCreateAndRunParamsNonStreaming, type ThreadCreateAndRunParamsStreaming as ThreadCreateAndRunParamsStreaming, type ThreadCreateAndRunPollParams, type ThreadCreateAndRunStreamParams, };
@@ -1 +1 @@
1
- {"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,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BAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oCAAoC,IAAI,oCAAoC,EACjF,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,GACpC,CAAC;CACH"}
@@ -3,5 +3,5 @@ export { Beta } from "./beta.js";
3
3
  export { Realtime } from "./realtime/index.js";
4
4
  export { Chat } from "./chat/index.js";
5
5
  export { Threads, type AssistantResponseFormatOption, type AssistantToolChoice, type AssistantToolChoiceFunction, type AssistantToolChoiceOption, type Thread, type ThreadDeleted, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, type ThreadCreateAndRunParamsNonStreaming, type ThreadCreateAndRunParamsStreaming, type ThreadCreateAndRunPollParams, type ThreadCreateAndRunStreamParams, } from "./threads/index.js";
6
- export { VectorStoresPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, } from "./vector-stores/index.js";
6
+ export { VectorStoresPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, } from "./vector-stores/index.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,OAAO,EACP,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,EACzC,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,GACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,OAAO,EACP,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,EACzC,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,GACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,qCAAqC,EAC1C,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { FileBatches, type VectorStoreFileBatch, type FileBatchCreateParams, type FileBatchListFilesParams, } from "./file-batches.js";
2
2
  export { VectorStoreFilesPage, Files, type VectorStoreFile, type VectorStoreFileDeleted, type FileCreateParams, type FileListParams, } from "./files.js";
3
- export { VectorStoresPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, } from "./vector-stores.js";
3
+ export { VectorStoresPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, } from "./vector-stores.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/vector-stores/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/vector-stores/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,qCAAqC,EAC1C,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC3B,MAAM,iBAAiB,CAAC"}
@@ -50,7 +50,7 @@ export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileC
50
50
  * The chunking strategy used to chunk the file(s). If not set, will use the `auto`
51
51
  * strategy. Only applicable if `file_ids` is non-empty.
52
52
  */
53
- export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyParam;
53
+ export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyObjectParam;
54
54
  /**
55
55
  * This is returned when the chunking strategy is unknown. Typically, this is
56
56
  * because the file was indexed before the `chunking_strategy` concept was
@@ -82,7 +82,7 @@ export interface StaticFileChunkingStrategyObject {
82
82
  */
83
83
  type: 'static';
84
84
  }
85
- export interface StaticFileChunkingStrategyParam {
85
+ export interface StaticFileChunkingStrategyObjectParam {
86
86
  static: StaticFileChunkingStrategy;
87
87
  /**
88
88
  * Always `static`.
@@ -276,7 +276,7 @@ export interface VectorStoreListParams extends CursorPageParams {
276
276
  order?: 'asc' | 'desc';
277
277
  }
278
278
  export declare namespace VectorStores {
279
- export { type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, };
279
+ export { type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, };
280
280
  export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, VectorStoreFilesPage as VectorStoreFilesPage, type FileCreateParams as FileCreateParams, type FileListParams as FileListParams, };
281
281
  export { FileBatches as FileBatches, type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, type FileBatchListFilesParams as FileBatchListFilesParams, };
282
282
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vector-stores.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/vector-stores/vector-stores.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,cAAc,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAExE,qBAAa,YAAa,SAAQ,WAAW;IAC3C,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAoC;IACzD,WAAW,EAAE,cAAc,CAAC,WAAW,CAAgD;IAEvF;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IAQlG;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IAO5F;;OAEG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU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B,EAC7C,gBAAgB,IAAI,gBAAgB,EACpC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;IAEF,OAAO,EACL,KAAK,IAAI,KAAK,EACd,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,oBAAoB,IAAI,oBAAoB,EAC5C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
1
+ {"version":3,"file":"vector-stores.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/vector-stores/vector-stores.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,cAAc,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAExE,qBAAa,YAAa,SAAQ,WAAW;IAC3C,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAoC;IACzD,WAAW,EAAE,cAAc,CAAC,WAAW,CAAgD;IAEvF;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,uBAA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B;AAOD,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,gBAAgB,IAAI,gBAAgB,EACpC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;IAEF,OAAO,EACL,KAAK,IAAI,KAAK,EACd,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,oBAAoB,IAAI,oBAAoB,EAC5C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1 @@
1
+ export { OpenAIRealtimeError } from './internal-base';
@@ -0,0 +1,83 @@
1
+ import { RealtimeClientEvent, RealtimeServerEvent, ErrorEvent } from '../../resources/beta/realtime/realtime';
2
+ import { EventEmitter } from '../../lib/EventEmitter';
3
+ import { OpenAIError } from '../../error';
4
+
5
+ export class OpenAIRealtimeError extends OpenAIError {
6
+ /**
7
+ * The error data that the API sent back in an `error` event.
8
+ */
9
+ error?: ErrorEvent.Error | undefined;
10
+
11
+ /**
12
+ * The unique ID of the server event.
13
+ */
14
+ event_id?: string | undefined;
15
+
16
+ constructor(message: string, event: ErrorEvent | null) {
17
+ super(message);
18
+
19
+ this.error = event?.error;
20
+ this.event_id = event?.event_id;
21
+ }
22
+ }
23
+
24
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
25
+
26
+ type RealtimeEvents = Simplify<
27
+ {
28
+ event: (event: RealtimeServerEvent) => void;
29
+ error: (error: OpenAIRealtimeError) => void;
30
+ } & {
31
+ [EventType in Exclude<RealtimeServerEvent['type'], 'error'>]: (
32
+ event: Extract<RealtimeServerEvent, { type: EventType }>,
33
+ ) => unknown;
34
+ }
35
+ >;
36
+
37
+ export abstract class OpenAIRealtimeEmitter extends EventEmitter<RealtimeEvents> {
38
+ /**
39
+ * Send an event to the API.
40
+ */
41
+ abstract send(event: RealtimeClientEvent): void;
42
+
43
+ /**
44
+ * Close the websocket connection.
45
+ */
46
+ abstract close(props?: { code: number; reason: string }): void;
47
+
48
+ protected _onError(event: null, message: string, cause: any): void;
49
+ protected _onError(event: ErrorEvent, message?: string | undefined): void;
50
+ protected _onError(event: ErrorEvent | null, message?: string | undefined, cause?: any): void {
51
+ message =
52
+ event?.error ?
53
+ `${event.error.message} code=${event.error.code} param=${event.error.param} type=${event.error.type} event_id=${event.error.event_id}`
54
+ : message ?? 'unknown error';
55
+
56
+ if (!this._hasListener('error')) {
57
+ const error = new OpenAIRealtimeError(
58
+ message +
59
+ `\n\nTo resolve these unhandled rejection errors you should bind an \`error\` callback, e.g. \`rt.on('error', (error) => ...)\` `,
60
+ event,
61
+ );
62
+ // @ts-ignore
63
+ error.cause = cause;
64
+ Promise.reject(error);
65
+ return;
66
+ }
67
+
68
+ const error = new OpenAIRealtimeError(message, event);
69
+ // @ts-ignore
70
+ error.cause = cause;
71
+
72
+ this._emit('error', error);
73
+ }
74
+ }
75
+
76
+ export function buildRealtimeURL(props: { baseURL: string; model: string }): URL {
77
+ const path = '/realtime';
78
+
79
+ const url = new URL(props.baseURL + (props.baseURL.endsWith('/') ? path.slice(1) : path));
80
+ url.protocol = 'wss';
81
+ url.searchParams.set('model', props.model);
82
+ return url;
83
+ }
@@ -0,0 +1,97 @@
1
+ import { OpenAI } from '../../index';
2
+ import { OpenAIError } from '../../error';
3
+ import * as Core from '../../core';
4
+ import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime';
5
+ import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base';
6
+
7
+ interface MessageEvent {
8
+ data: string;
9
+ }
10
+
11
+ type _WebSocket =
12
+ typeof globalThis extends (
13
+ {
14
+ WebSocket: infer ws;
15
+ }
16
+ ) ?
17
+ // @ts-ignore
18
+ InstanceType<ws>
19
+ : any;
20
+
21
+ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
22
+ url: URL;
23
+ socket: _WebSocket;
24
+
25
+ constructor(
26
+ props: {
27
+ model: string;
28
+ dangerouslyAllowBrowser?: boolean;
29
+ },
30
+ client?: Pick<OpenAI, 'apiKey' | 'baseURL'>,
31
+ ) {
32
+ super();
33
+
34
+ const dangerouslyAllowBrowser =
35
+ props.dangerouslyAllowBrowser ??
36
+ (client as any)?._options?.dangerouslyAllowBrowser ??
37
+ (client?.apiKey.startsWith('ek_') ? true : null);
38
+
39
+ if (!dangerouslyAllowBrowser && Core.isRunningInBrowser()) {
40
+ throw new OpenAIError(
41
+ "It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\n\nYou can avoid this error by creating an ephemeral session token:\nhttps://platform.openai.com/docs/api-reference/realtime-sessions\n",
42
+ );
43
+ }
44
+
45
+ client ??= new OpenAI({ dangerouslyAllowBrowser });
46
+
47
+ this.url = buildRealtimeURL({ baseURL: client.baseURL, model: props.model });
48
+ // @ts-ignore
49
+ this.socket = new WebSocket(this.url, [
50
+ 'realtime',
51
+ `openai-insecure-api-key.${client.apiKey}`,
52
+ 'openai-beta.realtime-v1',
53
+ ]);
54
+
55
+ this.socket.addEventListener('message', (websocketEvent: MessageEvent) => {
56
+ const event = (() => {
57
+ try {
58
+ return JSON.parse(websocketEvent.data.toString()) as RealtimeServerEvent;
59
+ } catch (err) {
60
+ this._onError(null, 'could not parse websocket event', err);
61
+ return null;
62
+ }
63
+ })();
64
+
65
+ if (event) {
66
+ this._emit('event', event);
67
+
68
+ if (event.type === 'error') {
69
+ this._onError(event);
70
+ } else {
71
+ // @ts-expect-error TS isn't smart enough to get the relationship right here
72
+ this._emit(event.type, event);
73
+ }
74
+ }
75
+ });
76
+
77
+ this.socket.addEventListener('error', (event: any) => {
78
+ this._onError(null, event.message, null);
79
+ });
80
+ }
81
+
82
+ send(event: RealtimeClientEvent) {
83
+ try {
84
+ this.socket.send(JSON.stringify(event));
85
+ } catch (err) {
86
+ this._onError(null, 'could not send data', err);
87
+ }
88
+ }
89
+
90
+ close(props?: { code: number; reason: string }) {
91
+ try {
92
+ this.socket.close(props?.code ?? 1000, props?.reason ?? 'OK');
93
+ } catch (err) {
94
+ this._onError(null, 'could not close the connection', err);
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,69 @@
1
+ import WS from 'ws';
2
+ import { OpenAI } from '../../index';
3
+ import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime';
4
+ import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base';
5
+
6
+ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter {
7
+ url: URL;
8
+ socket: WS.WebSocket;
9
+
10
+ constructor(
11
+ props: { model: string; options?: WS.ClientOptions | undefined },
12
+ client?: Pick<OpenAI, 'apiKey' | 'baseURL'>,
13
+ ) {
14
+ super();
15
+ client ??= new OpenAI();
16
+
17
+ this.url = buildRealtimeURL({ baseURL: client.baseURL, model: props.model });
18
+ this.socket = new WS.WebSocket(this.url, {
19
+ ...props.options,
20
+ headers: {
21
+ ...props.options?.headers,
22
+ Authorization: `Bearer ${client.apiKey}`,
23
+ 'OpenAI-Beta': 'realtime=v1',
24
+ },
25
+ });
26
+
27
+ this.socket.on('message', (wsEvent) => {
28
+ const event = (() => {
29
+ try {
30
+ return JSON.parse(wsEvent.toString()) as RealtimeServerEvent;
31
+ } catch (err) {
32
+ this._onError(null, 'could not parse websocket event', err);
33
+ return null;
34
+ }
35
+ })();
36
+
37
+ if (event) {
38
+ this._emit('event', event);
39
+
40
+ if (event.type === 'error') {
41
+ this._onError(event);
42
+ } else {
43
+ // @ts-expect-error TS isn't smart enough to get the relationship right here
44
+ this._emit(event.type, event);
45
+ }
46
+ }
47
+ });
48
+
49
+ this.socket.on('error', (err) => {
50
+ this._onError(null, err.message, err);
51
+ });
52
+ }
53
+
54
+ send(event: RealtimeClientEvent) {
55
+ try {
56
+ this.socket.send(JSON.stringify(event));
57
+ } catch (err) {
58
+ this._onError(null, 'could not send data', err);
59
+ }
60
+ }
61
+
62
+ close(props?: { code: number; reason: string }) {
63
+ try {
64
+ this.socket.close(props?.code ?? 1000, props?.reason ?? 'OK');
65
+ } catch (err) {
66
+ this._onError(null, 'could not close the connection', err);
67
+ }
68
+ }
69
+ }
package/src/core.ts CHANGED
@@ -1148,9 +1148,43 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void {
1148
1148
  }
1149
1149
  }
1150
1150
 
1151
+ const SENSITIVE_HEADERS = new Set(['authorization', 'api-key']);
1152
+
1151
1153
  export function debug(action: string, ...args: any[]) {
1152
1154
  if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
1153
- console.log(`OpenAI:DEBUG:${action}`, ...args);
1155
+ const modifiedArgs = args.map((arg) => {
1156
+ if (!arg) {
1157
+ return arg;
1158
+ }
1159
+
1160
+ // Check for sensitive headers in request body 'headers' object
1161
+ if (arg['headers']) {
1162
+ // clone so we don't mutate
1163
+ const modifiedArg = { ...arg, headers: { ...arg['headers'] } };
1164
+
1165
+ for (const header in arg['headers']) {
1166
+ if (SENSITIVE_HEADERS.has(header.toLowerCase())) {
1167
+ modifiedArg['headers'][header] = 'REDACTED';
1168
+ }
1169
+ }
1170
+
1171
+ return modifiedArg;
1172
+ }
1173
+
1174
+ let modifiedArg = null;
1175
+
1176
+ // Check for sensitive headers in headers object
1177
+ for (const header in arg) {
1178
+ if (SENSITIVE_HEADERS.has(header.toLowerCase())) {
1179
+ // avoid making a copy until we need to
1180
+ modifiedArg ??= { ...arg };
1181
+ modifiedArg[header] = 'REDACTED';
1182
+ }
1183
+ }
1184
+
1185
+ return modifiedArg ?? arg;
1186
+ });
1187
+ console.log(`OpenAI:DEBUG:${action}`, ...modifiedArgs);
1154
1188
  }
1155
1189
  }
1156
1190