@effect/ai-openai 4.0.0-beta.65 → 4.0.0-beta.67
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/Generated.d.ts +1 -1
- package/dist/Generated.js +1 -1
- package/dist/OpenAiClient.d.ts +18 -11
- package/dist/OpenAiClient.d.ts.map +1 -1
- package/dist/OpenAiClient.js +11 -9
- package/dist/OpenAiClient.js.map +1 -1
- package/dist/OpenAiClientGenerated.d.ts +5 -5
- package/dist/OpenAiClientGenerated.js +5 -5
- package/dist/OpenAiConfig.d.ts +43 -8
- package/dist/OpenAiConfig.d.ts.map +1 -1
- package/dist/OpenAiConfig.js +28 -4
- package/dist/OpenAiConfig.js.map +1 -1
- package/dist/OpenAiEmbeddingModel.d.ts +13 -9
- package/dist/OpenAiEmbeddingModel.d.ts.map +1 -1
- package/dist/OpenAiEmbeddingModel.js +8 -6
- package/dist/OpenAiEmbeddingModel.js.map +1 -1
- package/dist/OpenAiError.d.ts +124 -3
- package/dist/OpenAiError.d.ts.map +1 -1
- package/dist/OpenAiError.js +1 -1
- package/dist/OpenAiLanguageModel.d.ts +161 -10
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js +9 -7
- package/dist/OpenAiLanguageModel.js.map +1 -1
- package/dist/OpenAiSchema.d.ts +108 -35
- package/dist/OpenAiSchema.d.ts.map +1 -1
- package/dist/OpenAiSchema.js +55 -18
- package/dist/OpenAiSchema.js.map +1 -1
- package/dist/OpenAiTelemetry.d.ts +13 -10
- package/dist/OpenAiTelemetry.d.ts.map +1 -1
- package/dist/OpenAiTelemetry.js +2 -2
- package/dist/OpenAiTelemetry.js.map +1 -1
- package/dist/OpenAiTool.d.ts +26 -26
- package/dist/OpenAiTool.js +10 -10
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -11
- package/package.json +3 -3
- package/src/Generated.ts +1 -1
- package/src/OpenAiClient.ts +20 -13
- package/src/OpenAiClientGenerated.ts +6 -6
- package/src/OpenAiConfig.ts +43 -8
- package/src/OpenAiEmbeddingModel.ts +15 -11
- package/src/OpenAiError.ts +124 -3
- package/src/OpenAiLanguageModel.ts +163 -12
- package/src/OpenAiSchema.ts +109 -36
- package/src/OpenAiTelemetry.ts +14 -11
- package/src/OpenAiTool.ts +11 -11
- package/src/index.ts +11 -11
package/src/OpenAiSchema.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Minimal local OpenAI schemas used by the handwritten Responses client path.
|
|
3
3
|
*
|
|
4
|
-
* @since
|
|
4
|
+
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
6
|
import * as Predicate from "effect/Predicate"
|
|
7
7
|
import * as Schema from "effect/Schema"
|
|
@@ -15,7 +15,12 @@ const MessageRole = Schema.Literals(["system", "developer", "user", "assistant"]
|
|
|
15
15
|
const ImageDetail = Schema.Literals(["low", "high", "auto"])
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Schema for optional `include` values on OpenAI Responses requests.
|
|
19
|
+
*
|
|
20
|
+
* **Details**
|
|
21
|
+
* These values request additional response fields such as image URLs, encrypted reasoning content, output logprobs, code interpreter outputs, or web search sources.
|
|
22
|
+
*
|
|
23
|
+
* @since 4.0.0
|
|
19
24
|
*/
|
|
20
25
|
export const IncludeEnum = Schema.Literals([
|
|
21
26
|
"message.input_image.image_url",
|
|
@@ -26,17 +31,23 @@ export const IncludeEnum = Schema.Literals([
|
|
|
26
31
|
])
|
|
27
32
|
|
|
28
33
|
/**
|
|
29
|
-
*
|
|
34
|
+
* Type of optional `include` values accepted by OpenAI Responses requests.
|
|
35
|
+
*
|
|
36
|
+
* @since 4.0.0
|
|
30
37
|
*/
|
|
31
38
|
export type IncludeEnum = typeof IncludeEnum.Type
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
|
-
*
|
|
41
|
+
* Schema for lifecycle statuses shared by messages, reasoning items, and tool calls.
|
|
42
|
+
*
|
|
43
|
+
* @since 4.0.0
|
|
35
44
|
*/
|
|
36
45
|
export const MessageStatus = Schema.Literals(["in_progress", "completed", "incomplete"])
|
|
37
46
|
|
|
38
47
|
/**
|
|
39
|
-
*
|
|
48
|
+
* Lifecycle status shared by messages, reasoning items, and tool calls.
|
|
49
|
+
*
|
|
50
|
+
* @since 4.0.0
|
|
40
51
|
*/
|
|
41
52
|
export type MessageStatus = typeof MessageStatus.Type
|
|
42
53
|
|
|
@@ -61,7 +72,9 @@ const InputFileContent = Schema.Struct({
|
|
|
61
72
|
})
|
|
62
73
|
|
|
63
74
|
/**
|
|
64
|
-
*
|
|
75
|
+
* Schema for content blocks accepted in OpenAI Responses input messages.
|
|
76
|
+
*
|
|
77
|
+
* @since 4.0.0
|
|
65
78
|
*/
|
|
66
79
|
export const InputContent = Schema.Union([
|
|
67
80
|
InputTextContent,
|
|
@@ -70,12 +83,16 @@ export const InputContent = Schema.Union([
|
|
|
70
83
|
])
|
|
71
84
|
|
|
72
85
|
/**
|
|
73
|
-
*
|
|
86
|
+
* Content block accepted in OpenAI Responses input messages.
|
|
87
|
+
*
|
|
88
|
+
* @since 4.0.0
|
|
74
89
|
*/
|
|
75
90
|
export type InputContent = typeof InputContent.Type
|
|
76
91
|
|
|
77
92
|
/**
|
|
78
|
-
*
|
|
93
|
+
* Schema for a text block containing a model-provided reasoning summary.
|
|
94
|
+
*
|
|
95
|
+
* @since 4.0.0
|
|
79
96
|
*/
|
|
80
97
|
export const SummaryTextContent = Schema.Struct({
|
|
81
98
|
type: Schema.Literal("summary_text"),
|
|
@@ -83,7 +100,9 @@ export const SummaryTextContent = Schema.Struct({
|
|
|
83
100
|
})
|
|
84
101
|
|
|
85
102
|
/**
|
|
86
|
-
*
|
|
103
|
+
* Text content block used for model-provided reasoning summaries.
|
|
104
|
+
*
|
|
105
|
+
* @since 4.0.0
|
|
87
106
|
*/
|
|
88
107
|
export type SummaryTextContent = typeof SummaryTextContent.Type
|
|
89
108
|
|
|
@@ -139,7 +158,9 @@ const FilePathAnnotation = Schema.Struct({
|
|
|
139
158
|
})
|
|
140
159
|
|
|
141
160
|
/**
|
|
142
|
-
*
|
|
161
|
+
* Schema for citation and file-path annotations attached to output text content.
|
|
162
|
+
*
|
|
163
|
+
* @since 4.0.0
|
|
143
164
|
*/
|
|
144
165
|
export const Annotation = Schema.Union([
|
|
145
166
|
FileCitationAnnotation,
|
|
@@ -149,7 +170,9 @@ export const Annotation = Schema.Union([
|
|
|
149
170
|
])
|
|
150
171
|
|
|
151
172
|
/**
|
|
152
|
-
*
|
|
173
|
+
* Citation or file-path annotation attached to output text content.
|
|
174
|
+
*
|
|
175
|
+
* @since 4.0.0
|
|
153
176
|
*/
|
|
154
177
|
export type Annotation = typeof Annotation.Type
|
|
155
178
|
|
|
@@ -181,7 +204,9 @@ const OutputMessage = Schema.Struct({
|
|
|
181
204
|
})
|
|
182
205
|
|
|
183
206
|
/**
|
|
184
|
-
*
|
|
207
|
+
* Schema for a reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
208
|
+
*
|
|
209
|
+
* @since 4.0.0
|
|
185
210
|
*/
|
|
186
211
|
export const ReasoningItem = Schema.Struct({
|
|
187
212
|
type: Schema.Literal("reasoning"),
|
|
@@ -193,7 +218,9 @@ export const ReasoningItem = Schema.Struct({
|
|
|
193
218
|
})
|
|
194
219
|
|
|
195
220
|
/**
|
|
196
|
-
*
|
|
221
|
+
* Reasoning output item containing encrypted content, summaries, and optional reasoning text.
|
|
222
|
+
*
|
|
223
|
+
* @since 4.0.0
|
|
197
224
|
*/
|
|
198
225
|
export type ReasoningItem = typeof ReasoningItem.Type
|
|
199
226
|
|
|
@@ -279,7 +306,9 @@ const RequestMessageItem = Schema.Struct({
|
|
|
279
306
|
})
|
|
280
307
|
|
|
281
308
|
/**
|
|
282
|
-
*
|
|
309
|
+
* Schema for item shapes accepted by an OpenAI Responses request `input` field.
|
|
310
|
+
*
|
|
311
|
+
* @since 4.0.0
|
|
283
312
|
*/
|
|
284
313
|
export const InputItem = Schema.Union([
|
|
285
314
|
RequestMessageItem,
|
|
@@ -297,7 +326,9 @@ export const InputItem = Schema.Union([
|
|
|
297
326
|
])
|
|
298
327
|
|
|
299
328
|
/**
|
|
300
|
-
*
|
|
329
|
+
* Item shape accepted by an OpenAI Responses request `input` field.
|
|
330
|
+
*
|
|
331
|
+
* @since 4.0.0
|
|
301
332
|
*/
|
|
302
333
|
export type InputItem = typeof InputItem.Type
|
|
303
334
|
|
|
@@ -334,7 +365,9 @@ const ProviderDefinedTool = Schema.StructWithRest(
|
|
|
334
365
|
)
|
|
335
366
|
|
|
336
367
|
/**
|
|
337
|
-
*
|
|
368
|
+
* Schema for tool definitions that can be supplied to an OpenAI Responses request.
|
|
369
|
+
*
|
|
370
|
+
* @since 4.0.0
|
|
338
371
|
*/
|
|
339
372
|
export const Tool = Schema.Union([
|
|
340
373
|
FunctionTool,
|
|
@@ -343,12 +376,16 @@ export const Tool = Schema.Union([
|
|
|
343
376
|
])
|
|
344
377
|
|
|
345
378
|
/**
|
|
346
|
-
*
|
|
379
|
+
* Tool definition that can be supplied to an OpenAI Responses request.
|
|
380
|
+
*
|
|
381
|
+
* @since 4.0.0
|
|
347
382
|
*/
|
|
348
383
|
export type Tool = typeof Tool.Type
|
|
349
384
|
|
|
350
385
|
/**
|
|
351
|
-
*
|
|
386
|
+
* Schema for selecting whether and which tools the model may call in a Responses request.
|
|
387
|
+
*
|
|
388
|
+
* @since 4.0.0
|
|
352
389
|
*/
|
|
353
390
|
export const ToolChoice = Schema.Union([
|
|
354
391
|
Schema.Literals(["none", "auto", "required"]),
|
|
@@ -384,12 +421,16 @@ export const ToolChoice = Schema.Union([
|
|
|
384
421
|
])
|
|
385
422
|
|
|
386
423
|
/**
|
|
387
|
-
*
|
|
424
|
+
* Tool selection mode or named tool choice for a Responses request.
|
|
425
|
+
*
|
|
426
|
+
* @since 4.0.0
|
|
388
427
|
*/
|
|
389
428
|
export type ToolChoice = typeof ToolChoice.Type
|
|
390
429
|
|
|
391
430
|
/**
|
|
392
|
-
*
|
|
431
|
+
* Schema for text output format configuration, including plain text, JSON object, and JSON Schema responses.
|
|
432
|
+
*
|
|
433
|
+
* @since 4.0.0
|
|
393
434
|
*/
|
|
394
435
|
export const TextResponseFormatConfiguration = Schema.Union([
|
|
395
436
|
Schema.Struct({ type: Schema.Literal("text") }),
|
|
@@ -404,12 +445,16 @@ export const TextResponseFormatConfiguration = Schema.Union([
|
|
|
404
445
|
])
|
|
405
446
|
|
|
406
447
|
/**
|
|
407
|
-
*
|
|
448
|
+
* Text output format configuration for plain text, JSON object, or JSON Schema responses.
|
|
449
|
+
*
|
|
450
|
+
* @since 4.0.0
|
|
408
451
|
*/
|
|
409
452
|
export type TextResponseFormatConfiguration = typeof TextResponseFormatConfiguration.Type
|
|
410
453
|
|
|
411
454
|
/**
|
|
412
|
-
*
|
|
455
|
+
* Schema for request options used to create an OpenAI Responses API response.
|
|
456
|
+
*
|
|
457
|
+
* @since 4.0.0
|
|
413
458
|
*/
|
|
414
459
|
export const CreateResponse = Schema.Struct({
|
|
415
460
|
metadata: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
@@ -454,12 +499,16 @@ export const CreateResponse = Schema.Struct({
|
|
|
454
499
|
})
|
|
455
500
|
|
|
456
501
|
/**
|
|
457
|
-
*
|
|
502
|
+
* Request options used to create an OpenAI Responses API response.
|
|
503
|
+
*
|
|
504
|
+
* @since 4.0.0
|
|
458
505
|
*/
|
|
459
506
|
export type CreateResponse = typeof CreateResponse.Type
|
|
460
507
|
|
|
461
508
|
/**
|
|
462
|
-
*
|
|
509
|
+
* Schema for token accounting reported on OpenAI Responses API response objects.
|
|
510
|
+
*
|
|
511
|
+
* @since 4.0.0
|
|
463
512
|
*/
|
|
464
513
|
export const ResponseUsage = Schema.StructWithRest(
|
|
465
514
|
Schema.Struct({
|
|
@@ -473,7 +522,9 @@ export const ResponseUsage = Schema.StructWithRest(
|
|
|
473
522
|
)
|
|
474
523
|
|
|
475
524
|
/**
|
|
476
|
-
*
|
|
525
|
+
* Token accounting reported on OpenAI Responses API response objects.
|
|
526
|
+
*
|
|
527
|
+
* @since 4.0.0
|
|
477
528
|
*/
|
|
478
529
|
export type ResponseUsage = typeof ResponseUsage.Type
|
|
479
530
|
|
|
@@ -570,7 +621,9 @@ const OutputItem = Schema.Union([
|
|
|
570
621
|
])
|
|
571
622
|
|
|
572
623
|
/**
|
|
573
|
-
*
|
|
624
|
+
* Schema for an OpenAI Responses API response object.
|
|
625
|
+
*
|
|
626
|
+
* @since 4.0.0
|
|
574
627
|
*/
|
|
575
628
|
export const Response = Schema.Struct({
|
|
576
629
|
id: Schema.String,
|
|
@@ -590,7 +643,9 @@ export const Response = Schema.Struct({
|
|
|
590
643
|
})
|
|
591
644
|
|
|
592
645
|
/**
|
|
593
|
-
*
|
|
646
|
+
* OpenAI Responses API response object.
|
|
647
|
+
*
|
|
648
|
+
* @since 4.0.0
|
|
594
649
|
*/
|
|
595
650
|
export type Response = typeof Response.Type
|
|
596
651
|
|
|
@@ -767,7 +822,9 @@ const knownResponseStreamEventTypes = new Set([
|
|
|
767
822
|
])
|
|
768
823
|
|
|
769
824
|
/**
|
|
770
|
-
*
|
|
825
|
+
* Fallback event shape for future or provider-specific response stream events.
|
|
826
|
+
*
|
|
827
|
+
* @since 4.0.0
|
|
771
828
|
*/
|
|
772
829
|
export type UnknownResponseStreamEvent = {
|
|
773
830
|
readonly type: string
|
|
@@ -786,7 +843,9 @@ const UnknownResponseStreamEvent = Schema.declare<UnknownResponseStreamEvent>(
|
|
|
786
843
|
)
|
|
787
844
|
|
|
788
845
|
/**
|
|
789
|
-
*
|
|
846
|
+
* Schema for server-sent event shapes emitted by OpenAI Responses API streams.
|
|
847
|
+
*
|
|
848
|
+
* @since 4.0.0
|
|
790
849
|
*/
|
|
791
850
|
export const ResponseStreamEvent = Schema.Union([
|
|
792
851
|
ResponseCreatedEvent,
|
|
@@ -812,12 +871,16 @@ export const ResponseStreamEvent = Schema.Union([
|
|
|
812
871
|
])
|
|
813
872
|
|
|
814
873
|
/**
|
|
815
|
-
*
|
|
874
|
+
* Server-sent event shape emitted by OpenAI Responses API streams.
|
|
875
|
+
*
|
|
876
|
+
* @since 4.0.0
|
|
816
877
|
*/
|
|
817
878
|
export type ResponseStreamEvent = typeof ResponseStreamEvent.Type
|
|
818
879
|
|
|
819
880
|
/**
|
|
820
|
-
*
|
|
881
|
+
* Schema for one embedding item returned by the OpenAI embeddings API.
|
|
882
|
+
*
|
|
883
|
+
* @since 4.0.0
|
|
821
884
|
*/
|
|
822
885
|
export const Embedding = Schema.Struct({
|
|
823
886
|
embedding: Schema.Union([
|
|
@@ -829,12 +892,16 @@ export const Embedding = Schema.Struct({
|
|
|
829
892
|
})
|
|
830
893
|
|
|
831
894
|
/**
|
|
832
|
-
*
|
|
895
|
+
* One embedding item returned by the OpenAI embeddings API.
|
|
896
|
+
*
|
|
897
|
+
* @since 4.0.0
|
|
833
898
|
*/
|
|
834
899
|
export type Embedding = typeof Embedding.Type
|
|
835
900
|
|
|
836
901
|
/**
|
|
837
|
-
*
|
|
902
|
+
* Schema for the request payload sent to the OpenAI embeddings endpoint.
|
|
903
|
+
*
|
|
904
|
+
* @since 4.0.0
|
|
838
905
|
*/
|
|
839
906
|
export const CreateEmbeddingRequest = Schema.Struct({
|
|
840
907
|
input: Schema.Union([
|
|
@@ -850,12 +917,16 @@ export const CreateEmbeddingRequest = Schema.Struct({
|
|
|
850
917
|
})
|
|
851
918
|
|
|
852
919
|
/**
|
|
853
|
-
*
|
|
920
|
+
* Request payload sent to the OpenAI embeddings endpoint.
|
|
921
|
+
*
|
|
922
|
+
* @since 4.0.0
|
|
854
923
|
*/
|
|
855
924
|
export type CreateEmbeddingRequest = typeof CreateEmbeddingRequest.Type
|
|
856
925
|
|
|
857
926
|
/**
|
|
858
|
-
*
|
|
927
|
+
* Schema for a successful response payload returned by the OpenAI embeddings endpoint.
|
|
928
|
+
*
|
|
929
|
+
* @since 4.0.0
|
|
859
930
|
*/
|
|
860
931
|
export const CreateEmbeddingResponse = Schema.Struct({
|
|
861
932
|
data: Schema.Array(Embedding),
|
|
@@ -870,6 +941,8 @@ export const CreateEmbeddingResponse = Schema.Struct({
|
|
|
870
941
|
})
|
|
871
942
|
|
|
872
943
|
/**
|
|
873
|
-
*
|
|
944
|
+
* Successful response payload returned by the OpenAI embeddings endpoint.
|
|
945
|
+
*
|
|
946
|
+
* @since 4.0.0
|
|
874
947
|
*/
|
|
875
948
|
export type CreateEmbeddingResponse = typeof CreateEmbeddingResponse.Type
|
package/src/OpenAiTelemetry.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* semantic conventions, extending the base GenAI attributes with OpenAI-specific
|
|
6
6
|
* request and response metadata.
|
|
7
7
|
*
|
|
8
|
-
* @since
|
|
8
|
+
* @since 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
import { dual } from "effect/Function"
|
|
11
11
|
import * as String from "effect/String"
|
|
@@ -19,8 +19,8 @@ import * as Telemetry from "effect/unstable/ai/Telemetry"
|
|
|
19
19
|
*
|
|
20
20
|
* {@see https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/}
|
|
21
21
|
*
|
|
22
|
-
* @since 1.0.0
|
|
23
22
|
* @category models
|
|
23
|
+
* @since 4.0.0
|
|
24
24
|
*/
|
|
25
25
|
export type OpenAiTelemetryAttributes = Simplify<
|
|
26
26
|
& Telemetry.GenAITelemetryAttributes
|
|
@@ -32,8 +32,8 @@ export type OpenAiTelemetryAttributes = Simplify<
|
|
|
32
32
|
* All telemetry attributes which are part of the GenAI specification,
|
|
33
33
|
* including the OpenAi-specific attributes.
|
|
34
34
|
*
|
|
35
|
-
* @since 1.0.0
|
|
36
35
|
* @category models
|
|
36
|
+
* @since 4.0.0
|
|
37
37
|
*/
|
|
38
38
|
export type AllAttributes = Telemetry.AllAttributes & RequestAttributes & ResponseAttributes
|
|
39
39
|
|
|
@@ -41,8 +41,8 @@ export type AllAttributes = Telemetry.AllAttributes & RequestAttributes & Respon
|
|
|
41
41
|
* Telemetry attributes which are part of the GenAI specification and are
|
|
42
42
|
* namespaced by `gen_ai.openai.request`.
|
|
43
43
|
*
|
|
44
|
-
* @since 1.0.0
|
|
45
44
|
* @category models
|
|
45
|
+
* @since 4.0.0
|
|
46
46
|
*/
|
|
47
47
|
export interface RequestAttributes {
|
|
48
48
|
/**
|
|
@@ -59,8 +59,8 @@ export interface RequestAttributes {
|
|
|
59
59
|
* Telemetry attributes which are part of the GenAI specification and are
|
|
60
60
|
* namespaced by `gen_ai.openai.response`.
|
|
61
61
|
*
|
|
62
|
-
* @since 1.0.0
|
|
63
62
|
* @category models
|
|
63
|
+
* @since 4.0.0
|
|
64
64
|
*/
|
|
65
65
|
export interface ResponseAttributes {
|
|
66
66
|
/**
|
|
@@ -81,8 +81,8 @@ export interface ResponseAttributes {
|
|
|
81
81
|
* If one of them applies, then the respective value **MUST** be used;
|
|
82
82
|
* otherwise, a custom value **MAY** be used.
|
|
83
83
|
*
|
|
84
|
-
* @since 1.0.0
|
|
85
84
|
* @category models
|
|
85
|
+
* @since 4.0.0
|
|
86
86
|
*/
|
|
87
87
|
export type WellKnownResponseFormat = "json_object" | "json_schema" | "text"
|
|
88
88
|
|
|
@@ -93,13 +93,16 @@ export type WellKnownResponseFormat = "json_object" | "json_schema" | "text"
|
|
|
93
93
|
* If one of them applies, then the respective value **MUST** be used;
|
|
94
94
|
* otherwise, a custom value **MAY** be used.
|
|
95
95
|
*
|
|
96
|
-
* @since 1.0.0
|
|
97
96
|
* @category models
|
|
97
|
+
* @since 4.0.0
|
|
98
98
|
*/
|
|
99
99
|
export type WellKnownServiceTier = "auto" | "default"
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Options accepted by `addGenAIAnnotations`, combining standard GenAI
|
|
103
|
+
* telemetry attributes with optional OpenAI request and response attributes.
|
|
104
|
+
*
|
|
105
|
+
* @since 4.0.0
|
|
103
106
|
* @since models
|
|
104
107
|
*/
|
|
105
108
|
export type OpenAiTelemetryAttributeOptions = Telemetry.GenAITelemetryAttributeOptions & {
|
|
@@ -122,7 +125,7 @@ const addOpenAiResponseAttributes = Telemetry.addSpanAttributes("gen_ai.openai.r
|
|
|
122
125
|
*
|
|
123
126
|
* **NOTE**: This method will mutate the `Span` **in-place**.
|
|
124
127
|
*
|
|
125
|
-
* @since
|
|
128
|
+
* @since 4.0.0
|
|
126
129
|
* @since utilities
|
|
127
130
|
*/
|
|
128
131
|
export const addGenAIAnnotations: {
|
|
@@ -132,7 +135,7 @@ export const addGenAIAnnotations: {
|
|
|
132
135
|
*
|
|
133
136
|
* **NOTE**: This method will mutate the `Span` **in-place**.
|
|
134
137
|
*
|
|
135
|
-
* @since
|
|
138
|
+
* @since 4.0.0
|
|
136
139
|
* @since utilities
|
|
137
140
|
*/
|
|
138
141
|
(options: OpenAiTelemetryAttributeOptions): (span: Span) => void
|
|
@@ -142,7 +145,7 @@ export const addGenAIAnnotations: {
|
|
|
142
145
|
*
|
|
143
146
|
* **NOTE**: This method will mutate the `Span` **in-place**.
|
|
144
147
|
*
|
|
145
|
-
* @since
|
|
148
|
+
* @since 4.0.0
|
|
146
149
|
* @since utilities
|
|
147
150
|
*/
|
|
148
151
|
(span: Span, options: OpenAiTelemetryAttributeOptions): void
|
package/src/OpenAiTool.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides tools that are natively supported by OpenAI's API, including
|
|
5
5
|
* code interpreter, file search, and web search functionality.
|
|
6
6
|
*
|
|
7
|
-
* @since
|
|
7
|
+
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
import * as Schema from "effect/Schema"
|
|
10
10
|
import * as Tool from "effect/unstable/ai/Tool"
|
|
@@ -13,8 +13,8 @@ import * as Generated from "./Generated.ts"
|
|
|
13
13
|
/**
|
|
14
14
|
* Union of all OpenAI provider-defined tools.
|
|
15
15
|
*
|
|
16
|
-
* @since 1.0.0
|
|
17
16
|
* @category models
|
|
17
|
+
* @since 4.0.0
|
|
18
18
|
*/
|
|
19
19
|
export type OpenAiTool =
|
|
20
20
|
| ReturnType<typeof ApplyPatch>
|
|
@@ -34,8 +34,8 @@ export type OpenAiTool =
|
|
|
34
34
|
* This is a local tool that runs in your environment and requires a handler
|
|
35
35
|
* to execute file operations.
|
|
36
36
|
*
|
|
37
|
-
* @since 1.0.0
|
|
38
37
|
* @category tools
|
|
38
|
+
* @since 4.0.0
|
|
39
39
|
*/
|
|
40
40
|
export const ApplyPatch = Tool.providerDefined({
|
|
41
41
|
id: "openai.apply_patch",
|
|
@@ -57,8 +57,8 @@ export const ApplyPatch = Tool.providerDefined({
|
|
|
57
57
|
*
|
|
58
58
|
* Allows the model to execute Python code in a sandboxed environment.
|
|
59
59
|
*
|
|
60
|
-
* @since 1.0.0
|
|
61
60
|
* @category tools
|
|
61
|
+
* @since 4.0.0
|
|
62
62
|
*/
|
|
63
63
|
export const CodeInterpreter = Tool.providerDefined({
|
|
64
64
|
id: "openai.code_interpreter",
|
|
@@ -81,8 +81,8 @@ export const CodeInterpreter = Tool.providerDefined({
|
|
|
81
81
|
*
|
|
82
82
|
* Enables the model to search through uploaded files and vector stores.
|
|
83
83
|
*
|
|
84
|
-
* @since 1.0.0
|
|
85
84
|
* @category tools
|
|
85
|
+
* @since 4.0.0
|
|
86
86
|
*/
|
|
87
87
|
export const FileSearch = Tool.providerDefined({
|
|
88
88
|
id: "openai.file_search",
|
|
@@ -106,8 +106,8 @@ export const FileSearch = Tool.providerDefined({
|
|
|
106
106
|
*
|
|
107
107
|
* Enables the model to generate images using the GPT image models.
|
|
108
108
|
*
|
|
109
|
-
* @since 1.0.0
|
|
110
109
|
* @category tools
|
|
110
|
+
* @since 4.0.0
|
|
111
111
|
*/
|
|
112
112
|
export const ImageGeneration = Tool.providerDefined({
|
|
113
113
|
id: "openai.image_generation",
|
|
@@ -136,8 +136,8 @@ export const ImageGeneration = Tool.providerDefined({
|
|
|
136
136
|
* Enables the model to run a command with a local shell. This is a local tool
|
|
137
137
|
* that runs in your environment and requires a handler to execute commands.
|
|
138
138
|
*
|
|
139
|
-
* @since 1.0.0
|
|
140
139
|
* @category tools
|
|
140
|
+
* @since 4.0.0
|
|
141
141
|
*/
|
|
142
142
|
export const LocalShell = Tool.providerDefined({
|
|
143
143
|
id: "openai.local_shell",
|
|
@@ -158,8 +158,8 @@ export const LocalShell = Tool.providerDefined({
|
|
|
158
158
|
* Gives the model access to additional tools via remote Model Context Protocol
|
|
159
159
|
* (MCP) servers
|
|
160
160
|
*
|
|
161
|
-
* @since 1.0.0
|
|
162
161
|
* @category tools
|
|
162
|
+
* @since 4.0.0
|
|
163
163
|
*/
|
|
164
164
|
export const Mcp = Tool.providerDefined({
|
|
165
165
|
id: "openai.mcp",
|
|
@@ -192,8 +192,8 @@ export const Mcp = Tool.providerDefined({
|
|
|
192
192
|
* environment. This is a local tool that runs in your environment and requires
|
|
193
193
|
* a handler to execute commands.
|
|
194
194
|
*
|
|
195
|
-
* @since 1.0.0
|
|
196
195
|
* @category tools
|
|
196
|
+
* @since 4.0.0
|
|
197
197
|
*/
|
|
198
198
|
export const Shell = Tool.providerDefined({
|
|
199
199
|
id: "openai.shell",
|
|
@@ -213,8 +213,8 @@ export const Shell = Tool.providerDefined({
|
|
|
213
213
|
*
|
|
214
214
|
* Enables the model to search the web for information.
|
|
215
215
|
*
|
|
216
|
-
* @since 1.0.0
|
|
217
216
|
* @category tools
|
|
217
|
+
* @since 4.0.0
|
|
218
218
|
*/
|
|
219
219
|
export const WebSearch = Tool.providerDefined({
|
|
220
220
|
id: "openai.web_search",
|
|
@@ -239,8 +239,8 @@ export const WebSearch = Tool.providerDefined({
|
|
|
239
239
|
*
|
|
240
240
|
* Preview version of the web search tool with additional features.
|
|
241
241
|
*
|
|
242
|
-
* @since 1.0.0
|
|
243
242
|
* @category tools
|
|
243
|
+
* @since 4.0.0
|
|
244
244
|
*/
|
|
245
245
|
export const WebSearchPreview = Tool.providerDefined({
|
|
246
246
|
id: "openai.web_search_preview",
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @since
|
|
2
|
+
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @since
|
|
8
|
+
* @since 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
export * as Generated from "./Generated.ts"
|
|
11
11
|
|
|
@@ -15,17 +15,17 @@ export * as Generated from "./Generated.ts"
|
|
|
15
15
|
* Provides a type-safe, Effect-based client for OpenAI operations including
|
|
16
16
|
* completions, embeddings, and streaming responses.
|
|
17
17
|
*
|
|
18
|
-
* @since
|
|
18
|
+
* @since 4.0.0
|
|
19
19
|
*/
|
|
20
20
|
export * as OpenAiClient from "./OpenAiClient.ts"
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @since
|
|
23
|
+
* @since 4.0.0
|
|
24
24
|
*/
|
|
25
25
|
export * as OpenAiClientGenerated from "./OpenAiClientGenerated.ts"
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @since
|
|
28
|
+
* @since 4.0.0
|
|
29
29
|
*/
|
|
30
30
|
export * as OpenAiConfig from "./OpenAiConfig.ts"
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@ export * as OpenAiConfig from "./OpenAiConfig.ts"
|
|
|
34
34
|
*
|
|
35
35
|
* Provides an EmbeddingModel implementation for OpenAI's embeddings API.
|
|
36
36
|
*
|
|
37
|
-
* @since
|
|
37
|
+
* @since 4.0.0
|
|
38
38
|
*/
|
|
39
39
|
export * as OpenAiEmbeddingModel from "./OpenAiEmbeddingModel.ts"
|
|
40
40
|
|
|
@@ -44,7 +44,7 @@ export * as OpenAiEmbeddingModel from "./OpenAiEmbeddingModel.ts"
|
|
|
44
44
|
* Provides OpenAI-specific metadata fields for AI error types through module
|
|
45
45
|
* augmentation, enabling typed access to OpenAI error details.
|
|
46
46
|
*
|
|
47
|
-
* @since
|
|
47
|
+
* @since 4.0.0
|
|
48
48
|
*/
|
|
49
49
|
export * as OpenAiError from "./OpenAiError.ts"
|
|
50
50
|
|
|
@@ -54,14 +54,14 @@ export * as OpenAiError from "./OpenAiError.ts"
|
|
|
54
54
|
* Provides a LanguageModel implementation for OpenAI's responses API,
|
|
55
55
|
* supporting text generation, structured output, tool calling, and streaming.
|
|
56
56
|
*
|
|
57
|
-
* @since
|
|
57
|
+
* @since 4.0.0
|
|
58
58
|
*/
|
|
59
59
|
export * as OpenAiLanguageModel from "./OpenAiLanguageModel.ts"
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Minimal local OpenAI schemas used by the handwritten Responses client path.
|
|
63
63
|
*
|
|
64
|
-
* @since
|
|
64
|
+
* @since 4.0.0
|
|
65
65
|
*/
|
|
66
66
|
export * as OpenAiSchema from "./OpenAiSchema.ts"
|
|
67
67
|
|
|
@@ -72,7 +72,7 @@ export * as OpenAiSchema from "./OpenAiSchema.ts"
|
|
|
72
72
|
* semantic conventions, extending the base GenAI attributes with OpenAI-specific
|
|
73
73
|
* request and response metadata.
|
|
74
74
|
*
|
|
75
|
-
* @since
|
|
75
|
+
* @since 4.0.0
|
|
76
76
|
*/
|
|
77
77
|
export * as OpenAiTelemetry from "./OpenAiTelemetry.ts"
|
|
78
78
|
|
|
@@ -82,6 +82,6 @@ export * as OpenAiTelemetry from "./OpenAiTelemetry.ts"
|
|
|
82
82
|
* Provides tools that are natively supported by OpenAI's API, including
|
|
83
83
|
* code interpreter, file search, and web search functionality.
|
|
84
84
|
*
|
|
85
|
-
* @since
|
|
85
|
+
* @since 4.0.0
|
|
86
86
|
*/
|
|
87
87
|
export * as OpenAiTool from "./OpenAiTool.ts"
|