@effect/ai-openai 0.37.2 → 4.0.0-beta.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 (117) hide show
  1. package/dist/Generated.d.ts +70887 -0
  2. package/dist/Generated.d.ts.map +1 -0
  3. package/dist/Generated.js +4 -0
  4. package/dist/Generated.js.map +1 -0
  5. package/dist/OpenAiClient.d.ts +124 -0
  6. package/dist/OpenAiClient.d.ts.map +1 -0
  7. package/dist/OpenAiClient.js +128 -0
  8. package/dist/OpenAiClient.js.map +1 -0
  9. package/dist/{dts/OpenAiConfig.d.ts → OpenAiConfig.d.ts} +9 -9
  10. package/dist/OpenAiConfig.d.ts.map +1 -0
  11. package/dist/{esm/OpenAiConfig.js → OpenAiConfig.js} +8 -5
  12. package/dist/OpenAiConfig.js.map +1 -0
  13. package/dist/OpenAiError.d.ts +98 -0
  14. package/dist/OpenAiError.d.ts.map +1 -0
  15. package/dist/OpenAiError.js +10 -0
  16. package/dist/OpenAiError.js.map +1 -0
  17. package/dist/OpenAiLanguageModel.d.ts +318 -0
  18. package/dist/OpenAiLanguageModel.d.ts.map +1 -0
  19. package/dist/OpenAiLanguageModel.js +2207 -0
  20. package/dist/OpenAiLanguageModel.js.map +1 -0
  21. package/dist/{dts/OpenAiTelemetry.d.ts → OpenAiTelemetry.d.ts} +31 -13
  22. package/dist/OpenAiTelemetry.d.ts.map +1 -0
  23. package/dist/{esm/OpenAiTelemetry.js → OpenAiTelemetry.js} +11 -6
  24. package/dist/OpenAiTelemetry.js.map +1 -0
  25. package/dist/OpenAiTool.d.ts +479 -0
  26. package/dist/OpenAiTool.d.ts.map +1 -0
  27. package/dist/OpenAiTool.js +231 -0
  28. package/dist/OpenAiTool.js.map +1 -0
  29. package/dist/index.d.ts +58 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +59 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/internal/errors.d.ts +2 -0
  34. package/dist/internal/errors.d.ts.map +1 -0
  35. package/dist/internal/errors.js +316 -0
  36. package/dist/internal/errors.js.map +1 -0
  37. package/dist/{dts/internal → internal}/utilities.d.ts.map +1 -1
  38. package/dist/{esm/internal → internal}/utilities.js +4 -3
  39. package/dist/internal/utilities.js.map +1 -0
  40. package/package.json +45 -97
  41. package/src/Generated.ts +28521 -20036
  42. package/src/OpenAiClient.ts +220 -1816
  43. package/src/OpenAiConfig.ts +20 -34
  44. package/src/OpenAiError.ts +107 -0
  45. package/src/OpenAiLanguageModel.ts +1807 -638
  46. package/src/OpenAiTelemetry.ts +24 -19
  47. package/src/OpenAiTool.ts +216 -70
  48. package/src/index.ts +35 -8
  49. package/src/internal/errors.ts +347 -0
  50. package/src/internal/utilities.ts +7 -5
  51. package/Generated/package.json +0 -6
  52. package/OpenAiClient/package.json +0 -6
  53. package/OpenAiConfig/package.json +0 -6
  54. package/OpenAiEmbeddingModel/package.json +0 -6
  55. package/OpenAiLanguageModel/package.json +0 -6
  56. package/OpenAiTelemetry/package.json +0 -6
  57. package/OpenAiTokenizer/package.json +0 -6
  58. package/OpenAiTool/package.json +0 -6
  59. package/README.md +0 -5
  60. package/dist/cjs/Generated.js +0 -7150
  61. package/dist/cjs/Generated.js.map +0 -1
  62. package/dist/cjs/OpenAiClient.js +0 -1567
  63. package/dist/cjs/OpenAiClient.js.map +0 -1
  64. package/dist/cjs/OpenAiConfig.js +0 -30
  65. package/dist/cjs/OpenAiConfig.js.map +0 -1
  66. package/dist/cjs/OpenAiEmbeddingModel.js +0 -155
  67. package/dist/cjs/OpenAiEmbeddingModel.js.map +0 -1
  68. package/dist/cjs/OpenAiLanguageModel.js +0 -1147
  69. package/dist/cjs/OpenAiLanguageModel.js.map +0 -1
  70. package/dist/cjs/OpenAiTelemetry.js +0 -38
  71. package/dist/cjs/OpenAiTelemetry.js.map +0 -1
  72. package/dist/cjs/OpenAiTokenizer.js +0 -83
  73. package/dist/cjs/OpenAiTokenizer.js.map +0 -1
  74. package/dist/cjs/OpenAiTool.js +0 -93
  75. package/dist/cjs/OpenAiTool.js.map +0 -1
  76. package/dist/cjs/index.js +0 -24
  77. package/dist/cjs/index.js.map +0 -1
  78. package/dist/cjs/internal/utilities.js +0 -32
  79. package/dist/cjs/internal/utilities.js.map +0 -1
  80. package/dist/dts/Generated.d.ts +0 -40661
  81. package/dist/dts/Generated.d.ts.map +0 -1
  82. package/dist/dts/OpenAiClient.d.ts +0 -3120
  83. package/dist/dts/OpenAiClient.d.ts.map +0 -1
  84. package/dist/dts/OpenAiConfig.d.ts.map +0 -1
  85. package/dist/dts/OpenAiEmbeddingModel.d.ts +0 -109
  86. package/dist/dts/OpenAiEmbeddingModel.d.ts.map +0 -1
  87. package/dist/dts/OpenAiLanguageModel.d.ts +0 -235
  88. package/dist/dts/OpenAiLanguageModel.d.ts.map +0 -1
  89. package/dist/dts/OpenAiTelemetry.d.ts.map +0 -1
  90. package/dist/dts/OpenAiTokenizer.d.ts +0 -17
  91. package/dist/dts/OpenAiTokenizer.d.ts.map +0 -1
  92. package/dist/dts/OpenAiTool.d.ts +0 -200
  93. package/dist/dts/OpenAiTool.d.ts.map +0 -1
  94. package/dist/dts/index.d.ts +0 -33
  95. package/dist/dts/index.d.ts.map +0 -1
  96. package/dist/esm/Generated.js +0 -7150
  97. package/dist/esm/Generated.js.map +0 -1
  98. package/dist/esm/OpenAiClient.js +0 -1504
  99. package/dist/esm/OpenAiClient.js.map +0 -1
  100. package/dist/esm/OpenAiConfig.js.map +0 -1
  101. package/dist/esm/OpenAiEmbeddingModel.js +0 -143
  102. package/dist/esm/OpenAiEmbeddingModel.js.map +0 -1
  103. package/dist/esm/OpenAiLanguageModel.js +0 -1134
  104. package/dist/esm/OpenAiLanguageModel.js.map +0 -1
  105. package/dist/esm/OpenAiTelemetry.js.map +0 -1
  106. package/dist/esm/OpenAiTokenizer.js +0 -73
  107. package/dist/esm/OpenAiTokenizer.js.map +0 -1
  108. package/dist/esm/OpenAiTool.js +0 -84
  109. package/dist/esm/OpenAiTool.js.map +0 -1
  110. package/dist/esm/index.js +0 -33
  111. package/dist/esm/index.js.map +0 -1
  112. package/dist/esm/internal/utilities.js.map +0 -1
  113. package/dist/esm/package.json +0 -4
  114. package/index/package.json +0 -6
  115. package/src/OpenAiEmbeddingModel.ts +0 -243
  116. package/src/OpenAiTokenizer.ts +0 -70
  117. /package/dist/{dts/internal → internal}/utilities.d.ts +0 -0
@@ -1,1567 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.make = exports.layerConfig = exports.layer = exports.SummaryPart = exports.ResponseWebSearchCallSearchingEvent = exports.ResponseWebSearchCallInProgressEvent = exports.ResponseWebSearchCallCompletedEvent = exports.ResponseStreamEvent = exports.ResponseRefusalDoneEvent = exports.ResponseRefusalDeltaEvent = exports.ResponseReasoningTextDoneEvent = exports.ResponseReasoningTextDeltaEvent = exports.ResponseReasoningSummaryTextDoneEvent = exports.ResponseReasoningSummaryTextDeltaEvent = exports.ResponseReasoningSummaryPartDoneEvent = exports.ResponseReasoningSummaryPartAddedEvent = exports.ResponseQueuedEvent = exports.ResponseOutputTextDoneEvent = exports.ResponseOutputTextDeltaEvent = exports.ResponseOutputTextAnnotationAddedEvent = exports.ResponseOutputItemDoneEvent = exports.ResponseOutputItemAddedEvent = exports.ResponseMcpListToolsInProgressEvent = exports.ResponseMcpListToolsFailedEvent = exports.ResponseMcpListToolsCompletedEvent = exports.ResponseMcpCallInProgressEvent = exports.ResponseMcpCallFailedEvent = exports.ResponseMcpCallCompletedEvent = exports.ResponseMcpCallArgumentsDoneEvent = exports.ResponseMcpCallArgumentsDeltaEvent = exports.ResponseIncompleteEvent = exports.ResponseInProgressEvent = exports.ResponseImageGenerationCallPartialImageEvent = exports.ResponseImageGenerationCallInProgressEvent = exports.ResponseImageGenerationCallGeneratingEvent = exports.ResponseImageGenerationCallCompletedEvent = exports.ResponseFunctionCallArgumentsDoneEvent = exports.ResponseFunctionCallArgumentsDeltaEvent = exports.ResponseFileSearchCallSearchingEvent = exports.ResponseFileSearchCallInProgressEvent = exports.ResponseFileSearchCallCompletedEvent = exports.ResponseFailedEvent = exports.ResponseErrorEvent = exports.ResponseCustomToolCallInputDoneEvent = exports.ResponseCustomToolCallInputDeltaEvent = exports.ResponseCreatedEvent = exports.ResponseContentPartDoneEvent = exports.ResponseContentPartAddedEvent = exports.ResponseCompletedEvent = exports.ResponseCodeInterpreterCallInterpretingEvent = exports.ResponseCodeInterpreterCallInProgressEvent = exports.ResponseCodeInterpreterCallCompletedEvent = exports.ResponseCodeInterpreterCallCodeDoneEvent = exports.ResponseCodeInterpreterCallCodeDeltaEvent = exports.OpenAiClient = exports.LogProbs = void 0;
7
- var AiError = _interopRequireWildcard(require("@effect/ai/AiError"));
8
- var Sse = _interopRequireWildcard(require("@effect/experimental/Sse"));
9
- var Headers = _interopRequireWildcard(require("@effect/platform/Headers"));
10
- var HttpBody = _interopRequireWildcard(require("@effect/platform/HttpBody"));
11
- var HttpClient = _interopRequireWildcard(require("@effect/platform/HttpClient"));
12
- var HttpClientRequest = _interopRequireWildcard(require("@effect/platform/HttpClientRequest"));
13
- var Arr = _interopRequireWildcard(require("effect/Array"));
14
- var Config = _interopRequireWildcard(require("effect/Config"));
15
- var Context = _interopRequireWildcard(require("effect/Context"));
16
- var Effect = _interopRequireWildcard(require("effect/Effect"));
17
- var _Function = require("effect/Function");
18
- var Layer = _interopRequireWildcard(require("effect/Layer"));
19
- var Redacted = _interopRequireWildcard(require("effect/Redacted"));
20
- var Schema = _interopRequireWildcard(require("effect/Schema"));
21
- var Stream = _interopRequireWildcard(require("effect/Stream"));
22
- var Generated = _interopRequireWildcard(require("./Generated.js"));
23
- var _OpenAiConfig = require("./OpenAiConfig.js");
24
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
25
- /**
26
- * @since 1.0.0
27
- */
28
-
29
- /**
30
- * @since 1.0.0
31
- * @category Context
32
- */
33
- class OpenAiClient extends /*#__PURE__*/Context.Tag("@effect/ai-openai/OpenAiClient")() {}
34
- /**
35
- * @since 1.0.0
36
- * @category Constructors
37
- */
38
- exports.OpenAiClient = OpenAiClient;
39
- const make = options => Effect.gen(function* () {
40
- const organizationHeader = "OpenAI-Organization";
41
- const projectHeader = "OpenAI-Project";
42
- yield* Effect.locallyScopedWith(Headers.currentRedactedNames, Arr.appendAll([organizationHeader, projectHeader]));
43
- const httpClient = (yield* HttpClient.HttpClient).pipe(HttpClient.mapRequest(request => request.pipe(HttpClientRequest.prependUrl(options.apiUrl ?? "https://api.openai.com/v1"), options.apiKey ? HttpClientRequest.bearerToken(options.apiKey) : _Function.identity, options.organizationId !== undefined ? HttpClientRequest.setHeader(organizationHeader, Redacted.value(options.organizationId)) : _Function.identity, options.projectId !== undefined ? HttpClientRequest.setHeader(projectHeader, Redacted.value(options.projectId)) : _Function.identity, HttpClientRequest.acceptJson)), options.transformClient ? options.transformClient : _Function.identity);
44
- const httpClientOk = HttpClient.filterStatusOk(httpClient);
45
- const client = Generated.make(httpClient, {
46
- transformClient: client => _OpenAiConfig.OpenAiConfig.getOrUndefined.pipe(Effect.map(config => config?.transformClient ? config.transformClient(client) : client))
47
- });
48
- const streamRequest = (request, schema) => {
49
- const decodeEvent = Schema.decode(Schema.parseJson(schema));
50
- return httpClientOk.execute(request).pipe(Effect.map(r => r.stream), Stream.unwrapScoped, Stream.decodeText(), Stream.pipeThroughChannel(Sse.makeChannel()), Stream.mapEffect(event => decodeEvent(event.data)), Stream.catchTags({
51
- RequestError: error => AiError.HttpRequestError.fromRequestError({
52
- module: "OpenAiClient",
53
- method: "streamRequest",
54
- error
55
- }),
56
- ResponseError: error => AiError.HttpResponseError.fromResponseError({
57
- module: "OpenAiClient",
58
- method: "streamRequest",
59
- error
60
- }),
61
- ParseError: error => AiError.MalformedOutput.fromParseError({
62
- module: "OpenAiClient",
63
- method: "streamRequest",
64
- error
65
- })
66
- }));
67
- };
68
- const createResponse = options => client.createResponse(options).pipe(Effect.catchTags({
69
- RequestError: error => AiError.HttpRequestError.fromRequestError({
70
- module: "OpenAiClient",
71
- method: "createResponse",
72
- error
73
- }),
74
- ResponseError: error => AiError.HttpResponseError.fromResponseError({
75
- module: "OpenAiClient",
76
- method: "createResponse",
77
- error
78
- }),
79
- ParseError: error => AiError.MalformedOutput.fromParseError({
80
- module: "OpenAiClient",
81
- method: "createResponse",
82
- error
83
- })
84
- }));
85
- const createResponseStream = options => {
86
- const request = HttpClientRequest.post("/responses", {
87
- body: HttpBody.unsafeJson({
88
- ...options,
89
- stream: true
90
- })
91
- });
92
- return streamRequest(request, ResponseStreamEvent).pipe(Stream.takeUntil(event => event.type === "response.completed" || event.type === "response.incomplete"));
93
- };
94
- const createEmbedding = options => client.createEmbedding(options).pipe(Effect.catchTags({
95
- RequestError: error => AiError.HttpRequestError.fromRequestError({
96
- module: "OpenAiClient",
97
- method: "createResponse",
98
- error
99
- }),
100
- ResponseError: error => AiError.HttpResponseError.fromResponseError({
101
- module: "OpenAiClient",
102
- method: "createResponse",
103
- error
104
- }),
105
- ParseError: error => AiError.MalformedOutput.fromParseError({
106
- module: "OpenAiClient",
107
- method: "createResponse",
108
- error
109
- })
110
- }));
111
- return OpenAiClient.of({
112
- client,
113
- streamRequest,
114
- createResponse,
115
- createResponseStream,
116
- createEmbedding
117
- });
118
- });
119
- /**
120
- * @since 1.0.0
121
- * @category Layers
122
- */
123
- exports.make = make;
124
- const layer = options => Layer.scoped(OpenAiClient, make(options));
125
- /**
126
- * @since 1.0.0
127
- * @category Layers
128
- */
129
- exports.layer = layer;
130
- const layerConfig = options => {
131
- const {
132
- transformClient,
133
- ...configs
134
- } = options;
135
- return Config.all(configs).pipe(Effect.flatMap(configs => make({
136
- ...configs,
137
- transformClient
138
- })), Layer.scoped(OpenAiClient));
139
- };
140
- // =============================================================================
141
- // Response Stream Schema
142
- // =============================================================================
143
- /**
144
- * An event that is emitted when a response is created.
145
- *
146
- * @since 1.0.0
147
- * @category Schemas
148
- */
149
- exports.layerConfig = layerConfig;
150
- class ResponseCreatedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCreatedEvent")({
151
- /**
152
- * The type of the event. Always `"response.created"`.
153
- */
154
- type: /*#__PURE__*/Schema.Literal("response.created"),
155
- /**
156
- * The sequence number for this event.
157
- */
158
- sequence_number: Schema.Int,
159
- /**
160
- * The response that was created.
161
- */
162
- response: Generated.Response
163
- }) {}
164
- /**
165
- * Emitted when a response is queued and waiting to be processed.
166
- *
167
- * @since 1.0.0
168
- * @category Schemas
169
- */
170
- exports.ResponseCreatedEvent = ResponseCreatedEvent;
171
- class ResponseQueuedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseQueuedEvent")({
172
- /**
173
- * The type of the event. Always `"response.queued"`.
174
- */
175
- type: /*#__PURE__*/Schema.Literal("response.queued"),
176
- /**
177
- * The sequence number for this event.
178
- */
179
- sequence_number: Schema.Int,
180
- /**
181
- * The full response object that is queued.
182
- */
183
- response: Generated.Response
184
- }) {}
185
- /**
186
- * Emitted when the response is in progress.
187
- *
188
- * @since 1.0.0
189
- * @category Schemas
190
- */
191
- exports.ResponseQueuedEvent = ResponseQueuedEvent;
192
- class ResponseInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseInProgressEvent")({
193
- /**
194
- * The type of the event. Always `"response.in_progress"`.
195
- */
196
- type: /*#__PURE__*/Schema.Literal("response.in_progress"),
197
- /**
198
- * The sequence number for this event.
199
- */
200
- sequence_number: Schema.Int,
201
- /**
202
- * The response that is in progress.
203
- */
204
- response: Generated.Response
205
- }) {}
206
- /**
207
- * Emitted when the model response is complete.
208
- *
209
- * @since 1.0.0
210
- * @category Schemas
211
- */
212
- exports.ResponseInProgressEvent = ResponseInProgressEvent;
213
- class ResponseCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCompletedEvent")({
214
- /**
215
- * The type of the event. Always `"response.completed"`.
216
- */
217
- type: /*#__PURE__*/Schema.Literal("response.completed"),
218
- /**
219
- * The sequence number for this event.
220
- */
221
- sequence_number: Schema.Int,
222
- /**
223
- * Properties of the completed response.
224
- */
225
- response: Generated.Response
226
- }) {}
227
- /**
228
- * An event that is emitted when a response finishes as incomplete.
229
- *
230
- * @since 1.0.0
231
- * @category Schemas
232
- */
233
- exports.ResponseCompletedEvent = ResponseCompletedEvent;
234
- class ResponseIncompleteEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseIncompleteEvent")({
235
- /**
236
- * The type of the event. Always `"response.incomplete"`.
237
- */
238
- type: /*#__PURE__*/Schema.Literal("response.incomplete"),
239
- /**
240
- * The sequence number for this event.
241
- */
242
- sequence_number: Schema.Int,
243
- /**
244
- * The response that was incomplete.
245
- */
246
- response: Generated.Response
247
- }) {}
248
- /**
249
- * An event that is emitted when a response fails.
250
- *
251
- * @since 1.0.0
252
- * @category Schemas
253
- */
254
- exports.ResponseIncompleteEvent = ResponseIncompleteEvent;
255
- class ResponseFailedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseFailedEvent")({
256
- /**
257
- * The type of the event. Always `"response.failed"`.
258
- */
259
- type: /*#__PURE__*/Schema.Literal("response.failed"),
260
- /**
261
- * The sequence number for this event.
262
- */
263
- sequence_number: Schema.Int,
264
- /**
265
- * The response that failed.
266
- */
267
- response: Generated.Response
268
- }) {}
269
- exports.ResponseFailedEvent = ResponseFailedEvent;
270
- const WebSearchToolCallForAddEvent = /*#__PURE__*/Schema.asSchema(/*#__PURE__*/Generated.WebSearchToolCall.pipe(/*#__PURE__*/Schema.omit("action")));
271
- const AddEventOutputItem = /*#__PURE__*/Schema.Union(Generated.OutputItem, WebSearchToolCallForAddEvent);
272
- /**
273
- * Emitted when a new output item is added.
274
- *
275
- * @since 1.0.0
276
- * @category Schemas
277
- */
278
- class ResponseOutputItemAddedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseOutputItemAddedEvent")({
279
- /**
280
- * The type of the event. Always `"response.output_item.added"`.
281
- */
282
- type: /*#__PURE__*/Schema.Literal("response.output_item.added"),
283
- /**
284
- * The sequence number for this event.
285
- */
286
- sequence_number: Schema.Int,
287
- /**
288
- * The index of the output item that was added.
289
- */
290
- output_index: Schema.Int,
291
- /**
292
- * The output item that was added.
293
- */
294
- item: AddEventOutputItem
295
- }) {}
296
- /**
297
- * Emitted when an output item is marked done.
298
- *
299
- * @since 1.0.0
300
- * @category Schemas
301
- */
302
- exports.ResponseOutputItemAddedEvent = ResponseOutputItemAddedEvent;
303
- class ResponseOutputItemDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseOutputItemDoneEvent")({
304
- /**
305
- * The type of the event. Always `"response.output_item.done"`.
306
- */
307
- type: /*#__PURE__*/Schema.Literal("response.output_item.done"),
308
- /**
309
- * The sequence number for this event.
310
- */
311
- sequence_number: Schema.Int,
312
- /**
313
- * The index of the output item that was marked done.
314
- */
315
- output_index: Schema.Int,
316
- /**
317
- * The output item that was marked done.
318
- */
319
- item: Generated.OutputItem
320
- }) {}
321
- /**
322
- * Emitted when a new content part is added.
323
- *
324
- * @since 1.0.0
325
- * @category Schemas
326
- */
327
- exports.ResponseOutputItemDoneEvent = ResponseOutputItemDoneEvent;
328
- class ResponseContentPartAddedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseContentPartAddedEvent")({
329
- /**
330
- * The type of the event. Always `"response.content_part.added"`.
331
- */
332
- type: /*#__PURE__*/Schema.Literal("response.content_part.added"),
333
- /**
334
- * The sequence number for this event.
335
- */
336
- sequence_number: Schema.Int,
337
- /**
338
- * The index of the output item that the content part was added to.
339
- */
340
- output_index: Schema.Int,
341
- /**
342
- * The index of the content part that was added.
343
- */
344
- content_index: Schema.Int,
345
- /**
346
- * The ID of the output item that the content part was added to.
347
- */
348
- item_id: Schema.String,
349
- /**
350
- * The content part that was added.
351
- */
352
- part: /*#__PURE__*/Schema.Union(Generated.OutputTextContent, Generated.RefusalContent, Generated.ReasoningTextContent)
353
- }) {}
354
- /**
355
- * Emitted when a content part is done.
356
- *
357
- * @since 1.0.0
358
- * @category Schemas
359
- */
360
- exports.ResponseContentPartAddedEvent = ResponseContentPartAddedEvent;
361
- class ResponseContentPartDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseContentPartDoneEvent")({
362
- /**
363
- * The type of the event. Always `"response.content_part.done"`.
364
- */
365
- type: /*#__PURE__*/Schema.Literal("response.content_part.done"),
366
- /**
367
- * The sequence number for this event.
368
- */
369
- sequence_number: Schema.Int,
370
- /**
371
- * The index of the output item that the content part was added to.
372
- */
373
- output_index: Schema.Int,
374
- /**
375
- * The index of the content part that is done.
376
- */
377
- content_index: Schema.Int,
378
- /**
379
- * The ID of the output item that the content part was added to.
380
- */
381
- item_id: Schema.String,
382
- /**
383
- * The content part that was added.
384
- */
385
- part: /*#__PURE__*/Schema.Union(Generated.OutputTextContent, Generated.RefusalContent, Generated.ReasoningTextContent)
386
- }) {}
387
- /**
388
- * @since 1.0.0
389
- * @category Schemas
390
- */
391
- exports.ResponseContentPartDoneEvent = ResponseContentPartDoneEvent;
392
- class LogProbs extends /*#__PURE__*/Schema.Class("@effect/ai-openai/LogProbs")({
393
- /**
394
- * The log probability of this token.
395
- */
396
- logprob: Schema.Number,
397
- /**
398
- * A possible text token.
399
- */
400
- token: Schema.String,
401
- /**
402
- * The log probability of the top 20 most likely tokens.
403
- */
404
- top_logprobs: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Struct({
405
- /**
406
- * The log probability of this token.
407
- */
408
- logprob: Schema.Number,
409
- /**
410
- * A possible text token.
411
- */
412
- token: Schema.String
413
- }))
414
- }) {}
415
- /**
416
- * Emitted when there is an additional text delta.
417
- *
418
- * @since 1.0.0
419
- * @category Schemas
420
- */
421
- exports.LogProbs = LogProbs;
422
- class ResponseOutputTextDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseOutputTextDeltaEvent")({
423
- /**
424
- * The type of the event. Always `"response.output_text.delta"`.
425
- */
426
- type: /*#__PURE__*/Schema.Literal("response.output_text.delta"),
427
- /**
428
- * The sequence number for this event.
429
- */
430
- sequence_number: Schema.Int,
431
- /**
432
- * The index of the output item that the text delta was added to.
433
- */
434
- output_index: Schema.Int,
435
- /**
436
- * The index of the content part that the text delta was added to.
437
- */
438
- content_index: Schema.Int,
439
- /**
440
- * The ID of the output item that the text delta was added to.
441
- */
442
- item_id: Schema.String,
443
- /**
444
- * The text delta that was added.
445
- */
446
- delta: Schema.String,
447
- /**
448
- * The log probabilities of the tokens in the delta.
449
- */
450
- logprobs: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Array(LogProbs)))
451
- }) {}
452
- /**
453
- * Emitted when text content is finalized.
454
- *
455
- * @since 1.0.0
456
- * @category Schemas
457
- */
458
- exports.ResponseOutputTextDeltaEvent = ResponseOutputTextDeltaEvent;
459
- class ResponseOutputTextDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseOutputTextDoneEvent")({
460
- /**
461
- * The type of the event. Always `"response.output_text.done"`.
462
- */
463
- type: /*#__PURE__*/Schema.Literal("response.output_text.done"),
464
- /**
465
- * The sequence number for this event.
466
- */
467
- sequence_number: Schema.Int,
468
- /**
469
- * The index of the output item that the text content is finalized.
470
- */
471
- output_index: Schema.Int,
472
- /**
473
- * The index of the content part that the text content is finalized.
474
- */
475
- content_index: Schema.Int,
476
- /**
477
- * The ID of the output item that the text content is finalized.
478
- */
479
- item_id: Schema.String,
480
- /**
481
- * The text content that is finalized.
482
- */
483
- text: Schema.String,
484
- /**
485
- * The log probabilities of the tokens in the delta.
486
- */
487
- logprobs: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Array(LogProbs)))
488
- }) {}
489
- /**
490
- * Emitted when an annotation is added to output text content.
491
- *
492
- * @since 1.0.0
493
- * @category Schemas
494
- */
495
- exports.ResponseOutputTextDoneEvent = ResponseOutputTextDoneEvent;
496
- class ResponseOutputTextAnnotationAddedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseOutputTextAnnotationAddedEvent")({
497
- /**
498
- * The type of the event. Always `"response.output_text.annotation.added"`.
499
- */
500
- type: /*#__PURE__*/Schema.Literal("response.output_text.annotation.added"),
501
- /**
502
- * The sequence number for this event.
503
- */
504
- sequence_number: Schema.Int,
505
- /**
506
- * The index of the output item in the response's output array.
507
- */
508
- output_index: Schema.Int,
509
- /**
510
- * The index of the content part within the output item.
511
- */
512
- content_index: Schema.Int,
513
- /**
514
- * The index of the annotation within the content part.
515
- */
516
- annotation_index: Schema.Int,
517
- /**
518
- * The unique identifier of the item to which the annotation is being added.
519
- */
520
- item_id: Schema.String,
521
- /**
522
- * The annotation object being added. (See annotation schema for details.)
523
- */
524
- annotation: Generated.Annotation
525
- }) {}
526
- /**
527
- * Emitted when there is a partial refusal text.
528
- *
529
- * @since 1.0.0
530
- * @category Schemas
531
- */
532
- exports.ResponseOutputTextAnnotationAddedEvent = ResponseOutputTextAnnotationAddedEvent;
533
- class ResponseRefusalDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseRefusalDeltaEvent")({
534
- /**
535
- * The type of the event. Always `"response.refusal.delta"`.
536
- */
537
- type: /*#__PURE__*/Schema.Literal("response.refusal.delta"),
538
- /**
539
- * The sequence number for this event.
540
- */
541
- sequence_number: Schema.Int,
542
- /**
543
- * The index of the output item that the refusal text is added to.
544
- */
545
- output_index: Schema.Int,
546
- /**
547
- * The index of the content part that the refusal text is added to.
548
- */
549
- content_index: Schema.Int,
550
- /**
551
- * The ID of the output item that the refusal text is added to.
552
- */
553
- item_id: Schema.String,
554
- /**
555
- * The refusal text that is added.
556
- */
557
- delta: Schema.String
558
- }) {}
559
- /**
560
- * Emitted when refusal text is finalized.
561
- *
562
- * @since 1.0.0
563
- * @category Schemas
564
- */
565
- exports.ResponseRefusalDeltaEvent = ResponseRefusalDeltaEvent;
566
- class ResponseRefusalDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseRefusalDoneEvent")({
567
- /**
568
- * The type of the event. Always `"response.refusal.done"`.
569
- */
570
- type: /*#__PURE__*/Schema.Literal("response.refusal.done"),
571
- /**
572
- * The sequence number for this event.
573
- */
574
- sequence_number: Schema.Int,
575
- /**
576
- * The index of the output item that the refusal text is finalized.
577
- */
578
- output_index: Schema.Int,
579
- /**
580
- * The index of the content part that the refusal text is finalized.
581
- */
582
- content_index: Schema.Int,
583
- /**
584
- * The index of the output item that the refusal text is added to.
585
- */
586
- item_id: Schema.String,
587
- /**
588
- * The refusal text that is finalized.
589
- */
590
- refusal: Schema.String
591
- }) {}
592
- /**
593
- * Emitted when there is a partial function-call arguments delta.
594
- *
595
- * @since 1.0.0
596
- * @category Schemas
597
- */
598
- exports.ResponseRefusalDoneEvent = ResponseRefusalDoneEvent;
599
- class ResponseFunctionCallArgumentsDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseFunctionCallArgumentsDeltaEvent")({
600
- /**
601
- * The type of the event. Always `"response.function_call_arguments.delta"`.
602
- */
603
- type: /*#__PURE__*/Schema.Literal("response.function_call_arguments.delta"),
604
- /**
605
- * The sequence number for this event.
606
- */
607
- sequence_number: Schema.Int,
608
- /**
609
- * The index of the output item that the function-call arguments delta is added to.
610
- */
611
- output_index: Schema.Int,
612
- /**
613
- * The ID of the output item that the function-call arguments delta is added to.
614
- */
615
- item_id: Schema.String,
616
- /**
617
- * The function-call arguments delta that is added.
618
- */
619
- delta: Schema.String
620
- }) {}
621
- /**
622
- * Emitted when function-call arguments are finalized.
623
- *
624
- * @since 1.0.0
625
- * @category Schemas
626
- */
627
- exports.ResponseFunctionCallArgumentsDeltaEvent = ResponseFunctionCallArgumentsDeltaEvent;
628
- class ResponseFunctionCallArgumentsDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseFunctionCallArgumentsDoneEvent")({
629
- /**
630
- * The type of the event. Always `"response.function_call_arguments.done"`.
631
- */
632
- type: /*#__PURE__*/Schema.Literal("response.function_call_arguments.done"),
633
- /**
634
- * The sequence number for this event.
635
- */
636
- sequence_number: Schema.Int,
637
- /**
638
- * The index of the output item.
639
- */
640
- output_index: Schema.Int,
641
- /**
642
- * The ID of the item.
643
- */
644
- item_id: Schema.String,
645
- /**
646
- * The function-call arguments.
647
- */
648
- arguments: Schema.String
649
- }) {}
650
- /**
651
- * Emitted when a file search call is initiated.
652
- *
653
- * @since 1.0.0
654
- * @category Schemas
655
- */
656
- exports.ResponseFunctionCallArgumentsDoneEvent = ResponseFunctionCallArgumentsDoneEvent;
657
- class ResponseFileSearchCallInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseFileSearchCallInProgressEvent")({
658
- /**
659
- * The type of the event. Always `"response.file_search_call.in_progress"`.
660
- */
661
- type: /*#__PURE__*/Schema.Literal("response.file_search_call.in_progress"),
662
- /**
663
- * The sequence number for this event.
664
- */
665
- sequence_number: Schema.Int,
666
- /**
667
- * The index of the output item that the file search call is initiated.
668
- */
669
- output_index: Schema.Int,
670
- /**
671
- * The ID of the output item that the file search call is initiated.
672
- */
673
- item_id: Schema.String
674
- }) {}
675
- /**
676
- * Emitted when a file search is currently searching.
677
- *
678
- * @since 1.0.0
679
- * @category Schemas
680
- */
681
- exports.ResponseFileSearchCallInProgressEvent = ResponseFileSearchCallInProgressEvent;
682
- class ResponseFileSearchCallSearchingEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseFileSearchCallSearchingEvent")({
683
- /**
684
- * The type of the event. Always `"response.file_search_call.searching"`.
685
- */
686
- type: /*#__PURE__*/Schema.Literal("response.file_search_call.searching"),
687
- /**
688
- * The sequence number for this event.
689
- */
690
- sequence_number: Schema.Int,
691
- /**
692
- * The index of the output item that the file search call is searching.
693
- */
694
- output_index: Schema.Int,
695
- /**
696
- * The ID of the output item that the file search call is initiated.
697
- */
698
- item_id: Schema.String
699
- }) {}
700
- /**
701
- * Emitted when a file search call is completed (results found).
702
- *
703
- * @since 1.0.0
704
- * @category Schemas
705
- */
706
- exports.ResponseFileSearchCallSearchingEvent = ResponseFileSearchCallSearchingEvent;
707
- class ResponseFileSearchCallCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseFileSearchCallCompletedEvent")({
708
- /**
709
- * The type of the event. Always `"response.file_search_call.completed"`.
710
- */
711
- type: /*#__PURE__*/Schema.Literal("response.file_search_call.completed"),
712
- /**
713
- * The sequence number for this event.
714
- */
715
- sequence_number: Schema.Int,
716
- /**
717
- * The index of the output item that the file search call is initiated.
718
- */
719
- output_index: Schema.Int,
720
- /**
721
- * The ID of the output item that the file search call is initiated.
722
- */
723
- item_id: Schema.String
724
- }) {}
725
- /**
726
- * Emitted when a web search call is initiated.
727
- *
728
- * @since 1.0.0
729
- * @category Schemas
730
- */
731
- exports.ResponseFileSearchCallCompletedEvent = ResponseFileSearchCallCompletedEvent;
732
- class ResponseWebSearchCallInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseWebSearchCallInProgressEvent")({
733
- /**
734
- * The type of the event. Always `"response.web_search_call.in_progress"`.
735
- */
736
- type: /*#__PURE__*/Schema.Literal("response.web_search_call.in_progress"),
737
- /**
738
- * The sequence number for this event.
739
- */
740
- sequence_number: Schema.Int,
741
- /**
742
- * The index of the output item that the web search call is associated with.
743
- */
744
- output_index: Schema.Int,
745
- /**
746
- * Unique ID for the output item associated with the web search call.
747
- */
748
- item_id: Schema.String
749
- }) {}
750
- /**
751
- * Emitted when a web search call is executing.
752
- *
753
- * @since 1.0.0
754
- * @category Schemas
755
- */
756
- exports.ResponseWebSearchCallInProgressEvent = ResponseWebSearchCallInProgressEvent;
757
- class ResponseWebSearchCallSearchingEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseWebSearchCallSearchingEvent")({
758
- /**
759
- * The type of the event. Always `"response.web_search_call.searching"`.
760
- */
761
- type: /*#__PURE__*/Schema.Literal("response.web_search_call.searching"),
762
- /**
763
- * The sequence number for this event.
764
- */
765
- sequence_number: Schema.Int,
766
- /**
767
- * The index of the output item that the web search call is associated with.
768
- */
769
- output_index: Schema.Int,
770
- /**
771
- * Unique ID for the output item associated with the web search call.
772
- */
773
- item_id: Schema.String
774
- }) {}
775
- /**
776
- * Emitted when a web search call is completed.
777
- *
778
- * @since 1.0.0
779
- * @category Schemas
780
- */
781
- exports.ResponseWebSearchCallSearchingEvent = ResponseWebSearchCallSearchingEvent;
782
- class ResponseWebSearchCallCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseWebSearchCallCompletedEvent")({
783
- /**
784
- * The type of the event. Always `"response.web_search_call.completed"`.
785
- */
786
- type: /*#__PURE__*/Schema.Literal("response.web_search_call.completed"),
787
- /**
788
- * The sequence number for this event.
789
- */
790
- sequence_number: Schema.Int,
791
- /**
792
- * The index of the output item that the web search call is associated with.
793
- */
794
- output_index: Schema.Int,
795
- /**
796
- * Unique ID for the output item associated with the web search call.
797
- */
798
- item_id: Schema.String
799
- }) {}
800
- /**
801
- * @since 1.0.0
802
- * @category Schemas
803
- */
804
- exports.ResponseWebSearchCallCompletedEvent = ResponseWebSearchCallCompletedEvent;
805
- class SummaryPart extends /*#__PURE__*/Schema.Class("@effect/ai-openai/SummaryPart")({
806
- /**
807
- * The type of the summary part. Always `"summary_text"`.
808
- */
809
- type: /*#__PURE__*/Schema.Literal("summary_text"),
810
- /**
811
- * The text of the summary part.
812
- */
813
- text: Schema.String
814
- }) {}
815
- /**
816
- * Emitted when a reasoning summary part is completed.
817
- *
818
- * @since 1.0.0
819
- * @category Schemas
820
- */
821
- exports.SummaryPart = SummaryPart;
822
- class ResponseReasoningSummaryPartAddedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseReasoningSummaryPartAddedEvent")({
823
- /**
824
- * The type of the event. Always `"response.reasoning_summary_part.added"`.
825
- */
826
- type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_part.added"),
827
- /**
828
- * The sequence number for this event.
829
- */
830
- sequence_number: Schema.Int,
831
- /**
832
- * The index of the summary part within the reasoning summary.
833
- */
834
- summary_index: Schema.Int,
835
- /**
836
- * The index of the output item this summary part is associated with.
837
- */
838
- output_index: Schema.Int,
839
- /**
840
- * The ID of the item this summary part is associated with.
841
- */
842
- item_id: Schema.String,
843
- /**
844
- * The summary part that was added.
845
- */
846
- part: SummaryPart
847
- }) {}
848
- /**
849
- * Emitted when a new reasoning summary part is added.
850
- *
851
- * @since 1.0.0
852
- * @category Schemas
853
- */
854
- exports.ResponseReasoningSummaryPartAddedEvent = ResponseReasoningSummaryPartAddedEvent;
855
- class ResponseReasoningSummaryPartDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseReasoningSummaryPartDoneEvent")({
856
- /**
857
- * The type of the event. Always `"response.reasoning_summary_part.done"`.
858
- */
859
- type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_part.done"),
860
- /**
861
- * The sequence number for this event.
862
- */
863
- sequence_number: Schema.Int,
864
- /**
865
- * The index of the summary part within the reasoning summary.
866
- */
867
- summary_index: Schema.Int,
868
- /**
869
- * The index of the output item this summary part is associated with.
870
- */
871
- output_index: Schema.Int,
872
- /**
873
- * The ID of the item this summary part is associated with.
874
- */
875
- item_id: Schema.String,
876
- /**
877
- * The completed summary part.
878
- */
879
- part: SummaryPart
880
- }) {}
881
- /**
882
- * Emitted when a delta is added to a reasoning summary text.
883
- *
884
- * @since 1.0.0
885
- * @category Schemas
886
- */
887
- exports.ResponseReasoningSummaryPartDoneEvent = ResponseReasoningSummaryPartDoneEvent;
888
- class ResponseReasoningSummaryTextDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseReasoningSummaryTextDeltaEvent")({
889
- /**
890
- * The type of the event. Always `"response.reasoning_summary_text.delta"`.
891
- */
892
- type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_text.delta"),
893
- /**
894
- * The sequence number for this event.
895
- */
896
- sequence_number: Schema.Int,
897
- /**
898
- * The index of the summary part within the reasoning summary.
899
- */
900
- summary_index: Schema.Int,
901
- /**
902
- * The index of the output item this summary text delta is associated with.
903
- */
904
- output_index: Schema.Int,
905
- /**
906
- * The ID of the item this summary text delta is associated with.
907
- */
908
- item_id: Schema.String,
909
- /**
910
- * The text delta that was added to the summary.
911
- */
912
- delta: Schema.String
913
- }) {}
914
- /**
915
- * Emitted when a reasoning summary text is completed.
916
- *
917
- * @since 1.0.0
918
- * @category Schemas
919
- */
920
- exports.ResponseReasoningSummaryTextDeltaEvent = ResponseReasoningSummaryTextDeltaEvent;
921
- class ResponseReasoningSummaryTextDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseReasoningSummaryTextDoneEvent")({
922
- /**
923
- * The type of the event. Always `"response.reasoning_summary_text.done"`.
924
- */
925
- type: /*#__PURE__*/Schema.Literal("response.reasoning_summary_text.done"),
926
- /**
927
- * The sequence number for this event.
928
- */
929
- sequence_number: Schema.Int,
930
- /**
931
- * The index of the summary part within the reasoning summary.
932
- */
933
- summary_index: Schema.Int,
934
- /**
935
- * The index of the output item this summary text is associated with.
936
- */
937
- output_index: Schema.Int,
938
- /**
939
- * The ID of the item this summary text is associated with.
940
- */
941
- item_id: Schema.String,
942
- /**
943
- * The full text of the completed reasoning summary.
944
- */
945
- text: Schema.String
946
- }) {}
947
- /**
948
- * Emitted when a delta is added to a reasoning text.
949
- *
950
- * @since 1.0.0
951
- * @category Schemas
952
- */
953
- exports.ResponseReasoningSummaryTextDoneEvent = ResponseReasoningSummaryTextDoneEvent;
954
- class ResponseReasoningTextDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseReasoningTextDeltaEvent")({
955
- /**
956
- * The type of the event. Always `"response.reasoning_text.delta"`.
957
- */
958
- type: /*#__PURE__*/Schema.Literal("response.reasoning_text.delta"),
959
- /**
960
- * The sequence number for this event.
961
- */
962
- sequence_number: Schema.Int,
963
- /**
964
- * The index of the reasoning content part this delta is associated with.
965
- */
966
- content_index: Schema.Int,
967
- /**
968
- * The index of the output item this reasoning text delta is associated with.
969
- */
970
- output_index: Schema.Int,
971
- /**
972
- * The ID of the item this reasoning text delta is associated with.
973
- */
974
- item_id: Schema.String,
975
- /**
976
- * The text delta that was added to the reasoning content.
977
- */
978
- delta: Schema.String
979
- }) {}
980
- /**
981
- * Emitted when a reasoning text is completed.
982
- *
983
- * @since 1.0.0
984
- * @category Schemas
985
- */
986
- exports.ResponseReasoningTextDeltaEvent = ResponseReasoningTextDeltaEvent;
987
- class ResponseReasoningTextDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseReasoningPartDoneEvent")({
988
- /**
989
- * The type of the event. Always `"response.reasoning_text.done"`.
990
- */
991
- type: /*#__PURE__*/Schema.Literal("response.reasoning_text.done"),
992
- /**
993
- * The sequence number for this event.
994
- */
995
- sequence_number: Schema.Int,
996
- /**
997
- * The index of the reasoning content part.
998
- */
999
- content_index: Schema.Int,
1000
- /**
1001
- * The index of the output item this reasoning text is associated with.
1002
- */
1003
- output_index: Schema.Int,
1004
- /**
1005
- * The ID of the item this reasoning text is associated with.
1006
- */
1007
- item_id: Schema.String,
1008
- /**
1009
- * The full text of the completed reasoning content.
1010
- */
1011
- text: Schema.String
1012
- }) {}
1013
- /**
1014
- * Emitted when an image generation tool call is in progress.
1015
- *
1016
- * @since 1.0.0
1017
- * @category Schemas
1018
- */
1019
- exports.ResponseReasoningTextDoneEvent = ResponseReasoningTextDoneEvent;
1020
- class ResponseImageGenerationCallInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseImageGenerationCallInProgressEvent")({
1021
- /**
1022
- * The type of the event. Always `"response.image_generation_call.in_progress"`.
1023
- */
1024
- type: /*#__PURE__*/Schema.Literal("response.image_generation_call.in_progress"),
1025
- /**
1026
- * The sequence number for this event.
1027
- */
1028
- sequence_number: Schema.Int,
1029
- /**
1030
- * The index of the output item in the response's output array.
1031
- */
1032
- output_index: Schema.Int,
1033
- /**
1034
- * The unique identifier of the image generation item being processed.
1035
- */
1036
- item_id: Schema.String
1037
- }) {}
1038
- /**
1039
- * Emitted when an image generation tool call is actively generating an image
1040
- * (intermediate state).
1041
- *
1042
- * @since 1.0.0
1043
- * @category Schemas
1044
- */
1045
- exports.ResponseImageGenerationCallInProgressEvent = ResponseImageGenerationCallInProgressEvent;
1046
- class ResponseImageGenerationCallGeneratingEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseImageGenerationCallGeneratingEvent")({
1047
- /**
1048
- * The type of the event. Always `"response.image_generation_call.generating"`.
1049
- */
1050
- type: /*#__PURE__*/Schema.Literal("response.image_generation_call.generating"),
1051
- /**
1052
- * The sequence number for this event.
1053
- */
1054
- sequence_number: Schema.Int,
1055
- /**
1056
- * The index of the output item in the response's output array.
1057
- */
1058
- output_index: Schema.Int,
1059
- /**
1060
- * The unique identifier of the image generation item being processed.
1061
- */
1062
- item_id: Schema.String
1063
- }) {}
1064
- /**
1065
- * Emitted when a partial image is available during image generation streaming.
1066
- *
1067
- * @since 1.0.0
1068
- * @category Schemas
1069
- */
1070
- exports.ResponseImageGenerationCallGeneratingEvent = ResponseImageGenerationCallGeneratingEvent;
1071
- class ResponseImageGenerationCallPartialImageEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseImageGenerationCallPartialImageEvent")({
1072
- /**
1073
- * The type of the event. Always `"response.image_generation_call.partial_image"`.
1074
- */
1075
- type: /*#__PURE__*/Schema.Literal("response.image_generation_call.partial_image"),
1076
- /**
1077
- * The sequence number for this event.
1078
- */
1079
- sequence_number: Schema.Int,
1080
- /**
1081
- * The index of the output item in the response's output array.
1082
- */
1083
- output_index: Schema.Int,
1084
- /**
1085
- * The unique identifier of the image generation item being processed.
1086
- */
1087
- item_id: Schema.String,
1088
- /**
1089
- * `0`-based index for the partial image (backend is `1`-based, but this is
1090
- * `0`-based for the user).
1091
- */
1092
- partial_image_index: Schema.Int,
1093
- /**
1094
- * Base64-encoded partial image data, suitable for rendering as an image.
1095
- */
1096
- partial_image_b64: Schema.String
1097
- }) {}
1098
- /**
1099
- * Emitted when an image generation tool call has completed and the final image
1100
- * is available.
1101
- *
1102
- * @since 1.0.0
1103
- * @category Schemas
1104
- */
1105
- exports.ResponseImageGenerationCallPartialImageEvent = ResponseImageGenerationCallPartialImageEvent;
1106
- class ResponseImageGenerationCallCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseImageGenerationCallCompletedEvent")({
1107
- /**
1108
- * The type of the event. Always `"response.image_generation_call.completed"`.
1109
- */
1110
- type: /*#__PURE__*/Schema.Literal("response.image_generation_call.completed"),
1111
- /**
1112
- * The sequence number for this event.
1113
- */
1114
- sequence_number: Schema.Int,
1115
- /**
1116
- * The index of the output item in the response's output array.
1117
- */
1118
- output_index: Schema.Int,
1119
- /**
1120
- * The unique identifier of the image generation item being processed.
1121
- */
1122
- item_id: Schema.String
1123
- }) {}
1124
- /**
1125
- * Emitted when there is a delta (partial update) to the arguments of an MCP
1126
- * tool call.
1127
- *
1128
- * @since 1.0.0
1129
- * @category Schemas
1130
- */
1131
- exports.ResponseImageGenerationCallCompletedEvent = ResponseImageGenerationCallCompletedEvent;
1132
- class ResponseMcpCallArgumentsDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpCallArgumentsDeltaEvent")({
1133
- /**
1134
- * The type of the event. Always `"response.mcp_call_arguments.delta"`.
1135
- */
1136
- type: /*#__PURE__*/Schema.Literal("response.mcp_call_arguments.delta"),
1137
- /**
1138
- * The sequence number for this event.
1139
- */
1140
- sequence_number: Schema.Int,
1141
- /**
1142
- * The index of the output item in the response's output array.
1143
- */
1144
- output_index: Schema.Int,
1145
- /**
1146
- * The unique identifier of the MCP tool call item being processed.
1147
- */
1148
- item_id: Schema.String,
1149
- /**
1150
- * A JSON string containing the partial update to the arguments for the MCP
1151
- * tool call.
1152
- */
1153
- delta: Schema.String
1154
- }) {}
1155
- /**
1156
- * Emitted when the arguments for an MCP tool call are finalized.
1157
- *
1158
- * @since 1.0.0
1159
- * @category Schemas
1160
- */
1161
- exports.ResponseMcpCallArgumentsDeltaEvent = ResponseMcpCallArgumentsDeltaEvent;
1162
- class ResponseMcpCallArgumentsDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpCallArgumentsDoneEvent")({
1163
- /**
1164
- * The type of the event. Always `"response.mcp_call_arguments.done"`.
1165
- */
1166
- type: /*#__PURE__*/Schema.Literal("response.mcp_call_arguments.done"),
1167
- /**
1168
- * The sequence number for this event.
1169
- */
1170
- sequence_number: Schema.Int,
1171
- /**
1172
- * The index of the output item in the response's output array.
1173
- */
1174
- output_index: Schema.Int,
1175
- /**
1176
- * The unique identifier of the MCP tool call item being processed.
1177
- */
1178
- item_id: Schema.String,
1179
- /**
1180
- * A JSON string containing the finalized arguments for the MCP tool call.
1181
- */
1182
- arguments: Schema.String
1183
- }) {}
1184
- /**
1185
- * Emitted when an MCP tool call is in progress.
1186
- *
1187
- * @since 1.0.0
1188
- * @category Schemas
1189
- */
1190
- exports.ResponseMcpCallArgumentsDoneEvent = ResponseMcpCallArgumentsDoneEvent;
1191
- class ResponseMcpCallInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpCallInProgressEvent")({
1192
- /**
1193
- * The type of the event. Always `"response.mcp_call.in_progress"`.
1194
- */
1195
- type: /*#__PURE__*/Schema.Literal("response.mcp_call.in_progress"),
1196
- /**
1197
- * The sequence number for this event.
1198
- */
1199
- sequence_number: Schema.Int,
1200
- /**
1201
- * The index of the output item in the response's output array.
1202
- */
1203
- output_index: Schema.Int,
1204
- /**
1205
- * The unique identifier of the MCP tool call item being processed.
1206
- */
1207
- item_id: Schema.String
1208
- }) {}
1209
- /**
1210
- * Emitted when an MCP tool call has completed successfully.
1211
- *
1212
- * @since 1.0.0
1213
- * @category Schemas
1214
- */
1215
- exports.ResponseMcpCallInProgressEvent = ResponseMcpCallInProgressEvent;
1216
- class ResponseMcpCallCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpCallCompletedEvent")({
1217
- /**
1218
- * The type of the event. Always `"response.mcp_call.completed"`.
1219
- */
1220
- type: /*#__PURE__*/Schema.Literal("response.mcp_call.completed"),
1221
- /**
1222
- * The sequence number for this event.
1223
- */
1224
- sequence_number: Schema.Int,
1225
- /**
1226
- * The index of the output item that completed.
1227
- */
1228
- output_index: Schema.Int,
1229
- /**
1230
- * The ID of the MCP tool call item that completed.
1231
- */
1232
- item_id: Schema.String
1233
- }) {}
1234
- /**
1235
- * Emitted when an MCP tool call has failed.
1236
- *
1237
- * @since 1.0.0
1238
- * @category Schemas
1239
- */
1240
- exports.ResponseMcpCallCompletedEvent = ResponseMcpCallCompletedEvent;
1241
- class ResponseMcpCallFailedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpCallFailedEvent")({
1242
- /**
1243
- * The type of the event. Always `"response.mcp_call.failed"`.
1244
- */
1245
- type: /*#__PURE__*/Schema.Literal("response.mcp_call.failed"),
1246
- /**
1247
- * The sequence number for this event.
1248
- */
1249
- sequence_number: Schema.Int,
1250
- /**
1251
- * The index of the output item that failed.
1252
- */
1253
- output_index: Schema.Int,
1254
- /**
1255
- * The ID of the MCP tool call item that failed.
1256
- */
1257
- item_id: Schema.String
1258
- }) {}
1259
- /**
1260
- * Emitted when the system is in the process of retrieving the list of available
1261
- * MCP tools.
1262
- *
1263
- * @since 1.0.0
1264
- * @category Schemas
1265
- */
1266
- exports.ResponseMcpCallFailedEvent = ResponseMcpCallFailedEvent;
1267
- class ResponseMcpListToolsInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpListToolsInProgressEvent")({
1268
- /**
1269
- * The type of the event. Always `"response.mcp_list_tools.in_progress"`.
1270
- */
1271
- type: /*#__PURE__*/Schema.Literal("response.mcp_list_tools.in_progress"),
1272
- /**
1273
- * The sequence number for this event.
1274
- */
1275
- sequence_number: Schema.Int,
1276
- /**
1277
- * The index of the output item that is being processed.
1278
- */
1279
- output_index: Schema.Int,
1280
- /**
1281
- * The ID of the MCP tool call item that is being processed.
1282
- */
1283
- item_id: Schema.String
1284
- }) {}
1285
- /**
1286
- * Emitted when the list of available MCP tools has been successfully retrieved.
1287
- *
1288
- * @since 1.0.0
1289
- * @category Schemas
1290
- */
1291
- exports.ResponseMcpListToolsInProgressEvent = ResponseMcpListToolsInProgressEvent;
1292
- class ResponseMcpListToolsCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpListToolsCompletedEvent")({
1293
- /**
1294
- * The type of the event. Always `"response.mcp_list_tools.completed"`.
1295
- */
1296
- type: /*#__PURE__*/Schema.Literal("response.mcp_list_tools.completed"),
1297
- /**
1298
- * The sequence number for this event.
1299
- */
1300
- sequence_number: Schema.Int,
1301
- /**
1302
- * The index of the output item that was processed.
1303
- */
1304
- output_index: Schema.Int,
1305
- /**
1306
- * The ID of the MCP tool call item that produced this output.
1307
- */
1308
- item_id: Schema.String
1309
- }) {}
1310
- /**
1311
- * Emitted when the attempt to list available MCP tools has failed.
1312
- *
1313
- * @since 1.0.0
1314
- * @category Schemas
1315
- */
1316
- exports.ResponseMcpListToolsCompletedEvent = ResponseMcpListToolsCompletedEvent;
1317
- class ResponseMcpListToolsFailedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseMcpListToolsFailedEvent")({
1318
- /**
1319
- * The type of the event. Always `"response.mcp_list_tools.failed"`.
1320
- */
1321
- type: /*#__PURE__*/Schema.Literal("response.mcp_list_tools.failed"),
1322
- /**
1323
- * The sequence number for this event.
1324
- */
1325
- sequence_number: Schema.Int,
1326
- /**
1327
- * The index of the output item that failed.
1328
- */
1329
- output_index: Schema.Int,
1330
- /**
1331
- * The ID of the MCP tool call item that failed.
1332
- */
1333
- item_id: Schema.String
1334
- }) {}
1335
- /**
1336
- * Emitted when a code interpreter call is in progress.
1337
- *
1338
- * @since 1.0.0
1339
- * @category Schemas
1340
- */
1341
- exports.ResponseMcpListToolsFailedEvent = ResponseMcpListToolsFailedEvent;
1342
- class ResponseCodeInterpreterCallInProgressEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCodeInterpreterCallInProgressEvent")({
1343
- /**
1344
- * The type of the event. Always `"response.code_interpreter_call.in_progress"`.
1345
- */
1346
- type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call.in_progress"),
1347
- /**
1348
- * The sequence number for this event.
1349
- */
1350
- sequence_number: Schema.Int,
1351
- /**
1352
- * The index of the output item in the response for which the code interpreter
1353
- * call is in progress.
1354
- */
1355
- output_index: Schema.Int,
1356
- /**
1357
- * The unique identifier of the code interpreter tool call item.
1358
- */
1359
- item_id: Schema.String
1360
- }) {}
1361
- /**
1362
- * Emitted when the code interpreter is actively interpreting the code snippet.
1363
- *
1364
- * @since 1.0.0
1365
- * @category Schemas
1366
- */
1367
- exports.ResponseCodeInterpreterCallInProgressEvent = ResponseCodeInterpreterCallInProgressEvent;
1368
- class ResponseCodeInterpreterCallInterpretingEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCodeInterpreterCallInterpretingEvent")({
1369
- /**
1370
- * The type of the event. Always `"response.code_interpreter_call.interpreting"`.
1371
- */
1372
- type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call.interpreting"),
1373
- /**
1374
- * The sequence number for this event.
1375
- */
1376
- sequence_number: Schema.Int,
1377
- /**
1378
- * The index of the output item in the response for which the code
1379
- * interpreter is interpreting code.
1380
- */
1381
- output_index: Schema.Int,
1382
- /**
1383
- * The unique identifier of the code interpreter tool call item.
1384
- */
1385
- item_id: Schema.String
1386
- }) {}
1387
- /**
1388
- * Emitted when the code interpreter call is completed.
1389
- *
1390
- * @since 1.0.0
1391
- * @category Schemas
1392
- */
1393
- exports.ResponseCodeInterpreterCallInterpretingEvent = ResponseCodeInterpreterCallInterpretingEvent;
1394
- class ResponseCodeInterpreterCallCompletedEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCodeInterpreterCallCompletedEvent")({
1395
- /**
1396
- * The type of the event. Always `"response.code_interpreter_call.completed"`.
1397
- */
1398
- type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call.completed"),
1399
- /**
1400
- * The sequence number for this event.
1401
- */
1402
- sequence_number: Schema.Int,
1403
- /**
1404
- * The index of the output item in the response for which the code interpreter
1405
- * call is completed.
1406
- */
1407
- output_index: Schema.Int,
1408
- /**
1409
- * The unique identifier of the code interpreter tool call item.
1410
- */
1411
- item_id: Schema.String
1412
- }) {}
1413
- /**
1414
- * Emitted when a partial code snippet is streamed by the code interpreter.
1415
- *
1416
- * @since 1.0.0
1417
- * @category Schemas
1418
- */
1419
- exports.ResponseCodeInterpreterCallCompletedEvent = ResponseCodeInterpreterCallCompletedEvent;
1420
- class ResponseCodeInterpreterCallCodeDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCodeInterpreterCallCodeDeltaEvent")({
1421
- /**
1422
- * The type of the event. Always `"response.code_interpreter_call_code.delta"`.
1423
- */
1424
- type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call_code.delta"),
1425
- /**
1426
- * The sequence number for this event.
1427
- */
1428
- sequence_number: Schema.Int,
1429
- /**
1430
- * The index of the output item in the response for which the code is being
1431
- * streamed.
1432
- */
1433
- output_index: Schema.Int,
1434
- /**
1435
- * The unique identifier of the code interpreter tool call item.
1436
- */
1437
- item_id: Schema.String,
1438
- /**
1439
- * The partial code snippet being streamed by the code interpreter.
1440
- */
1441
- delta: Schema.String
1442
- }) {}
1443
- /**
1444
- * Emitted when the code snippet is finalized by the code interpreter.
1445
- *
1446
- * @since 1.0.0
1447
- * @category Schemas
1448
- */
1449
- exports.ResponseCodeInterpreterCallCodeDeltaEvent = ResponseCodeInterpreterCallCodeDeltaEvent;
1450
- class ResponseCodeInterpreterCallCodeDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCodeInterpreterCallCodeDoneEvent")({
1451
- /**
1452
- * The type of the event. Always `"response.code_interpreter_call_code.done"`.
1453
- */
1454
- type: /*#__PURE__*/Schema.Literal("response.code_interpreter_call_code.done"),
1455
- /**
1456
- * The sequence number for this event.
1457
- */
1458
- sequence_number: Schema.Int,
1459
- /**
1460
- * The index of the output item in the response for which the code is finalized.
1461
- */
1462
- output_index: Schema.Int,
1463
- /**
1464
- * The unique identifier of the code interpreter tool call item.
1465
- */
1466
- item_id: Schema.String,
1467
- /**
1468
- * The final code snippet output by the code interpreter.
1469
- */
1470
- code: Schema.String
1471
- }) {}
1472
- /**
1473
- * Event representing a delta (partial update) to the input of a custom tool call.
1474
- *
1475
- * @since 1.0.0
1476
- * @category Schemas
1477
- */
1478
- exports.ResponseCodeInterpreterCallCodeDoneEvent = ResponseCodeInterpreterCallCodeDoneEvent;
1479
- class ResponseCustomToolCallInputDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCustomToolCallInputDeltaEvent")({
1480
- /**
1481
- * The type of the event. Always `"response.custom_tool_call_input.delta"`.
1482
- */
1483
- type: /*#__PURE__*/Schema.Literal("response.custom_tool_call_input.delta"),
1484
- /**
1485
- * The sequence number for this event.
1486
- */
1487
- sequence_number: Schema.Int,
1488
- /**
1489
- * The index of the output this delta applies to.
1490
- */
1491
- output_index: Schema.Int,
1492
- /**
1493
- * Unique identifier for the API item associated with this event.
1494
- */
1495
- item_id: Schema.String,
1496
- /**
1497
- * The incremental input data (delta) for the custom tool call.
1498
- */
1499
- delta: Schema.String
1500
- }) {}
1501
- /**
1502
- * Event indicating that input for a custom tool call is complete.
1503
- *
1504
- * @since 1.0.0
1505
- * @category Schemas
1506
- */
1507
- exports.ResponseCustomToolCallInputDeltaEvent = ResponseCustomToolCallInputDeltaEvent;
1508
- class ResponseCustomToolCallInputDoneEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseCustomToolCallInputDoneEvent")({
1509
- /**
1510
- * The type of the event. Always `"response.custom_tool_call_input.done"`.
1511
- */
1512
- type: /*#__PURE__*/Schema.Literal("response.custom_tool_call_input.done"),
1513
- /**
1514
- * The sequence number for this event.
1515
- */
1516
- sequence_number: Schema.Int,
1517
- /**
1518
- * The index of the output this event applies to.
1519
- */
1520
- output_index: Schema.Int,
1521
- /**
1522
- * Unique identifier for the API item associated with this event.
1523
- */
1524
- item_id: Schema.String,
1525
- /**
1526
- * The complete input data for the custom tool call.
1527
- */
1528
- input: Schema.String
1529
- }) {}
1530
- /**
1531
- * Emitted when an error occurs.
1532
- *
1533
- * @since 1.0.0
1534
- * @category Schemas
1535
- */
1536
- exports.ResponseCustomToolCallInputDoneEvent = ResponseCustomToolCallInputDoneEvent;
1537
- class ResponseErrorEvent extends /*#__PURE__*/Schema.Class("@effect/ai-openai/ResponseErrorEvent")({
1538
- /**
1539
- * The type of the event. Always `"error"`.
1540
- */
1541
- type: /*#__PURE__*/Schema.Literal("error"),
1542
- /**
1543
- * The sequence number for this event.
1544
- */
1545
- sequence_number: Schema.Int,
1546
- /**
1547
- * The error code.
1548
- */
1549
- code: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(Schema.String)),
1550
- /**
1551
- * The error message.
1552
- */
1553
- message: Schema.String,
1554
- /**
1555
- * The error parameter.
1556
- */
1557
- param: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(Schema.String))
1558
- }) {}
1559
- /**
1560
- * Represents the events that can be emitted during a streaming response.
1561
- *
1562
- * @since 1.0.0
1563
- * @category Schemas
1564
- */
1565
- exports.ResponseErrorEvent = ResponseErrorEvent;
1566
- const ResponseStreamEvent = exports.ResponseStreamEvent = /*#__PURE__*/Schema.Union(ResponseCreatedEvent, ResponseQueuedEvent, ResponseInProgressEvent, ResponseCompletedEvent, ResponseIncompleteEvent, ResponseFailedEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseContentPartAddedEvent, ResponseContentPartDoneEvent, ResponseOutputTextDeltaEvent, ResponseOutputTextDoneEvent, ResponseOutputTextAnnotationAddedEvent, ResponseRefusalDeltaEvent, ResponseRefusalDoneEvent, ResponseFunctionCallArgumentsDeltaEvent, ResponseFunctionCallArgumentsDoneEvent, ResponseFileSearchCallInProgressEvent, ResponseFileSearchCallSearchingEvent, ResponseFileSearchCallCompletedEvent, ResponseWebSearchCallInProgressEvent, ResponseWebSearchCallSearchingEvent, ResponseWebSearchCallCompletedEvent, ResponseReasoningSummaryPartAddedEvent, ResponseReasoningSummaryPartDoneEvent, ResponseReasoningSummaryTextDeltaEvent, ResponseReasoningSummaryTextDoneEvent, ResponseReasoningTextDeltaEvent, ResponseReasoningTextDoneEvent, ResponseImageGenerationCallInProgressEvent, ResponseImageGenerationCallGeneratingEvent, ResponseImageGenerationCallPartialImageEvent, ResponseImageGenerationCallCompletedEvent, ResponseMcpCallArgumentsDeltaEvent, ResponseMcpCallArgumentsDoneEvent, ResponseMcpCallInProgressEvent, ResponseMcpCallCompletedEvent, ResponseMcpCallFailedEvent, ResponseMcpListToolsInProgressEvent, ResponseMcpListToolsCompletedEvent, ResponseMcpListToolsFailedEvent, ResponseCodeInterpreterCallInProgressEvent, ResponseCodeInterpreterCallInterpretingEvent, ResponseCodeInterpreterCallCompletedEvent, ResponseCodeInterpreterCallCodeDeltaEvent, ResponseCodeInterpreterCallCodeDoneEvent, ResponseCustomToolCallInputDeltaEvent, ResponseCustomToolCallInputDoneEvent, ResponseErrorEvent);
1567
- //# sourceMappingURL=OpenAiClient.js.map