@effect/ai-openai 4.0.0-beta.66 → 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/Generated.d.ts +1 -1
- package/dist/Generated.js +1 -1
- package/dist/OpenAiClient.d.ts +19 -12
- 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 +208 -9
- 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 +143 -35
- package/dist/OpenAiSchema.d.ts.map +1 -1
- package/dist/OpenAiSchema.js +72 -18
- package/dist/OpenAiSchema.js.map +1 -1
- package/dist/OpenAiTelemetry.d.ts +17 -14
- package/dist/OpenAiTelemetry.d.ts.map +1 -1
- package/dist/OpenAiTelemetry.js +3 -3
- package/dist/OpenAiTelemetry.js.map +1 -1
- package/dist/OpenAiTool.d.ts +11 -11
- package/dist/OpenAiTool.js +10 -10
- package/dist/index.d.ts +27 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- 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 +211 -12
- package/src/OpenAiSchema.ts +144 -36
- package/src/OpenAiTelemetry.ts +18 -15
- package/src/OpenAiTool.ts +11 -11
- package/src/index.ts +27 -11
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides an EmbeddingModel implementation for OpenAI's embeddings API.
|
|
5
5
|
*
|
|
6
|
-
* @since
|
|
6
|
+
* @since 4.0.0
|
|
7
7
|
*/
|
|
8
8
|
import * as Context from "effect/Context";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
@@ -16,13 +16,15 @@ import { OpenAiClient } from "./OpenAiClient.js";
|
|
|
16
16
|
/**
|
|
17
17
|
* Service definition for OpenAI embedding model configuration.
|
|
18
18
|
*
|
|
19
|
-
* @since 1.0.0
|
|
20
19
|
* @category services
|
|
20
|
+
* @since 4.0.0
|
|
21
21
|
*/
|
|
22
22
|
export class Config extends /*#__PURE__*/Context.Service()("@effect/ai-openai/OpenAiEmbeddingModel/Config") {}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Creates an `AiModel` for an OpenAI embedding model with its configured vector dimensions.
|
|
25
|
+
*
|
|
25
26
|
* @category constructors
|
|
27
|
+
* @since 4.0.0
|
|
26
28
|
*/
|
|
27
29
|
export const model = (model, options) => AiModel.make("openai", model, Layer.merge(layer({
|
|
28
30
|
model,
|
|
@@ -34,8 +36,8 @@ export const model = (model, options) => AiModel.make("openai", model, Layer.mer
|
|
|
34
36
|
/**
|
|
35
37
|
* Creates an OpenAI embedding model service.
|
|
36
38
|
*
|
|
37
|
-
* @since 1.0.0
|
|
38
39
|
* @category constructors
|
|
40
|
+
* @since 4.0.0
|
|
39
41
|
*/
|
|
40
42
|
export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
|
|
41
43
|
model,
|
|
@@ -66,15 +68,15 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
|
|
|
66
68
|
/**
|
|
67
69
|
* Creates a layer for the OpenAI embedding model.
|
|
68
70
|
*
|
|
69
|
-
* @since 1.0.0
|
|
70
71
|
* @category layers
|
|
72
|
+
* @since 4.0.0
|
|
71
73
|
*/
|
|
72
74
|
export const layer = options => Layer.effect(EmbeddingModel.EmbeddingModel, make(options));
|
|
73
75
|
/**
|
|
74
76
|
* Provides config overrides for OpenAI embedding model operations.
|
|
75
77
|
*
|
|
76
|
-
* @since 1.0.0
|
|
77
78
|
* @category configuration
|
|
79
|
+
* @since 4.0.0
|
|
78
80
|
*/
|
|
79
81
|
export const withConfigOverride = /*#__PURE__*/dual(2, (self, overrides) => Effect.flatMap(Effect.serviceOption(Config), config => Effect.provideService(self, Config, {
|
|
80
82
|
...(config._tag === "Some" ? config.value : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiEmbeddingModel.js","names":["Context","Effect","dual","Layer","AiError","EmbeddingModel","AiModel","OpenAiClient","Config","Service","model","options","make","merge","layer","config","dimensions","succeed","Dimensions","fnUntraced","providerConfig","client","makeConfig","gen","services","context","mapUnsafe","get","key","embedMany","inputs","response","createEmbedding","input","mapProviderResponse","length","effect","withConfigOverride","self","overrides","flatMap","serviceOption","provideService","_tag","value","inputLength","data","fail","invalidOutput","results","Array","seen","Set","entry","Number","isInteger","index","has","isArray","embedding","add","size","usage","inputTokens","prompt_tokens","description","module","method","reason","InvalidOutputError"],"sources":["../src/OpenAiEmbeddingModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;AAOA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,OAAO,KAAKC,OAAO,MAAM,4BAA4B;AACrD,OAAO,KAAKC,cAAc,MAAM,mCAAmC;AACnE,OAAO,KAAKC,OAAO,MAAM,0BAA0B;AACnD,SAASC,YAAY,QAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"file":"OpenAiEmbeddingModel.js","names":["Context","Effect","dual","Layer","AiError","EmbeddingModel","AiModel","OpenAiClient","Config","Service","model","options","make","merge","layer","config","dimensions","succeed","Dimensions","fnUntraced","providerConfig","client","makeConfig","gen","services","context","mapUnsafe","get","key","embedMany","inputs","response","createEmbedding","input","mapProviderResponse","length","effect","withConfigOverride","self","overrides","flatMap","serviceOption","provideService","_tag","value","inputLength","data","fail","invalidOutput","results","Array","seen","Set","entry","Number","isInteger","index","has","isArray","embedding","add","size","usage","inputTokens","prompt_tokens","description","module","method","reason","InvalidOutputError"],"sources":["../src/OpenAiEmbeddingModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;AAOA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,OAAO,KAAKC,OAAO,MAAM,4BAA4B;AACrD,OAAO,KAAKC,cAAc,MAAM,mCAAmC;AACnE,OAAO,KAAKC,OAAO,MAAM,0BAA0B;AACnD,SAASC,YAAY,QAAQ,mBAAmB;AAWhD;;;;;;AAMA,OAAM,MAAOC,MAAO,sBAAQR,OAAO,CAACS,OAAO,EAaxC,CAAC,+CAA+C,CAAC;AAEpD;;;;;;AAMA,OAAO,MAAMC,KAAK,GAAGA,CACnBA,KAA4B,EAC5BC,OAGC,KAEDL,OAAO,CAACM,IAAI,CACV,QAAQ,EACRF,KAAK,EACLP,KAAK,CAACU,KAAK,CACTC,KAAK,CAAC;EACJJ,KAAK;EACLK,MAAM,EAAE;IACN,GAAGJ,OAAO,CAACI,MAAM;IACjBC,UAAU,EAAEL,OAAO,CAACK;;CAEvB,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CAAC,CAAC;IACrG;IAEAL,IAAI,CAACS,GAAG,CAACP,KAAK,CAACG,KAAK,CAAC;IACrBP,OAAO,CAACI,KAAK,CAACG,KAAK,CAAC,GAAG,CAAC,GAAGH,KAAK,CAACM,SAAS,CAAC;EAC7C;EAEA,IAAIR,IAAI,CAACU,IAAI,KAAKhB,WAAW,EAAE;IAC7B,OAAO5C,MAAM,CAAC8C,IAAI,CAChBC,aAAa,CAAC,mCAAmC,GAAGG,IAAI,CAACU,IAAI,GAAG,uBAAuB,GAAGhB,WAAW,CAAC,CACvG;EACH;EAEA,OAAO5C,MAAM,CAACgB,OAAO,CAAC;IACpBgC,OAAO;IACPa,KAAK,EAAE;MACLC,WAAW,EAAEhC,QAAQ,CAAC+B,KAAK,EAAEE;;GAEhC,CAAC;AACJ,CAAC;AAED,MAAMhB,aAAa,GAAIiB,WAAmB,IACxC7D,OAAO,CAACQ,IAAI,CAAC;EACXsD,MAAM,EAAE,sBAAsB;EAC9BC,MAAM,EAAE,WAAW;EACnBC,MAAM,EAAE,IAAIhE,OAAO,CAACiE,kBAAkB,CAAC;IAAEJ;EAAW,CAAE;CACvD,CAAC","ignoreList":[]}
|
package/dist/OpenAiError.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Provides OpenAI-specific metadata fields for AI error types through module
|
|
5
5
|
* augmentation, enabling typed access to OpenAI error details.
|
|
6
6
|
*
|
|
7
|
-
* @since
|
|
7
|
+
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* OpenAI-specific error metadata fields.
|
|
11
11
|
*
|
|
12
|
-
* @since 1.0.0
|
|
13
12
|
* @category models
|
|
13
|
+
* @since 4.0.0
|
|
14
14
|
*/
|
|
15
15
|
export type OpenAiErrorMetadata = {
|
|
16
16
|
/**
|
|
@@ -32,8 +32,8 @@ export type OpenAiErrorMetadata = {
|
|
|
32
32
|
* Extends base error metadata with rate limit specific information from
|
|
33
33
|
* OpenAI's rate limit headers.
|
|
34
34
|
*
|
|
35
|
-
* @since 1.0.0
|
|
36
35
|
* @category models
|
|
36
|
+
* @since 4.0.0
|
|
37
37
|
*/
|
|
38
38
|
export type OpenAiRateLimitMetadata = OpenAiErrorMetadata & {
|
|
39
39
|
/**
|
|
@@ -54,34 +54,155 @@ export type OpenAiRateLimitMetadata = OpenAiErrorMetadata & {
|
|
|
54
54
|
readonly resetTokens: string | null;
|
|
55
55
|
};
|
|
56
56
|
declare module "effect/unstable/ai/AiError" {
|
|
57
|
+
/**
|
|
58
|
+
* OpenAI metadata attached to `RateLimitError` values.
|
|
59
|
+
*
|
|
60
|
+
* Captures OpenAI error details together with rate limit header information
|
|
61
|
+
* from responses where the provider rejected the request because a limit was
|
|
62
|
+
* reached.
|
|
63
|
+
*
|
|
64
|
+
* @category configuration
|
|
65
|
+
* @since 4.0.0
|
|
66
|
+
*/
|
|
57
67
|
interface RateLimitErrorMetadata {
|
|
68
|
+
/**
|
|
69
|
+
* OpenAI-specific details for the rate limit response.
|
|
70
|
+
*/
|
|
58
71
|
readonly openai?: OpenAiRateLimitMetadata | null;
|
|
59
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* OpenAI metadata attached to `QuotaExhaustedError` values.
|
|
75
|
+
*
|
|
76
|
+
* Preserves provider error details for failures caused by exhausted account,
|
|
77
|
+
* billing, or usage quota.
|
|
78
|
+
*
|
|
79
|
+
* @category configuration
|
|
80
|
+
* @since 4.0.0
|
|
81
|
+
*/
|
|
60
82
|
interface QuotaExhaustedErrorMetadata {
|
|
83
|
+
/**
|
|
84
|
+
* OpenAI-specific details for the quota exhaustion response.
|
|
85
|
+
*/
|
|
61
86
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
62
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* OpenAI metadata attached to `AuthenticationError` values.
|
|
90
|
+
*
|
|
91
|
+
* Preserves provider error details for failed API key, authorization, or
|
|
92
|
+
* permission checks.
|
|
93
|
+
*
|
|
94
|
+
* @category configuration
|
|
95
|
+
* @since 4.0.0
|
|
96
|
+
*/
|
|
63
97
|
interface AuthenticationErrorMetadata {
|
|
98
|
+
/**
|
|
99
|
+
* OpenAI-specific details for the authentication failure.
|
|
100
|
+
*/
|
|
64
101
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
65
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* OpenAI metadata attached to `ContentPolicyError` values.
|
|
105
|
+
*
|
|
106
|
+
* Preserves provider error details when OpenAI rejects input or output because
|
|
107
|
+
* it violates a content policy.
|
|
108
|
+
*
|
|
109
|
+
* @category configuration
|
|
110
|
+
* @since 4.0.0
|
|
111
|
+
*/
|
|
66
112
|
interface ContentPolicyErrorMetadata {
|
|
113
|
+
/**
|
|
114
|
+
* OpenAI-specific details for the content policy response.
|
|
115
|
+
*/
|
|
67
116
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
68
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* OpenAI metadata attached to `InvalidRequestError` values.
|
|
120
|
+
*
|
|
121
|
+
* Preserves provider error details for malformed requests, unsupported
|
|
122
|
+
* parameters, or other request validation failures reported by OpenAI.
|
|
123
|
+
*
|
|
124
|
+
* @category configuration
|
|
125
|
+
* @since 4.0.0
|
|
126
|
+
*/
|
|
69
127
|
interface InvalidRequestErrorMetadata {
|
|
128
|
+
/**
|
|
129
|
+
* OpenAI-specific details for the invalid request response.
|
|
130
|
+
*/
|
|
70
131
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
71
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* OpenAI metadata attached to `InternalProviderError` values.
|
|
135
|
+
*
|
|
136
|
+
* Preserves provider error details for OpenAI-side failures such as transient
|
|
137
|
+
* server errors.
|
|
138
|
+
*
|
|
139
|
+
* @category configuration
|
|
140
|
+
* @since 4.0.0
|
|
141
|
+
*/
|
|
72
142
|
interface InternalProviderErrorMetadata {
|
|
143
|
+
/**
|
|
144
|
+
* OpenAI-specific details for the internal provider response.
|
|
145
|
+
*/
|
|
73
146
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
74
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* OpenAI metadata attached to `InvalidOutputError` values.
|
|
150
|
+
*
|
|
151
|
+
* Preserves provider error details when an OpenAI response cannot be parsed or
|
|
152
|
+
* validated as the expected output.
|
|
153
|
+
*
|
|
154
|
+
* @category configuration
|
|
155
|
+
* @since 4.0.0
|
|
156
|
+
*/
|
|
75
157
|
interface InvalidOutputErrorMetadata {
|
|
158
|
+
/**
|
|
159
|
+
* OpenAI-specific details for the invalid output response.
|
|
160
|
+
*/
|
|
76
161
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
77
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* OpenAI metadata attached to `StructuredOutputError` values.
|
|
165
|
+
*
|
|
166
|
+
* Preserves provider error details when OpenAI returns content that does not
|
|
167
|
+
* satisfy the requested structured output schema.
|
|
168
|
+
*
|
|
169
|
+
* @category configuration
|
|
170
|
+
* @since 4.0.0
|
|
171
|
+
*/
|
|
78
172
|
interface StructuredOutputErrorMetadata {
|
|
173
|
+
/**
|
|
174
|
+
* OpenAI-specific details for the structured output failure.
|
|
175
|
+
*/
|
|
79
176
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
80
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* OpenAI metadata attached to `UnsupportedSchemaError` values.
|
|
180
|
+
*
|
|
181
|
+
* Preserves provider error details when an unsupported schema failure is
|
|
182
|
+
* associated with an OpenAI response.
|
|
183
|
+
*
|
|
184
|
+
* @category configuration
|
|
185
|
+
* @since 4.0.0
|
|
186
|
+
*/
|
|
81
187
|
interface UnsupportedSchemaErrorMetadata {
|
|
188
|
+
/**
|
|
189
|
+
* OpenAI-specific details for the unsupported schema failure.
|
|
190
|
+
*/
|
|
82
191
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
83
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* OpenAI metadata attached to `UnknownError` values.
|
|
195
|
+
*
|
|
196
|
+
* Preserves provider error details for OpenAI failures that do not map cleanly
|
|
197
|
+
* to a more specific AI error category.
|
|
198
|
+
*
|
|
199
|
+
* @category configuration
|
|
200
|
+
* @since 4.0.0
|
|
201
|
+
*/
|
|
84
202
|
interface UnknownErrorMetadata {
|
|
203
|
+
/**
|
|
204
|
+
* OpenAI-specific details for the unclassified provider failure.
|
|
205
|
+
*/
|
|
85
206
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
86
207
|
}
|
|
87
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiError.d.ts","sourceRoot":"","sources":["../src/OpenAiError.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IAC1D;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED,OAAO,QAAQ,4BAA4B,CAAC;IAC1C,UAAiB,sBAAsB;QACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAA;KACjD;IAED,UAAiB,2BAA2B;QAC1C,QAAQ,CAAC,MAAM,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AQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAC7C;IAED;;;;;;;;OAQG;IACH,UAAiB,8BAA8B;QAC7C;;WAEG;QACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAC7C;IAED;;;;;;;;OAQG;IACH,UAAiB,oBAAoB;QACnC;;WAEG;QACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAC7C;CACF"}
|
package/dist/OpenAiError.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides a LanguageModel implementation for OpenAI's responses API,
|
|
5
5
|
* supporting text generation, structured output, tool calling, and streaming.
|
|
6
6
|
*
|
|
7
|
-
* @since
|
|
7
|
+
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
import * as Context from "effect/Context";
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
@@ -17,8 +17,10 @@ import type * as OpenAiSchema from "./OpenAiSchema.ts";
|
|
|
17
17
|
declare const ResponseModelIds: Schema.Literals<readonly ["o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5-codex", "gpt-5-pro", "gpt-5-pro-2025-10-06", "gpt-5.1-codex-max"]>;
|
|
18
18
|
declare const SharedModelIds: Schema.Literals<readonly ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.4-mini-2026-03-17", "gpt-5.4-nano-2026-03-17", "gpt-5.3-chat-latest", "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", "gpt-5.1-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613"]>;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* OpenAI model identifiers supported by the Responses API language model.
|
|
21
|
+
*
|
|
21
22
|
* @category models
|
|
23
|
+
* @since 4.0.0
|
|
22
24
|
*/
|
|
23
25
|
export type Model = typeof ResponseModelIds.Encoded | typeof SharedModelIds.Encoded;
|
|
24
26
|
/**
|
|
@@ -73,13 +75,22 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openai/OpenA
|
|
|
73
75
|
/**
|
|
74
76
|
* Service definition for OpenAI language model configuration.
|
|
75
77
|
*
|
|
76
|
-
* @since 1.0.0
|
|
77
78
|
* @category services
|
|
79
|
+
* @since 4.0.0
|
|
78
80
|
*/
|
|
79
81
|
export declare class Config extends Config_base {
|
|
80
82
|
}
|
|
81
83
|
declare module "effect/unstable/ai/Prompt" {
|
|
84
|
+
/**
|
|
85
|
+
* OpenAI-specific options for file prompt parts.
|
|
86
|
+
*
|
|
87
|
+
* @category request
|
|
88
|
+
* @since 4.0.0
|
|
89
|
+
*/
|
|
82
90
|
interface FilePartOptions extends ProviderOptions {
|
|
91
|
+
/**
|
|
92
|
+
* Provider-specific file options for the OpenAI Responses API.
|
|
93
|
+
*/
|
|
83
94
|
readonly openai?: {
|
|
84
95
|
/**
|
|
85
96
|
* The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
|
|
@@ -87,7 +98,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
87
98
|
readonly imageDetail?: ImageDetail | null;
|
|
88
99
|
} | null;
|
|
89
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* OpenAI-specific options for reasoning prompt parts.
|
|
103
|
+
*
|
|
104
|
+
* @category request
|
|
105
|
+
* @since 4.0.0
|
|
106
|
+
*/
|
|
90
107
|
interface ReasoningPartOptions extends ProviderOptions {
|
|
108
|
+
/**
|
|
109
|
+
* Provider-specific reasoning options for the OpenAI Responses API.
|
|
110
|
+
*/
|
|
91
111
|
readonly openai?: {
|
|
92
112
|
/**
|
|
93
113
|
* The ID of the item to reference.
|
|
@@ -101,7 +121,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
101
121
|
readonly encryptedContent?: string | null;
|
|
102
122
|
} | null;
|
|
103
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* OpenAI-specific options for assistant tool-call prompt parts.
|
|
126
|
+
*
|
|
127
|
+
* @category request
|
|
128
|
+
* @since 4.0.0
|
|
129
|
+
*/
|
|
104
130
|
interface ToolCallPartOptions extends ProviderOptions {
|
|
131
|
+
/**
|
|
132
|
+
* Provider-specific tool-call options for the OpenAI Responses API.
|
|
133
|
+
*/
|
|
105
134
|
readonly openai?: {
|
|
106
135
|
/**
|
|
107
136
|
* The ID of the item to reference.
|
|
@@ -117,7 +146,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
117
146
|
readonly approvalRequestId?: string | null;
|
|
118
147
|
} | null;
|
|
119
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* OpenAI-specific options for tool-result prompt parts.
|
|
151
|
+
*
|
|
152
|
+
* @category request
|
|
153
|
+
* @since 4.0.0
|
|
154
|
+
*/
|
|
120
155
|
interface ToolResultPartOptions extends ProviderOptions {
|
|
156
|
+
/**
|
|
157
|
+
* Provider-specific tool-result options for the OpenAI Responses API.
|
|
158
|
+
*/
|
|
121
159
|
readonly openai?: {
|
|
122
160
|
/**
|
|
123
161
|
* The ID of the item to reference.
|
|
@@ -133,7 +171,16 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
133
171
|
readonly approvalId?: string | null;
|
|
134
172
|
} | null;
|
|
135
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* OpenAI-specific options for text prompt parts.
|
|
176
|
+
*
|
|
177
|
+
* @category request
|
|
178
|
+
* @since 4.0.0
|
|
179
|
+
*/
|
|
136
180
|
interface TextPartOptions extends ProviderOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Provider-specific text options for the OpenAI Responses API.
|
|
183
|
+
*/
|
|
137
184
|
readonly openai?: {
|
|
138
185
|
/**
|
|
139
186
|
* The ID of the item to reference.
|
|
@@ -151,8 +198,20 @@ declare module "effect/unstable/ai/Prompt" {
|
|
|
151
198
|
}
|
|
152
199
|
}
|
|
153
200
|
declare module "effect/unstable/ai/Response" {
|
|
201
|
+
/**
|
|
202
|
+
* OpenAI metadata attached to a complete text response part.
|
|
203
|
+
*
|
|
204
|
+
* @category response
|
|
205
|
+
* @since 4.0.0
|
|
206
|
+
*/
|
|
154
207
|
interface TextPartMetadata extends ProviderMetadata {
|
|
208
|
+
/**
|
|
209
|
+
* Provider-specific metadata returned for the text part.
|
|
210
|
+
*/
|
|
155
211
|
readonly openai?: {
|
|
212
|
+
/**
|
|
213
|
+
* The OpenAI item ID associated with the text part.
|
|
214
|
+
*/
|
|
156
215
|
readonly itemId?: string | null;
|
|
157
216
|
/**
|
|
158
217
|
* If the model emits a refusal content part, the refusal explanation
|
|
@@ -170,47 +229,155 @@ declare module "effect/unstable/ai/Response" {
|
|
|
170
229
|
readonly annotations?: ReadonlyArray<typeof OpenAiSchema.Annotation.Encoded> | null;
|
|
171
230
|
};
|
|
172
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* OpenAI metadata emitted when a streamed text part starts.
|
|
234
|
+
*
|
|
235
|
+
* @category response
|
|
236
|
+
* @since 4.0.0
|
|
237
|
+
*/
|
|
173
238
|
interface TextStartPartMetadata extends ProviderMetadata {
|
|
239
|
+
/**
|
|
240
|
+
* Provider-specific metadata returned for the streamed text start.
|
|
241
|
+
*/
|
|
174
242
|
readonly openai?: {
|
|
243
|
+
/**
|
|
244
|
+
* The OpenAI item ID associated with the streamed text part.
|
|
245
|
+
*/
|
|
175
246
|
readonly itemId?: string | null;
|
|
176
247
|
} | null;
|
|
177
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* OpenAI metadata emitted when a streamed text part ends.
|
|
251
|
+
*
|
|
252
|
+
* @category response
|
|
253
|
+
* @since 4.0.0
|
|
254
|
+
*/
|
|
178
255
|
interface TextEndPartMetadata extends ProviderMetadata {
|
|
256
|
+
/**
|
|
257
|
+
* Provider-specific metadata returned for the streamed text end.
|
|
258
|
+
*/
|
|
179
259
|
readonly openai?: {
|
|
260
|
+
/**
|
|
261
|
+
* The OpenAI item ID associated with the streamed text part.
|
|
262
|
+
*/
|
|
180
263
|
readonly itemId?: string | null;
|
|
264
|
+
/**
|
|
265
|
+
* The annotations collected for the completed streamed text part.
|
|
266
|
+
*/
|
|
181
267
|
readonly annotations?: ReadonlyArray<typeof OpenAiSchema.Annotation.Encoded> | null;
|
|
182
268
|
} | null;
|
|
183
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* OpenAI metadata attached to a complete reasoning response part.
|
|
272
|
+
*
|
|
273
|
+
* @category response
|
|
274
|
+
* @since 4.0.0
|
|
275
|
+
*/
|
|
184
276
|
interface ReasoningPartMetadata extends ProviderMetadata {
|
|
277
|
+
/**
|
|
278
|
+
* Provider-specific metadata returned for the reasoning part.
|
|
279
|
+
*/
|
|
185
280
|
readonly openai?: {
|
|
281
|
+
/**
|
|
282
|
+
* The OpenAI item ID associated with the reasoning part.
|
|
283
|
+
*/
|
|
186
284
|
readonly itemId?: string | null;
|
|
285
|
+
/**
|
|
286
|
+
* Encrypted reasoning content that can be sent back in later requests.
|
|
287
|
+
*/
|
|
187
288
|
readonly encryptedContent?: string | null;
|
|
188
289
|
} | null;
|
|
189
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* OpenAI metadata emitted when a streamed reasoning part starts.
|
|
293
|
+
*
|
|
294
|
+
* @category response
|
|
295
|
+
* @since 4.0.0
|
|
296
|
+
*/
|
|
190
297
|
interface ReasoningStartPartMetadata extends ProviderMetadata {
|
|
298
|
+
/**
|
|
299
|
+
* Provider-specific metadata returned for the streamed reasoning start.
|
|
300
|
+
*/
|
|
191
301
|
readonly openai?: {
|
|
302
|
+
/**
|
|
303
|
+
* The OpenAI item ID associated with the reasoning part.
|
|
304
|
+
*/
|
|
192
305
|
readonly itemId?: string | null;
|
|
306
|
+
/**
|
|
307
|
+
* Encrypted reasoning content that can be sent back in later requests.
|
|
308
|
+
*/
|
|
193
309
|
readonly encryptedContent?: string | null;
|
|
194
310
|
} | null;
|
|
195
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* OpenAI metadata emitted for a streamed reasoning delta.
|
|
314
|
+
*
|
|
315
|
+
* @category response
|
|
316
|
+
* @since 4.0.0
|
|
317
|
+
*/
|
|
196
318
|
interface ReasoningDeltaPartMetadata extends ProviderMetadata {
|
|
319
|
+
/**
|
|
320
|
+
* Provider-specific metadata returned for the streamed reasoning delta.
|
|
321
|
+
*/
|
|
197
322
|
readonly openai?: {
|
|
323
|
+
/**
|
|
324
|
+
* The OpenAI item ID associated with the reasoning part.
|
|
325
|
+
*/
|
|
198
326
|
readonly itemId?: string | null;
|
|
199
327
|
} | null;
|
|
200
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* OpenAI metadata emitted when a streamed reasoning part ends.
|
|
331
|
+
*
|
|
332
|
+
* @category response
|
|
333
|
+
* @since 4.0.0
|
|
334
|
+
*/
|
|
201
335
|
interface ReasoningEndPartMetadata extends ProviderMetadata {
|
|
336
|
+
/**
|
|
337
|
+
* Provider-specific metadata returned for the streamed reasoning end.
|
|
338
|
+
*/
|
|
202
339
|
readonly openai?: {
|
|
340
|
+
/**
|
|
341
|
+
* The OpenAI item ID associated with the reasoning part.
|
|
342
|
+
*/
|
|
203
343
|
readonly itemId?: string | null;
|
|
344
|
+
/**
|
|
345
|
+
* Encrypted reasoning content that can be sent back in later requests.
|
|
346
|
+
*/
|
|
204
347
|
readonly encryptedContent?: string;
|
|
205
348
|
} | null;
|
|
206
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* OpenAI metadata attached to tool-call response parts.
|
|
352
|
+
*
|
|
353
|
+
* @category response
|
|
354
|
+
* @since 4.0.0
|
|
355
|
+
*/
|
|
207
356
|
interface ToolCallPartMetadata extends ProviderMetadata {
|
|
357
|
+
/**
|
|
358
|
+
* Provider-specific metadata returned for the tool call.
|
|
359
|
+
*/
|
|
208
360
|
readonly openai?: {
|
|
361
|
+
/**
|
|
362
|
+
* The OpenAI item ID associated with the tool call.
|
|
363
|
+
*/
|
|
209
364
|
readonly itemId?: string | null;
|
|
210
365
|
} | null;
|
|
211
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* OpenAI metadata attached to document source citations.
|
|
369
|
+
*
|
|
370
|
+
* @category response
|
|
371
|
+
* @since 4.0.0
|
|
372
|
+
*/
|
|
212
373
|
interface DocumentSourcePartMetadata extends ProviderMetadata {
|
|
374
|
+
/**
|
|
375
|
+
* Provider-specific citation metadata for the OpenAI Responses API.
|
|
376
|
+
*/
|
|
213
377
|
readonly openai?: {
|
|
378
|
+
/**
|
|
379
|
+
* Identifies a citation to an uploaded file.
|
|
380
|
+
*/
|
|
214
381
|
readonly type: "file_citation";
|
|
215
382
|
/**
|
|
216
383
|
* The index of the file in the list of files.
|
|
@@ -221,6 +388,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
221
388
|
*/
|
|
222
389
|
readonly fileId: string;
|
|
223
390
|
} | {
|
|
391
|
+
/**
|
|
392
|
+
* Identifies a citation to a generated file path.
|
|
393
|
+
*/
|
|
224
394
|
readonly type: "file_path";
|
|
225
395
|
/**
|
|
226
396
|
* The index of the file in the list of files.
|
|
@@ -231,6 +401,9 @@ declare module "effect/unstable/ai/Response" {
|
|
|
231
401
|
*/
|
|
232
402
|
readonly fileId: string;
|
|
233
403
|
} | {
|
|
404
|
+
/**
|
|
405
|
+
* Identifies a citation to a file inside a container.
|
|
406
|
+
*/
|
|
234
407
|
readonly type: "container_file_citation";
|
|
235
408
|
/**
|
|
236
409
|
* The ID of the file.
|
|
@@ -242,8 +415,20 @@ declare module "effect/unstable/ai/Response" {
|
|
|
242
415
|
readonly containerId: string;
|
|
243
416
|
} | null;
|
|
244
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* OpenAI metadata attached to URL source citations.
|
|
420
|
+
*
|
|
421
|
+
* @category response
|
|
422
|
+
* @since 4.0.0
|
|
423
|
+
*/
|
|
245
424
|
interface UrlSourcePartMetadata extends ProviderMetadata {
|
|
425
|
+
/**
|
|
426
|
+
* Provider-specific URL citation metadata for the OpenAI Responses API.
|
|
427
|
+
*/
|
|
246
428
|
readonly openai?: {
|
|
429
|
+
/**
|
|
430
|
+
* Identifies a citation to a URL.
|
|
431
|
+
*/
|
|
247
432
|
readonly type: "url_citation";
|
|
248
433
|
/**
|
|
249
434
|
* The index of the first character of the URL citation in the message.
|
|
@@ -255,22 +440,36 @@ declare module "effect/unstable/ai/Response" {
|
|
|
255
440
|
readonly endIndex: number;
|
|
256
441
|
} | null;
|
|
257
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* OpenAI metadata attached to finish response parts.
|
|
445
|
+
*
|
|
446
|
+
* @category response
|
|
447
|
+
* @since 4.0.0
|
|
448
|
+
*/
|
|
258
449
|
interface FinishPartMetadata extends ProviderMetadata {
|
|
450
|
+
/**
|
|
451
|
+
* Provider-specific metadata returned when generation finishes.
|
|
452
|
+
*/
|
|
259
453
|
readonly openai?: {
|
|
454
|
+
/**
|
|
455
|
+
* The service tier reported by OpenAI for the response.
|
|
456
|
+
*/
|
|
260
457
|
readonly serviceTier?: "default" | "auto" | "flex" | "scale" | "priority" | null;
|
|
261
458
|
} | null;
|
|
262
459
|
}
|
|
263
460
|
}
|
|
264
461
|
/**
|
|
265
|
-
*
|
|
462
|
+
* Creates an OpenAI language model that can be used with `AiModel.provide`.
|
|
463
|
+
*
|
|
266
464
|
* @category constructors
|
|
465
|
+
* @since 4.0.0
|
|
267
466
|
*/
|
|
268
467
|
export declare const model: (model: (string & {}) | Model, config?: Omit<typeof Config.Service, "model">) => AiModel.Model<"openai", LanguageModel.LanguageModel, OpenAiClient>;
|
|
269
468
|
/**
|
|
270
469
|
* Creates an OpenAI language model service.
|
|
271
470
|
*
|
|
272
|
-
* @since 1.0.0
|
|
273
471
|
* @category constructors
|
|
472
|
+
* @since 4.0.0
|
|
274
473
|
*/
|
|
275
474
|
export declare const make: (args_0: {
|
|
276
475
|
readonly model: (string & {}) | Model;
|
|
@@ -279,8 +478,8 @@ export declare const make: (args_0: {
|
|
|
279
478
|
/**
|
|
280
479
|
* Creates a layer for the OpenAI language model.
|
|
281
480
|
*
|
|
282
|
-
* @since 1.0.0
|
|
283
481
|
* @category layers
|
|
482
|
+
* @since 4.0.0
|
|
284
483
|
*/
|
|
285
484
|
export declare const layer: (options: {
|
|
286
485
|
readonly model: (string & {}) | Model;
|
|
@@ -289,22 +488,22 @@ export declare const layer: (options: {
|
|
|
289
488
|
/**
|
|
290
489
|
* Provides config overrides for OpenAI language model operations.
|
|
291
490
|
*
|
|
292
|
-
* @since 1.0.0
|
|
293
491
|
* @category configuration
|
|
492
|
+
* @since 4.0.0
|
|
294
493
|
*/
|
|
295
494
|
export declare const withConfigOverride: {
|
|
296
495
|
/**
|
|
297
496
|
* Provides config overrides for OpenAI language model operations.
|
|
298
497
|
*
|
|
299
|
-
* @since 1.0.0
|
|
300
498
|
* @category configuration
|
|
499
|
+
* @since 4.0.0
|
|
301
500
|
*/
|
|
302
501
|
(overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>;
|
|
303
502
|
/**
|
|
304
503
|
* Provides config overrides for OpenAI language model operations.
|
|
305
504
|
*
|
|
306
|
-
* @since 1.0.0
|
|
307
505
|
* @category configuration
|
|
506
|
+
* @since 4.0.0
|
|
308
507
|
*/
|
|
309
508
|
<A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>;
|
|
310
509
|
};
|