@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.
Files changed (49) hide show
  1. package/dist/Generated.d.ts +1 -1
  2. package/dist/Generated.js +1 -1
  3. package/dist/OpenAiClient.d.ts +19 -12
  4. package/dist/OpenAiClient.d.ts.map +1 -1
  5. package/dist/OpenAiClient.js +11 -9
  6. package/dist/OpenAiClient.js.map +1 -1
  7. package/dist/OpenAiClientGenerated.d.ts +5 -5
  8. package/dist/OpenAiClientGenerated.js +5 -5
  9. package/dist/OpenAiConfig.d.ts +43 -8
  10. package/dist/OpenAiConfig.d.ts.map +1 -1
  11. package/dist/OpenAiConfig.js +28 -4
  12. package/dist/OpenAiConfig.js.map +1 -1
  13. package/dist/OpenAiEmbeddingModel.d.ts +13 -9
  14. package/dist/OpenAiEmbeddingModel.d.ts.map +1 -1
  15. package/dist/OpenAiEmbeddingModel.js +8 -6
  16. package/dist/OpenAiEmbeddingModel.js.map +1 -1
  17. package/dist/OpenAiError.d.ts +124 -3
  18. package/dist/OpenAiError.d.ts.map +1 -1
  19. package/dist/OpenAiError.js +1 -1
  20. package/dist/OpenAiLanguageModel.d.ts +208 -9
  21. package/dist/OpenAiLanguageModel.d.ts.map +1 -1
  22. package/dist/OpenAiLanguageModel.js +9 -7
  23. package/dist/OpenAiLanguageModel.js.map +1 -1
  24. package/dist/OpenAiSchema.d.ts +143 -35
  25. package/dist/OpenAiSchema.d.ts.map +1 -1
  26. package/dist/OpenAiSchema.js +72 -18
  27. package/dist/OpenAiSchema.js.map +1 -1
  28. package/dist/OpenAiTelemetry.d.ts +17 -14
  29. package/dist/OpenAiTelemetry.d.ts.map +1 -1
  30. package/dist/OpenAiTelemetry.js +3 -3
  31. package/dist/OpenAiTelemetry.js.map +1 -1
  32. package/dist/OpenAiTool.d.ts +11 -11
  33. package/dist/OpenAiTool.js +10 -10
  34. package/dist/index.d.ts +27 -11
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +27 -11
  37. package/dist/index.js.map +1 -1
  38. package/package.json +3 -3
  39. package/src/Generated.ts +1 -1
  40. package/src/OpenAiClient.ts +20 -13
  41. package/src/OpenAiClientGenerated.ts +6 -6
  42. package/src/OpenAiConfig.ts +43 -8
  43. package/src/OpenAiEmbeddingModel.ts +15 -11
  44. package/src/OpenAiError.ts +124 -3
  45. package/src/OpenAiLanguageModel.ts +211 -12
  46. package/src/OpenAiSchema.ts +144 -36
  47. package/src/OpenAiTelemetry.ts +18 -15
  48. package/src/OpenAiTool.ts +11 -11
  49. package/src/index.ts +27 -11
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  // @barrel: Auto-generated exports. Do not edit manually.
5
5
  /**
6
- * @since 1.0.0
6
+ * @since 4.0.0
7
7
  */
8
8
  export * as Generated from "./Generated.js";
9
9
  /**
@@ -12,15 +12,31 @@ export * as Generated from "./Generated.js";
12
12
  * Provides a type-safe, Effect-based client for OpenAI operations including
13
13
  * completions, embeddings, and streaming responses.
14
14
  *
15
- * @since 1.0.0
15
+ * @since 4.0.0
16
16
  */
17
17
  export * as OpenAiClient from "./OpenAiClient.js";
18
18
  /**
19
- * @since 1.0.0
19
+ * @since 4.0.0
20
20
  */
21
21
  export * as OpenAiClientGenerated from "./OpenAiClientGenerated.js";
22
22
  /**
23
- * @since 1.0.0
23
+ * The `OpenAiConfig` module provides contextual configuration for the
24
+ * `@effect/ai-openai` integration. It is used to customize how OpenAI clients
25
+ * are built and interpreted without threading configuration through every API
26
+ * call manually.
27
+ *
28
+ * The primary use case is installing an HTTP client transform with
29
+ * {@link withClientTransform}. This lets applications adapt the underlying
30
+ * OpenAI HTTP client for cross-cutting concerns such as custom middleware,
31
+ * instrumentation, proxying, or request policy changes while keeping the
32
+ * OpenAI service APIs unchanged.
33
+ *
34
+ * Configuration is scoped through Effect's context, so transforms only apply to
35
+ * the effect they are provided to and anything evaluated inside that scope.
36
+ * When multiple transforms are needed, compose them into a single
37
+ * `HttpClient => HttpClient` function before providing the configuration.
38
+ *
39
+ * @since 4.0.0
24
40
  */
25
41
  export * as OpenAiConfig from "./OpenAiConfig.js";
26
42
  /**
@@ -28,7 +44,7 @@ export * as OpenAiConfig from "./OpenAiConfig.js";
28
44
  *
29
45
  * Provides an EmbeddingModel implementation for OpenAI's embeddings API.
30
46
  *
31
- * @since 1.0.0
47
+ * @since 4.0.0
32
48
  */
33
49
  export * as OpenAiEmbeddingModel from "./OpenAiEmbeddingModel.js";
34
50
  /**
@@ -37,7 +53,7 @@ export * as OpenAiEmbeddingModel from "./OpenAiEmbeddingModel.js";
37
53
  * Provides OpenAI-specific metadata fields for AI error types through module
38
54
  * augmentation, enabling typed access to OpenAI error details.
39
55
  *
40
- * @since 1.0.0
56
+ * @since 4.0.0
41
57
  */
42
58
  export * as OpenAiError from "./OpenAiError.js";
43
59
  /**
@@ -46,13 +62,13 @@ export * as OpenAiError from "./OpenAiError.js";
46
62
  * Provides a LanguageModel implementation for OpenAI's responses API,
47
63
  * supporting text generation, structured output, tool calling, and streaming.
48
64
  *
49
- * @since 1.0.0
65
+ * @since 4.0.0
50
66
  */
51
67
  export * as OpenAiLanguageModel from "./OpenAiLanguageModel.js";
52
68
  /**
53
69
  * Minimal local OpenAI schemas used by the handwritten Responses client path.
54
70
  *
55
- * @since 1.0.0
71
+ * @since 4.0.0
56
72
  */
57
73
  export * as OpenAiSchema from "./OpenAiSchema.js";
58
74
  /**
@@ -62,7 +78,7 @@ export * as OpenAiSchema from "./OpenAiSchema.js";
62
78
  * semantic conventions, extending the base GenAI attributes with OpenAI-specific
63
79
  * request and response metadata.
64
80
  *
65
- * @since 1.0.0
81
+ * @since 4.0.0
66
82
  */
67
83
  export * as OpenAiTelemetry from "./OpenAiTelemetry.js";
68
84
  /**
@@ -71,7 +87,7 @@ export * as OpenAiTelemetry from "./OpenAiTelemetry.js";
71
87
  * Provides tools that are natively supported by OpenAI's API, including
72
88
  * code interpreter, file search, and web search functionality.
73
89
  *
74
- * @since 1.0.0
90
+ * @since 4.0.0
75
91
  */
76
92
  export * as OpenAiTool from "./OpenAiTool.js";
77
93
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Generated","OpenAiClient","OpenAiClientGenerated","OpenAiConfig","OpenAiEmbeddingModel","OpenAiError","OpenAiLanguageModel","OpenAiSchema","OpenAiTelemetry","OpenAiTool"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAKA,SAAS,MAAM,gBAAgB;AAE3C;;;;;;;;AAQA,OAAO,KAAKC,YAAY,MAAM,mBAAmB;AAEjD;;;AAGA,OAAO,KAAKC,qBAAqB,MAAM,4BAA4B;AAEnE;;;AAGA,OAAO,KAAKC,YAAY,MAAM,mBAAmB;AAEjD;;;;;;;AAOA,OAAO,KAAKC,oBAAoB,MAAM,2BAA2B;AAEjE;;;;;;;;AAQA,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAE/C;;;;;;;;AAQA,OAAO,KAAKC,mBAAmB,MAAM,0BAA0B;AAE/D;;;;;AAKA,OAAO,KAAKC,YAAY,MAAM,mBAAmB;AAEjD;;;;;;;;;AASA,OAAO,KAAKC,eAAe,MAAM,sBAAsB;AAEvD;;;;;;;;AAQA,OAAO,KAAKC,UAAU,MAAM,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Generated","OpenAiClient","OpenAiClientGenerated","OpenAiConfig","OpenAiEmbeddingModel","OpenAiError","OpenAiLanguageModel","OpenAiSchema","OpenAiTelemetry","OpenAiTool"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAKA,SAAS,MAAM,gBAAgB;AAE3C;;;;;;;;AAQA,OAAO,KAAKC,YAAY,MAAM,mBAAmB;AAEjD;;;AAGA,OAAO,KAAKC,qBAAqB,MAAM,4BAA4B;AAEnE;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,KAAKC,YAAY,MAAM,mBAAmB;AAEjD;;;;;;;AAOA,OAAO,KAAKC,oBAAoB,MAAM,2BAA2B;AAEjE;;;;;;;;AAQA,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAE/C;;;;;;;;AAQA,OAAO,KAAKC,mBAAmB,MAAM,0BAA0B;AAE/D;;;;;AAKA,OAAO,KAAKC,YAAY,MAAM,mBAAmB;AAEjD;;;;;;;;;AASA,OAAO,KAAKC,eAAe,MAAM,sBAAsB;AAEvD;;;;;;;;AAQA,OAAO,KAAKC,UAAU,MAAM,iBAAiB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/ai-openai",
3
- "version": "4.0.0-beta.66",
3
+ "version": "4.0.0-beta.68",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "An OpenAI provider integration for Effect AI SDK",
@@ -43,10 +43,10 @@
43
43
  "provenance": true
44
44
  },
45
45
  "devDependencies": {
46
- "effect": "^4.0.0-beta.66"
46
+ "effect": "^4.0.0-beta.68"
47
47
  },
48
48
  "peerDependencies": {
49
- "effect": "^4.0.0-beta.66"
49
+ "effect": "^4.0.0-beta.68"
50
50
  },
51
51
  "scripts": {
52
52
  "codegen": "effect-utils codegen",
package/src/Generated.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
 
5
5
  import * as Data from "effect/Data"
@@ -4,7 +4,7 @@
4
4
  * Provides a type-safe, Effect-based client for OpenAI operations including
5
5
  * completions, embeddings, and streaming responses.
6
6
  *
7
- * @since 1.0.0
7
+ * @since 4.0.0
8
8
  */
9
9
  import * as Array from "effect/Array"
10
10
  import type * as Config from "effect/Config"
@@ -39,10 +39,13 @@ import * as OpenAiSchema from "./OpenAiSchema.ts"
39
39
  // =============================================================================
40
40
 
41
41
  /**
42
- * The OpenAI client interface.
42
+ * Effect service interface for the handwritten OpenAI client.
43
+ *
44
+ * **Details**
45
+ * Provides the configured HTTP client plus helpers for Responses API calls, streaming Responses events, and embeddings. Transport and schema decoding failures are mapped to `AiError`.
43
46
  *
44
- * @since 1.0.0
45
47
  * @category models
48
+ * @since 4.0.0
46
49
  */
47
50
  export interface Service {
48
51
  /**
@@ -88,8 +91,8 @@ export interface Service {
88
91
  /**
89
92
  * Service identifier for the OpenAI client.
90
93
  *
91
- * @since 1.0.0
92
- * @category service
94
+ * @category services
95
+ * @since 4.0.0
93
96
  */
94
97
  export class OpenAiClient extends Context.Service<OpenAiClient, Service>()(
95
98
  "@effect/ai-openai/OpenAiClient"
@@ -102,8 +105,8 @@ export class OpenAiClient extends Context.Service<OpenAiClient, Service>()(
102
105
  /**
103
106
  * Options for configuring the OpenAI client.
104
107
  *
105
- * @since 1.0.0
106
108
  * @category models
109
+ * @since 4.0.0
107
110
  */
108
111
  export type Options = {
109
112
  /**
@@ -146,8 +149,8 @@ const RedactedOpenAiHeaders = {
146
149
  /**
147
150
  * Creates an OpenAI client service with the given options.
148
151
  *
149
- * @since 1.0.0
150
152
  * @category constructors
153
+ * @since 4.0.0
151
154
  */
152
155
  export const make = Effect.fnUntraced(
153
156
  function*(
@@ -298,8 +301,8 @@ export const make = Effect.fnUntraced(
298
301
  /**
299
302
  * Creates a layer for the OpenAI client with the given options.
300
303
  *
301
- * @since 1.0.0
302
304
  * @category layers
305
+ * @since 4.0.0
303
306
  */
304
307
  export const layer = (options: Options): Layer.Layer<OpenAiClient, never, HttpClient.HttpClient> =>
305
308
  Layer.effect(OpenAiClient, make(options))
@@ -308,8 +311,8 @@ export const layer = (options: Options): Layer.Layer<OpenAiClient, never, HttpCl
308
311
  * Creates a layer for the OpenAI client, loading the requisite configuration
309
312
  * via Effect's `Config` module.
310
313
  *
311
- * @since 1.0.0
312
314
  * @category layers
315
+ * @since 4.0.0
313
316
  */
314
317
  export const layerConfig = (options?: {
315
318
  /**
@@ -367,14 +370,18 @@ export const layerConfig = (options?: {
367
370
  // =============================================================================
368
371
 
369
372
  /**
370
- * @since 1.0.0
373
+ * Response stream event emitted by the OpenAI Responses API.
374
+ *
371
375
  * @category Events
376
+ * @since 4.0.0
372
377
  */
373
378
  export type ResponseStreamEvent = typeof OpenAiSchema.ResponseStreamEvent.Type
374
379
 
375
380
  /**
376
- * @since 1.0.0
381
+ * Service for creating OpenAI response streams over a WebSocket connection.
382
+ *
377
383
  * @category Websocket mode
384
+ * @since 4.0.0
378
385
  */
379
386
  export class OpenAiSocket extends Context.Service<OpenAiSocket, {
380
387
  /**
@@ -587,8 +594,8 @@ const decodeEvent = Schema.decodeUnknownSync(Schema.fromJsonString(AllEvents))
587
594
  * This is because it needs to use non-standard options for setting the
588
595
  * Authorization header.
589
596
  *
590
- * @since 1.0.0
591
597
  * @category Websocket mode
598
+ * @since 4.0.0
592
599
  */
593
600
  export const withWebSocketMode = <A, E, R>(
594
601
  effect: Effect.Effect<A, E, R>
@@ -615,8 +622,8 @@ export const withWebSocketMode = <A, E, R>(
615
622
  * This is because it needs to use non-standard options for setting the
616
623
  * Authorization header.
617
624
  *
618
- * @since 1.0.0
619
625
  * @category Websocket mode
626
+ * @since 4.0.0
620
627
  */
621
628
  export const layerWebSocketMode: Layer.Layer<
622
629
  OpenAiSocket | ResponseIdTracker.ResponseIdTracker,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  import * as Array from "effect/Array"
5
5
  import type * as Config from "effect/Config"
@@ -23,7 +23,7 @@ import { OpenAiConfig } from "./OpenAiConfig.ts"
23
23
  /**
24
24
  * Service identifier for the generated OpenAI client.
25
25
  *
26
- * @since 1.0.0
26
+ * @since 4.0.0
27
27
  * @category service
28
28
  */
29
29
  export class OpenAiClientGenerated extends Context.Service<OpenAiClientGenerated, Generated.OpenAiClient>()(
@@ -37,7 +37,7 @@ export class OpenAiClientGenerated extends Context.Service<OpenAiClientGenerated
37
37
  /**
38
38
  * Options for configuring the generated OpenAI client.
39
39
  *
40
- * @since 1.0.0
40
+ * @since 4.0.0
41
41
  * @category models
42
42
  */
43
43
  export type Options = {
@@ -81,7 +81,7 @@ const RedactedOpenAiHeaders = {
81
81
  /**
82
82
  * Creates a generated OpenAI client service with the given options.
83
83
  *
84
- * @since 1.0.0
84
+ * @since 4.0.0
85
85
  * @category constructors
86
86
  */
87
87
  export const make = Effect.fnUntraced(
@@ -137,7 +137,7 @@ export const make = Effect.fnUntraced(
137
137
  /**
138
138
  * Creates a layer for the generated OpenAI client with the given options.
139
139
  *
140
- * @since 1.0.0
140
+ * @since 4.0.0
141
141
  * @category layers
142
142
  */
143
143
  export const layer = (options: Options): Layer.Layer<OpenAiClientGenerated, never, HttpClient.HttpClient> =>
@@ -147,7 +147,7 @@ export const layer = (options: Options): Layer.Layer<OpenAiClientGenerated, neve
147
147
  * Creates a layer for the generated OpenAI client, loading the requisite
148
148
  * configuration via Effect's `Config` module.
149
149
  *
150
- * @since 1.0.0
150
+ * @since 4.0.0
151
151
  * @category layers
152
152
  */
153
153
  export const layerConfig = (options?: {
@@ -1,5 +1,21 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * The `OpenAiConfig` module provides contextual configuration for the
3
+ * `@effect/ai-openai` integration. It is used to customize how OpenAI clients
4
+ * are built and interpreted without threading configuration through every API
5
+ * call manually.
6
+ *
7
+ * The primary use case is installing an HTTP client transform with
8
+ * {@link withClientTransform}. This lets applications adapt the underlying
9
+ * OpenAI HTTP client for cross-cutting concerns such as custom middleware,
10
+ * instrumentation, proxying, or request policy changes while keeping the
11
+ * OpenAI service APIs unchanged.
12
+ *
13
+ * Configuration is scoped through Effect's context, so transforms only apply to
14
+ * the effect they are provided to and anything evaluated inside that scope.
15
+ * When multiple transforms are needed, compose them into a single
16
+ * `HttpClient => HttpClient` function before providing the configuration.
17
+ *
18
+ * @since 4.0.0
3
19
  */
4
20
  import * as Context from "effect/Context"
5
21
  import * as Effect from "effect/Effect"
@@ -7,15 +23,20 @@ import { dual } from "effect/Function"
7
23
  import type { HttpClient } from "effect/unstable/http/HttpClient"
8
24
 
9
25
  /**
10
- * @since 1.0.0
26
+ * Context service carrying scoped OpenAI configuration for provider
27
+ * operations.
28
+ *
11
29
  * @category services
30
+ * @since 4.0.0
12
31
  */
13
32
  export class OpenAiConfig extends Context.Service<
14
33
  OpenAiConfig,
15
34
  OpenAiConfig.Service
16
35
  >()("@effect/ai-openai/OpenAiConfig") {
17
36
  /**
18
- * @since 1.0.0
37
+ * Gets the configured OpenAI service from the current context when present.
38
+ *
39
+ * @since 4.0.0
19
40
  */
20
41
  static readonly getOrUndefined: Effect.Effect<typeof OpenAiConfig.Service | undefined> = Effect.map(
21
42
  Effect.context<never>(),
@@ -24,12 +45,17 @@ export class OpenAiConfig extends Context.Service<
24
45
  }
25
46
 
26
47
  /**
27
- * @since 1.0.0
48
+ * Types used by the `OpenAiConfig` context service.
49
+ *
50
+ * @since 4.0.0
28
51
  */
29
52
  export declare namespace OpenAiConfig {
30
53
  /**
31
- * @since 1.0.
54
+ * Configuration values read by OpenAI provider operations when executing
55
+ * requests.
56
+ *
32
57
  * @category models
58
+ * @since 4.0.0
33
59
  */
34
60
  export interface Service {
35
61
  readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined
@@ -37,18 +63,27 @@ export declare namespace OpenAiConfig {
37
63
  }
38
64
 
39
65
  /**
40
- * @since 1.0.0
66
+ * Provides a scoped transform for the OpenAI HTTP client used by provider
67
+ * operations.
68
+ *
41
69
  * @category configuration
70
+ * @since 4.0.0
42
71
  */
43
72
  export const withClientTransform: {
44
73
  /**
45
- * @since 1.0.0
74
+ * Provides a scoped transform for the OpenAI HTTP client used by provider
75
+ * operations.
76
+ *
46
77
  * @category configuration
78
+ * @since 4.0.0
47
79
  */
48
80
  (transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
49
81
  /**
50
- * @since 1.0.0
82
+ * Provides a scoped transform for the OpenAI HTTP client used by provider
83
+ * operations.
84
+ *
51
85
  * @category configuration
86
+ * @since 4.0.0
52
87
  */
53
88
  <A, E, R>(
54
89
  self: Effect.Effect<A, E, R>,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Provides an EmbeddingModel implementation for OpenAI's embeddings API.
5
5
  *
6
- * @since 1.0.0
6
+ * @since 4.0.0
7
7
  */
8
8
  import * as Context from "effect/Context"
9
9
  import * as Effect from "effect/Effect"
@@ -17,16 +17,18 @@ import { OpenAiClient } from "./OpenAiClient.ts"
17
17
  import type * as OpenAiSchema from "./OpenAiSchema.ts"
18
18
 
19
19
  /**
20
- * @since 1.0.0
20
+ * Model identifiers supported by OpenAI's embeddings API.
21
+ *
21
22
  * @category models
23
+ * @since 4.0.0
22
24
  */
23
25
  export type Model = "text-embedding-ada-002" | "text-embedding-3-small" | "text-embedding-3-large"
24
26
 
25
27
  /**
26
28
  * Service definition for OpenAI embedding model configuration.
27
29
  *
28
- * @since 1.0.0
29
30
  * @category services
31
+ * @since 4.0.0
30
32
  */
31
33
  export class Config extends Context.Service<
32
34
  Config,
@@ -44,8 +46,10 @@ export class Config extends Context.Service<
44
46
  >()("@effect/ai-openai/OpenAiEmbeddingModel/Config") {}
45
47
 
46
48
  /**
47
- * @since 1.0.0
49
+ * Creates an `AiModel` for an OpenAI embedding model with its configured vector dimensions.
50
+ *
48
51
  * @category constructors
52
+ * @since 4.0.0
49
53
  */
50
54
  export const model = (
51
55
  model: (string & {}) | Model,
@@ -72,8 +76,8 @@ export const model = (
72
76
  /**
73
77
  * Creates an OpenAI embedding model service.
74
78
  *
75
- * @since 1.0.0
76
79
  * @category constructors
80
+ * @since 4.0.0
77
81
  */
78
82
  export const make = Effect.fnUntraced(function*({ model, config: providerConfig }: {
79
83
  readonly model: (string & {}) | Model
@@ -98,8 +102,8 @@ export const make = Effect.fnUntraced(function*({ model, config: providerConfig
98
102
  /**
99
103
  * Creates a layer for the OpenAI embedding model.
100
104
  *
101
- * @since 1.0.0
102
105
  * @category layers
106
+ * @since 4.0.0
103
107
  */
104
108
  export const layer = (options: {
105
109
  readonly model: (string & {}) | Model
@@ -110,37 +114,37 @@ export const layer = (options: {
110
114
  /**
111
115
  * Provides config overrides for OpenAI embedding model operations.
112
116
  *
113
- * @since 1.0.0
114
117
  * @category configuration
118
+ * @since 4.0.0
115
119
  */
116
120
  export const withConfigOverride: {
117
121
  /**
118
122
  * Provides config overrides for OpenAI embedding model operations.
119
123
  *
120
- * @since 1.0.0
121
124
  * @category configuration
125
+ * @since 4.0.0
122
126
  */
123
127
  (overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>
124
128
  /**
125
129
  * Provides config overrides for OpenAI embedding model operations.
126
130
  *
127
- * @since 1.0.0
128
131
  * @category configuration
132
+ * @since 4.0.0
129
133
  */
130
134
  <A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>
131
135
  } = dual<
132
136
  /**
133
137
  * Provides config overrides for OpenAI embedding model operations.
134
138
  *
135
- * @since 1.0.0
136
139
  * @category configuration
140
+ * @since 4.0.0
137
141
  */
138
142
  (overrides: typeof Config.Service) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>,
139
143
  /**
140
144
  * Provides config overrides for OpenAI embedding model operations.
141
145
  *
142
- * @since 1.0.0
143
146
  * @category configuration
147
+ * @since 4.0.0
144
148
  */
145
149
  <A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service) => Effect.Effect<A, E, Exclude<R, Config>>
146
150
  >(2, (self, overrides) =>
@@ -4,14 +4,14 @@
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 1.0.0
7
+ * @since 4.0.0
8
8
  */
9
9
 
10
10
  /**
11
11
  * OpenAI-specific error metadata fields.
12
12
  *
13
- * @since 1.0.0
14
13
  * @category models
14
+ * @since 4.0.0
15
15
  */
16
16
  export type OpenAiErrorMetadata = {
17
17
  /**
@@ -34,8 +34,8 @@ export type OpenAiErrorMetadata = {
34
34
  * Extends base error metadata with rate limit specific information from
35
35
  * OpenAI's rate limit headers.
36
36
  *
37
- * @since 1.0.0
38
37
  * @category models
38
+ * @since 4.0.0
39
39
  */
40
40
  export type OpenAiRateLimitMetadata = OpenAiErrorMetadata & {
41
41
  /**
@@ -57,43 +57,164 @@ export type OpenAiRateLimitMetadata = OpenAiErrorMetadata & {
57
57
  }
58
58
 
59
59
  declare module "effect/unstable/ai/AiError" {
60
+ /**
61
+ * OpenAI metadata attached to `RateLimitError` values.
62
+ *
63
+ * Captures OpenAI error details together with rate limit header information
64
+ * from responses where the provider rejected the request because a limit was
65
+ * reached.
66
+ *
67
+ * @category configuration
68
+ * @since 4.0.0
69
+ */
60
70
  export interface RateLimitErrorMetadata {
71
+ /**
72
+ * OpenAI-specific details for the rate limit response.
73
+ */
61
74
  readonly openai?: OpenAiRateLimitMetadata | null
62
75
  }
63
76
 
77
+ /**
78
+ * OpenAI metadata attached to `QuotaExhaustedError` values.
79
+ *
80
+ * Preserves provider error details for failures caused by exhausted account,
81
+ * billing, or usage quota.
82
+ *
83
+ * @category configuration
84
+ * @since 4.0.0
85
+ */
64
86
  export interface QuotaExhaustedErrorMetadata {
87
+ /**
88
+ * OpenAI-specific details for the quota exhaustion response.
89
+ */
65
90
  readonly openai?: OpenAiErrorMetadata | null
66
91
  }
67
92
 
93
+ /**
94
+ * OpenAI metadata attached to `AuthenticationError` values.
95
+ *
96
+ * Preserves provider error details for failed API key, authorization, or
97
+ * permission checks.
98
+ *
99
+ * @category configuration
100
+ * @since 4.0.0
101
+ */
68
102
  export interface AuthenticationErrorMetadata {
103
+ /**
104
+ * OpenAI-specific details for the authentication failure.
105
+ */
69
106
  readonly openai?: OpenAiErrorMetadata | null
70
107
  }
71
108
 
109
+ /**
110
+ * OpenAI metadata attached to `ContentPolicyError` values.
111
+ *
112
+ * Preserves provider error details when OpenAI rejects input or output because
113
+ * it violates a content policy.
114
+ *
115
+ * @category configuration
116
+ * @since 4.0.0
117
+ */
72
118
  export interface ContentPolicyErrorMetadata {
119
+ /**
120
+ * OpenAI-specific details for the content policy response.
121
+ */
73
122
  readonly openai?: OpenAiErrorMetadata | null
74
123
  }
75
124
 
125
+ /**
126
+ * OpenAI metadata attached to `InvalidRequestError` values.
127
+ *
128
+ * Preserves provider error details for malformed requests, unsupported
129
+ * parameters, or other request validation failures reported by OpenAI.
130
+ *
131
+ * @category configuration
132
+ * @since 4.0.0
133
+ */
76
134
  export interface InvalidRequestErrorMetadata {
135
+ /**
136
+ * OpenAI-specific details for the invalid request response.
137
+ */
77
138
  readonly openai?: OpenAiErrorMetadata | null
78
139
  }
79
140
 
141
+ /**
142
+ * OpenAI metadata attached to `InternalProviderError` values.
143
+ *
144
+ * Preserves provider error details for OpenAI-side failures such as transient
145
+ * server errors.
146
+ *
147
+ * @category configuration
148
+ * @since 4.0.0
149
+ */
80
150
  export interface InternalProviderErrorMetadata {
151
+ /**
152
+ * OpenAI-specific details for the internal provider response.
153
+ */
81
154
  readonly openai?: OpenAiErrorMetadata | null
82
155
  }
83
156
 
157
+ /**
158
+ * OpenAI metadata attached to `InvalidOutputError` values.
159
+ *
160
+ * Preserves provider error details when an OpenAI response cannot be parsed or
161
+ * validated as the expected output.
162
+ *
163
+ * @category configuration
164
+ * @since 4.0.0
165
+ */
84
166
  export interface InvalidOutputErrorMetadata {
167
+ /**
168
+ * OpenAI-specific details for the invalid output response.
169
+ */
85
170
  readonly openai?: OpenAiErrorMetadata | null
86
171
  }
87
172
 
173
+ /**
174
+ * OpenAI metadata attached to `StructuredOutputError` values.
175
+ *
176
+ * Preserves provider error details when OpenAI returns content that does not
177
+ * satisfy the requested structured output schema.
178
+ *
179
+ * @category configuration
180
+ * @since 4.0.0
181
+ */
88
182
  export interface StructuredOutputErrorMetadata {
183
+ /**
184
+ * OpenAI-specific details for the structured output failure.
185
+ */
89
186
  readonly openai?: OpenAiErrorMetadata | null
90
187
  }
91
188
 
189
+ /**
190
+ * OpenAI metadata attached to `UnsupportedSchemaError` values.
191
+ *
192
+ * Preserves provider error details when an unsupported schema failure is
193
+ * associated with an OpenAI response.
194
+ *
195
+ * @category configuration
196
+ * @since 4.0.0
197
+ */
92
198
  export interface UnsupportedSchemaErrorMetadata {
199
+ /**
200
+ * OpenAI-specific details for the unsupported schema failure.
201
+ */
93
202
  readonly openai?: OpenAiErrorMetadata | null
94
203
  }
95
204
 
205
+ /**
206
+ * OpenAI metadata attached to `UnknownError` values.
207
+ *
208
+ * Preserves provider error details for OpenAI failures that do not map cleanly
209
+ * to a more specific AI error category.
210
+ *
211
+ * @category configuration
212
+ * @since 4.0.0
213
+ */
96
214
  export interface UnknownErrorMetadata {
215
+ /**
216
+ * OpenAI-specific details for the unclassified provider failure.
217
+ */
97
218
  readonly openai?: OpenAiErrorMetadata | null
98
219
  }
99
220
  }