@effect/ai-openai 4.0.0-beta.67 → 4.0.0-beta.68
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.
- package/dist/OpenAiClient.d.ts +1 -1
- package/dist/OpenAiClient.js +1 -1
- package/dist/OpenAiConfig.d.ts +1 -1
- package/dist/OpenAiError.d.ts +10 -10
- package/dist/OpenAiLanguageModel.d.ts +48 -0
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js.map +1 -1
- package/dist/OpenAiSchema.d.ts +35 -0
- package/dist/OpenAiSchema.d.ts.map +1 -1
- package/dist/OpenAiSchema.js +17 -0
- package/dist/OpenAiSchema.js.map +1 -1
- package/dist/OpenAiTelemetry.d.ts +4 -4
- package/dist/OpenAiTelemetry.js +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/OpenAiClient.ts +1 -1
- package/src/OpenAiConfig.ts +1 -1
- package/src/OpenAiError.ts +10 -10
- package/src/OpenAiLanguageModel.ts +48 -0
- package/src/OpenAiSchema.ts +35 -0
- package/src/OpenAiTelemetry.ts +4 -4
- package/src/index.ts +16 -0
|
@@ -112,6 +112,9 @@ export class Config extends Context.Service<
|
|
|
112
112
|
declare module "effect/unstable/ai/Prompt" {
|
|
113
113
|
/**
|
|
114
114
|
* OpenAI-specific options for file prompt parts.
|
|
115
|
+
*
|
|
116
|
+
* @category request
|
|
117
|
+
* @since 4.0.0
|
|
115
118
|
*/
|
|
116
119
|
export interface FilePartOptions extends ProviderOptions {
|
|
117
120
|
/**
|
|
@@ -127,6 +130,9 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
127
130
|
|
|
128
131
|
/**
|
|
129
132
|
* OpenAI-specific options for reasoning prompt parts.
|
|
133
|
+
*
|
|
134
|
+
* @category request
|
|
135
|
+
* @since 4.0.0
|
|
130
136
|
*/
|
|
131
137
|
export interface ReasoningPartOptions extends ProviderOptions {
|
|
132
138
|
/**
|
|
@@ -148,6 +154,9 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
148
154
|
|
|
149
155
|
/**
|
|
150
156
|
* OpenAI-specific options for assistant tool-call prompt parts.
|
|
157
|
+
*
|
|
158
|
+
* @category request
|
|
159
|
+
* @since 4.0.0
|
|
151
160
|
*/
|
|
152
161
|
export interface ToolCallPartOptions extends ProviderOptions {
|
|
153
162
|
/**
|
|
@@ -171,6 +180,9 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
171
180
|
|
|
172
181
|
/**
|
|
173
182
|
* OpenAI-specific options for tool-result prompt parts.
|
|
183
|
+
*
|
|
184
|
+
* @category request
|
|
185
|
+
* @since 4.0.0
|
|
174
186
|
*/
|
|
175
187
|
export interface ToolResultPartOptions extends ProviderOptions {
|
|
176
188
|
/**
|
|
@@ -194,6 +206,9 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
194
206
|
|
|
195
207
|
/**
|
|
196
208
|
* OpenAI-specific options for text prompt parts.
|
|
209
|
+
*
|
|
210
|
+
* @category request
|
|
211
|
+
* @since 4.0.0
|
|
197
212
|
*/
|
|
198
213
|
export interface TextPartOptions extends ProviderOptions {
|
|
199
214
|
/**
|
|
@@ -219,6 +234,9 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
219
234
|
declare module "effect/unstable/ai/Response" {
|
|
220
235
|
/**
|
|
221
236
|
* OpenAI metadata attached to a complete text response part.
|
|
237
|
+
*
|
|
238
|
+
* @category response
|
|
239
|
+
* @since 4.0.0
|
|
222
240
|
*/
|
|
223
241
|
export interface TextPartMetadata extends ProviderMetadata {
|
|
224
242
|
/**
|
|
@@ -248,6 +266,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
248
266
|
|
|
249
267
|
/**
|
|
250
268
|
* OpenAI metadata emitted when a streamed text part starts.
|
|
269
|
+
*
|
|
270
|
+
* @category response
|
|
271
|
+
* @since 4.0.0
|
|
251
272
|
*/
|
|
252
273
|
export interface TextStartPartMetadata extends ProviderMetadata {
|
|
253
274
|
/**
|
|
@@ -263,6 +284,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
263
284
|
|
|
264
285
|
/**
|
|
265
286
|
* OpenAI metadata emitted when a streamed text part ends.
|
|
287
|
+
*
|
|
288
|
+
* @category response
|
|
289
|
+
* @since 4.0.0
|
|
266
290
|
*/
|
|
267
291
|
export interface TextEndPartMetadata extends ProviderMetadata {
|
|
268
292
|
/**
|
|
@@ -282,6 +306,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
282
306
|
|
|
283
307
|
/**
|
|
284
308
|
* OpenAI metadata attached to a complete reasoning response part.
|
|
309
|
+
*
|
|
310
|
+
* @category response
|
|
311
|
+
* @since 4.0.0
|
|
285
312
|
*/
|
|
286
313
|
export interface ReasoningPartMetadata extends ProviderMetadata {
|
|
287
314
|
/**
|
|
@@ -301,6 +328,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
301
328
|
|
|
302
329
|
/**
|
|
303
330
|
* OpenAI metadata emitted when a streamed reasoning part starts.
|
|
331
|
+
*
|
|
332
|
+
* @category response
|
|
333
|
+
* @since 4.0.0
|
|
304
334
|
*/
|
|
305
335
|
export interface ReasoningStartPartMetadata extends ProviderMetadata {
|
|
306
336
|
/**
|
|
@@ -320,6 +350,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
320
350
|
|
|
321
351
|
/**
|
|
322
352
|
* OpenAI metadata emitted for a streamed reasoning delta.
|
|
353
|
+
*
|
|
354
|
+
* @category response
|
|
355
|
+
* @since 4.0.0
|
|
323
356
|
*/
|
|
324
357
|
export interface ReasoningDeltaPartMetadata extends ProviderMetadata {
|
|
325
358
|
/**
|
|
@@ -335,6 +368,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
335
368
|
|
|
336
369
|
/**
|
|
337
370
|
* OpenAI metadata emitted when a streamed reasoning part ends.
|
|
371
|
+
*
|
|
372
|
+
* @category response
|
|
373
|
+
* @since 4.0.0
|
|
338
374
|
*/
|
|
339
375
|
export interface ReasoningEndPartMetadata extends ProviderMetadata {
|
|
340
376
|
/**
|
|
@@ -354,6 +390,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
354
390
|
|
|
355
391
|
/**
|
|
356
392
|
* OpenAI metadata attached to tool-call response parts.
|
|
393
|
+
*
|
|
394
|
+
* @category response
|
|
395
|
+
* @since 4.0.0
|
|
357
396
|
*/
|
|
358
397
|
export interface ToolCallPartMetadata extends ProviderMetadata {
|
|
359
398
|
/**
|
|
@@ -369,6 +408,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
369
408
|
|
|
370
409
|
/**
|
|
371
410
|
* OpenAI metadata attached to document source citations.
|
|
411
|
+
*
|
|
412
|
+
* @category response
|
|
413
|
+
* @since 4.0.0
|
|
372
414
|
*/
|
|
373
415
|
export interface DocumentSourcePartMetadata extends ProviderMetadata {
|
|
374
416
|
/**
|
|
@@ -422,6 +464,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
422
464
|
|
|
423
465
|
/**
|
|
424
466
|
* OpenAI metadata attached to URL source citations.
|
|
467
|
+
*
|
|
468
|
+
* @category response
|
|
469
|
+
* @since 4.0.0
|
|
425
470
|
*/
|
|
426
471
|
export interface UrlSourcePartMetadata extends ProviderMetadata {
|
|
427
472
|
/**
|
|
@@ -445,6 +490,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
445
490
|
|
|
446
491
|
/**
|
|
447
492
|
* OpenAI metadata attached to finish response parts.
|
|
493
|
+
*
|
|
494
|
+
* @category response
|
|
495
|
+
* @since 4.0.0
|
|
448
496
|
*/
|
|
449
497
|
export interface FinishPartMetadata extends ProviderMetadata {
|
|
450
498
|
/**
|
package/src/OpenAiSchema.ts
CHANGED
|
@@ -20,6 +20,7 @@ const ImageDetail = Schema.Literals(["low", "high", "auto"])
|
|
|
20
20
|
* **Details**
|
|
21
21
|
* These values request additional response fields such as image URLs, encrypted reasoning content, output logprobs, code interpreter outputs, or web search sources.
|
|
22
22
|
*
|
|
23
|
+
* @category schemas
|
|
23
24
|
* @since 4.0.0
|
|
24
25
|
*/
|
|
25
26
|
export const IncludeEnum = Schema.Literals([
|
|
@@ -33,6 +34,7 @@ export const IncludeEnum = Schema.Literals([
|
|
|
33
34
|
/**
|
|
34
35
|
* Type of optional `include` values accepted by OpenAI Responses requests.
|
|
35
36
|
*
|
|
37
|
+
* @category models
|
|
36
38
|
* @since 4.0.0
|
|
37
39
|
*/
|
|
38
40
|
export type IncludeEnum = typeof IncludeEnum.Type
|
|
@@ -40,6 +42,7 @@ export type IncludeEnum = typeof IncludeEnum.Type
|
|
|
40
42
|
/**
|
|
41
43
|
* Schema for lifecycle statuses shared by messages, reasoning items, and tool calls.
|
|
42
44
|
*
|
|
45
|
+
* @category schemas
|
|
43
46
|
* @since 4.0.0
|
|
44
47
|
*/
|
|
45
48
|
export const MessageStatus = Schema.Literals(["in_progress", "completed", "incomplete"])
|
|
@@ -47,6 +50,7 @@ export const MessageStatus = Schema.Literals(["in_progress", "completed", "incom
|
|
|
47
50
|
/**
|
|
48
51
|
* Lifecycle status shared by messages, reasoning items, and tool calls.
|
|
49
52
|
*
|
|
53
|
+
* @category models
|
|
50
54
|
* @since 4.0.0
|
|
51
55
|
*/
|
|
52
56
|
export type MessageStatus = typeof MessageStatus.Type
|
|
@@ -74,6 +78,7 @@ const InputFileContent = Schema.Struct({
|
|
|
74
78
|
/**
|
|
75
79
|
* Schema for content blocks accepted in OpenAI Responses input messages.
|
|
76
80
|
*
|
|
81
|
+
* @category schemas
|
|
77
82
|
* @since 4.0.0
|
|
78
83
|
*/
|
|
79
84
|
export const InputContent = Schema.Union([
|
|
@@ -85,6 +90,7 @@ export const InputContent = Schema.Union([
|
|
|
85
90
|
/**
|
|
86
91
|
* Content block accepted in OpenAI Responses input messages.
|
|
87
92
|
*
|
|
93
|
+
* @category models
|
|
88
94
|
* @since 4.0.0
|
|
89
95
|
*/
|
|
90
96
|
export type InputContent = typeof InputContent.Type
|
|
@@ -92,6 +98,7 @@ export type InputContent = typeof InputContent.Type
|
|
|
92
98
|
/**
|
|
93
99
|
* Schema for a text block containing a model-provided reasoning summary.
|
|
94
100
|
*
|
|
101
|
+
* @category schemas
|
|
95
102
|
* @since 4.0.0
|
|
96
103
|
*/
|
|
97
104
|
export const SummaryTextContent = Schema.Struct({
|
|
@@ -102,6 +109,7 @@ export const SummaryTextContent = Schema.Struct({
|
|
|
102
109
|
/**
|
|
103
110
|
* Text content block used for model-provided reasoning summaries.
|
|
104
111
|
*
|
|
112
|
+
* @category models
|
|
105
113
|
* @since 4.0.0
|
|
106
114
|
*/
|
|
107
115
|
export type SummaryTextContent = typeof SummaryTextContent.Type
|
|
@@ -160,6 +168,7 @@ const FilePathAnnotation = Schema.Struct({
|
|
|
160
168
|
/**
|
|
161
169
|
* Schema for citation and file-path annotations attached to output text content.
|
|
162
170
|
*
|
|
171
|
+
* @category schemas
|
|
163
172
|
* @since 4.0.0
|
|
164
173
|
*/
|
|
165
174
|
export const Annotation = Schema.Union([
|
|
@@ -172,6 +181,7 @@ export const Annotation = Schema.Union([
|
|
|
172
181
|
/**
|
|
173
182
|
* Citation or file-path annotation attached to output text content.
|
|
174
183
|
*
|
|
184
|
+
* @category models
|
|
175
185
|
* @since 4.0.0
|
|
176
186
|
*/
|
|
177
187
|
export type Annotation = typeof Annotation.Type
|
|
@@ -206,6 +216,7 @@ const OutputMessage = Schema.Struct({
|
|
|
206
216
|
/**
|
|
207
217
|
* Schema for a reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
208
218
|
*
|
|
219
|
+
* @category schemas
|
|
209
220
|
* @since 4.0.0
|
|
210
221
|
*/
|
|
211
222
|
export const ReasoningItem = Schema.Struct({
|
|
@@ -220,6 +231,7 @@ export const ReasoningItem = Schema.Struct({
|
|
|
220
231
|
/**
|
|
221
232
|
* Reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
222
233
|
*
|
|
234
|
+
* @category models
|
|
223
235
|
* @since 4.0.0
|
|
224
236
|
*/
|
|
225
237
|
export type ReasoningItem = typeof ReasoningItem.Type
|
|
@@ -308,6 +320,7 @@ const RequestMessageItem = Schema.Struct({
|
|
|
308
320
|
/**
|
|
309
321
|
* Schema for item shapes accepted by an OpenAI Responses request `input` field.
|
|
310
322
|
*
|
|
323
|
+
* @category schemas
|
|
311
324
|
* @since 4.0.0
|
|
312
325
|
*/
|
|
313
326
|
export const InputItem = Schema.Union([
|
|
@@ -328,6 +341,7 @@ export const InputItem = Schema.Union([
|
|
|
328
341
|
/**
|
|
329
342
|
* Item shape accepted by an OpenAI Responses request `input` field.
|
|
330
343
|
*
|
|
344
|
+
* @category models
|
|
331
345
|
* @since 4.0.0
|
|
332
346
|
*/
|
|
333
347
|
export type InputItem = typeof InputItem.Type
|
|
@@ -367,6 +381,7 @@ const ProviderDefinedTool = Schema.StructWithRest(
|
|
|
367
381
|
/**
|
|
368
382
|
* Schema for tool definitions that can be supplied to an OpenAI Responses request.
|
|
369
383
|
*
|
|
384
|
+
* @category schemas
|
|
370
385
|
* @since 4.0.0
|
|
371
386
|
*/
|
|
372
387
|
export const Tool = Schema.Union([
|
|
@@ -378,6 +393,7 @@ export const Tool = Schema.Union([
|
|
|
378
393
|
/**
|
|
379
394
|
* Tool definition that can be supplied to an OpenAI Responses request.
|
|
380
395
|
*
|
|
396
|
+
* @category models
|
|
381
397
|
* @since 4.0.0
|
|
382
398
|
*/
|
|
383
399
|
export type Tool = typeof Tool.Type
|
|
@@ -385,6 +401,7 @@ export type Tool = typeof Tool.Type
|
|
|
385
401
|
/**
|
|
386
402
|
* Schema for selecting whether and which tools the model may call in a Responses request.
|
|
387
403
|
*
|
|
404
|
+
* @category schemas
|
|
388
405
|
* @since 4.0.0
|
|
389
406
|
*/
|
|
390
407
|
export const ToolChoice = Schema.Union([
|
|
@@ -423,6 +440,7 @@ export const ToolChoice = Schema.Union([
|
|
|
423
440
|
/**
|
|
424
441
|
* Tool selection mode or named tool choice for a Responses request.
|
|
425
442
|
*
|
|
443
|
+
* @category models
|
|
426
444
|
* @since 4.0.0
|
|
427
445
|
*/
|
|
428
446
|
export type ToolChoice = typeof ToolChoice.Type
|
|
@@ -430,6 +448,7 @@ export type ToolChoice = typeof ToolChoice.Type
|
|
|
430
448
|
/**
|
|
431
449
|
* Schema for text output format configuration, including plain text, JSON object, and JSON Schema responses.
|
|
432
450
|
*
|
|
451
|
+
* @category schemas
|
|
433
452
|
* @since 4.0.0
|
|
434
453
|
*/
|
|
435
454
|
export const TextResponseFormatConfiguration = Schema.Union([
|
|
@@ -447,6 +466,7 @@ export const TextResponseFormatConfiguration = Schema.Union([
|
|
|
447
466
|
/**
|
|
448
467
|
* Text output format configuration for plain text, JSON object, or JSON Schema responses.
|
|
449
468
|
*
|
|
469
|
+
* @category models
|
|
450
470
|
* @since 4.0.0
|
|
451
471
|
*/
|
|
452
472
|
export type TextResponseFormatConfiguration = typeof TextResponseFormatConfiguration.Type
|
|
@@ -454,6 +474,7 @@ export type TextResponseFormatConfiguration = typeof TextResponseFormatConfigura
|
|
|
454
474
|
/**
|
|
455
475
|
* Schema for request options used to create an OpenAI Responses API response.
|
|
456
476
|
*
|
|
477
|
+
* @category schemas
|
|
457
478
|
* @since 4.0.0
|
|
458
479
|
*/
|
|
459
480
|
export const CreateResponse = Schema.Struct({
|
|
@@ -501,6 +522,7 @@ export const CreateResponse = Schema.Struct({
|
|
|
501
522
|
/**
|
|
502
523
|
* Request options used to create an OpenAI Responses API response.
|
|
503
524
|
*
|
|
525
|
+
* @category models
|
|
504
526
|
* @since 4.0.0
|
|
505
527
|
*/
|
|
506
528
|
export type CreateResponse = typeof CreateResponse.Type
|
|
@@ -508,6 +530,7 @@ export type CreateResponse = typeof CreateResponse.Type
|
|
|
508
530
|
/**
|
|
509
531
|
* Schema for token accounting reported on OpenAI Responses API response objects.
|
|
510
532
|
*
|
|
533
|
+
* @category schemas
|
|
511
534
|
* @since 4.0.0
|
|
512
535
|
*/
|
|
513
536
|
export const ResponseUsage = Schema.StructWithRest(
|
|
@@ -524,6 +547,7 @@ export const ResponseUsage = Schema.StructWithRest(
|
|
|
524
547
|
/**
|
|
525
548
|
* Token accounting reported on OpenAI Responses API response objects.
|
|
526
549
|
*
|
|
550
|
+
* @category models
|
|
527
551
|
* @since 4.0.0
|
|
528
552
|
*/
|
|
529
553
|
export type ResponseUsage = typeof ResponseUsage.Type
|
|
@@ -623,6 +647,7 @@ const OutputItem = Schema.Union([
|
|
|
623
647
|
/**
|
|
624
648
|
* Schema for an OpenAI Responses API response object.
|
|
625
649
|
*
|
|
650
|
+
* @category schemas
|
|
626
651
|
* @since 4.0.0
|
|
627
652
|
*/
|
|
628
653
|
export const Response = Schema.Struct({
|
|
@@ -645,6 +670,7 @@ export const Response = Schema.Struct({
|
|
|
645
670
|
/**
|
|
646
671
|
* OpenAI Responses API response object.
|
|
647
672
|
*
|
|
673
|
+
* @category models
|
|
648
674
|
* @since 4.0.0
|
|
649
675
|
*/
|
|
650
676
|
export type Response = typeof Response.Type
|
|
@@ -824,6 +850,7 @@ const knownResponseStreamEventTypes = new Set([
|
|
|
824
850
|
/**
|
|
825
851
|
* Fallback event shape for future or provider-specific response stream events.
|
|
826
852
|
*
|
|
853
|
+
* @category models
|
|
827
854
|
* @since 4.0.0
|
|
828
855
|
*/
|
|
829
856
|
export type UnknownResponseStreamEvent = {
|
|
@@ -845,6 +872,7 @@ const UnknownResponseStreamEvent = Schema.declare<UnknownResponseStreamEvent>(
|
|
|
845
872
|
/**
|
|
846
873
|
* Schema for server-sent event shapes emitted by OpenAI Responses API streams.
|
|
847
874
|
*
|
|
875
|
+
* @category schemas
|
|
848
876
|
* @since 4.0.0
|
|
849
877
|
*/
|
|
850
878
|
export const ResponseStreamEvent = Schema.Union([
|
|
@@ -873,6 +901,7 @@ export const ResponseStreamEvent = Schema.Union([
|
|
|
873
901
|
/**
|
|
874
902
|
* Server-sent event shape emitted by OpenAI Responses API streams.
|
|
875
903
|
*
|
|
904
|
+
* @category models
|
|
876
905
|
* @since 4.0.0
|
|
877
906
|
*/
|
|
878
907
|
export type ResponseStreamEvent = typeof ResponseStreamEvent.Type
|
|
@@ -880,6 +909,7 @@ export type ResponseStreamEvent = typeof ResponseStreamEvent.Type
|
|
|
880
909
|
/**
|
|
881
910
|
* Schema for one embedding item returned by the OpenAI embeddings API.
|
|
882
911
|
*
|
|
912
|
+
* @category schemas
|
|
883
913
|
* @since 4.0.0
|
|
884
914
|
*/
|
|
885
915
|
export const Embedding = Schema.Struct({
|
|
@@ -894,6 +924,7 @@ export const Embedding = Schema.Struct({
|
|
|
894
924
|
/**
|
|
895
925
|
* One embedding item returned by the OpenAI embeddings API.
|
|
896
926
|
*
|
|
927
|
+
* @category models
|
|
897
928
|
* @since 4.0.0
|
|
898
929
|
*/
|
|
899
930
|
export type Embedding = typeof Embedding.Type
|
|
@@ -901,6 +932,7 @@ export type Embedding = typeof Embedding.Type
|
|
|
901
932
|
/**
|
|
902
933
|
* Schema for the request payload sent to the OpenAI embeddings endpoint.
|
|
903
934
|
*
|
|
935
|
+
* @category schemas
|
|
904
936
|
* @since 4.0.0
|
|
905
937
|
*/
|
|
906
938
|
export const CreateEmbeddingRequest = Schema.Struct({
|
|
@@ -919,6 +951,7 @@ export const CreateEmbeddingRequest = Schema.Struct({
|
|
|
919
951
|
/**
|
|
920
952
|
* Request payload sent to the OpenAI embeddings endpoint.
|
|
921
953
|
*
|
|
954
|
+
* @category models
|
|
922
955
|
* @since 4.0.0
|
|
923
956
|
*/
|
|
924
957
|
export type CreateEmbeddingRequest = typeof CreateEmbeddingRequest.Type
|
|
@@ -926,6 +959,7 @@ export type CreateEmbeddingRequest = typeof CreateEmbeddingRequest.Type
|
|
|
926
959
|
/**
|
|
927
960
|
* Schema for a successful response payload returned by the OpenAI embeddings endpoint.
|
|
928
961
|
*
|
|
962
|
+
* @category schemas
|
|
929
963
|
* @since 4.0.0
|
|
930
964
|
*/
|
|
931
965
|
export const CreateEmbeddingResponse = Schema.Struct({
|
|
@@ -943,6 +977,7 @@ export const CreateEmbeddingResponse = Schema.Struct({
|
|
|
943
977
|
/**
|
|
944
978
|
* Successful response payload returned by the OpenAI embeddings endpoint.
|
|
945
979
|
*
|
|
980
|
+
* @category models
|
|
946
981
|
* @since 4.0.0
|
|
947
982
|
*/
|
|
948
983
|
export type CreateEmbeddingResponse = typeof CreateEmbeddingResponse.Type
|
package/src/OpenAiTelemetry.ts
CHANGED
|
@@ -102,8 +102,8 @@ export type WellKnownServiceTier = "auto" | "default"
|
|
|
102
102
|
* Options accepted by `addGenAIAnnotations`, combining standard GenAI
|
|
103
103
|
* telemetry attributes with optional OpenAI request and response attributes.
|
|
104
104
|
*
|
|
105
|
+
* @category models
|
|
105
106
|
* @since 4.0.0
|
|
106
|
-
* @since models
|
|
107
107
|
*/
|
|
108
108
|
export type OpenAiTelemetryAttributeOptions = Telemetry.GenAITelemetryAttributeOptions & {
|
|
109
109
|
openai?: {
|
|
@@ -125,8 +125,8 @@ const addOpenAiResponseAttributes = Telemetry.addSpanAttributes("gen_ai.openai.r
|
|
|
125
125
|
*
|
|
126
126
|
* **NOTE**: This method will mutate the `Span` **in-place**.
|
|
127
127
|
*
|
|
128
|
+
* @category tracing
|
|
128
129
|
* @since 4.0.0
|
|
129
|
-
* @since utilities
|
|
130
130
|
*/
|
|
131
131
|
export const addGenAIAnnotations: {
|
|
132
132
|
/**
|
|
@@ -135,8 +135,8 @@ export const addGenAIAnnotations: {
|
|
|
135
135
|
*
|
|
136
136
|
* **NOTE**: This method will mutate the `Span` **in-place**.
|
|
137
137
|
*
|
|
138
|
+
* @category tracing
|
|
138
139
|
* @since 4.0.0
|
|
139
|
-
* @since utilities
|
|
140
140
|
*/
|
|
141
141
|
(options: OpenAiTelemetryAttributeOptions): (span: Span) => void
|
|
142
142
|
/**
|
|
@@ -145,8 +145,8 @@ export const addGenAIAnnotations: {
|
|
|
145
145
|
*
|
|
146
146
|
* **NOTE**: This method will mutate the `Span` **in-place**.
|
|
147
147
|
*
|
|
148
|
+
* @category tracing
|
|
148
149
|
* @since 4.0.0
|
|
149
|
-
* @since utilities
|
|
150
150
|
*/
|
|
151
151
|
(span: Span, options: OpenAiTelemetryAttributeOptions): void
|
|
152
152
|
} = dual(2, (span: Span, options: OpenAiTelemetryAttributeOptions) => {
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,22 @@ export * as OpenAiClient from "./OpenAiClient.ts"
|
|
|
25
25
|
export * as OpenAiClientGenerated from "./OpenAiClientGenerated.ts"
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
+
* The `OpenAiConfig` module provides contextual configuration for the
|
|
29
|
+
* `@effect/ai-openai` integration. It is used to customize how OpenAI clients
|
|
30
|
+
* are built and interpreted without threading configuration through every API
|
|
31
|
+
* call manually.
|
|
32
|
+
*
|
|
33
|
+
* The primary use case is installing an HTTP client transform with
|
|
34
|
+
* {@link withClientTransform}. This lets applications adapt the underlying
|
|
35
|
+
* OpenAI HTTP client for cross-cutting concerns such as custom middleware,
|
|
36
|
+
* instrumentation, proxying, or request policy changes while keeping the
|
|
37
|
+
* OpenAI service APIs unchanged.
|
|
38
|
+
*
|
|
39
|
+
* Configuration is scoped through Effect's context, so transforms only apply to
|
|
40
|
+
* the effect they are provided to and anything evaluated inside that scope.
|
|
41
|
+
* When multiple transforms are needed, compose them into a single
|
|
42
|
+
* `HttpClient => HttpClient` function before providing the configuration.
|
|
43
|
+
*
|
|
28
44
|
* @since 4.0.0
|
|
29
45
|
*/
|
|
30
46
|
export * as OpenAiConfig from "./OpenAiConfig.ts"
|