@effect/ai-openai 4.0.0-beta.69 → 4.0.0-beta.70

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.
@@ -42,6 +42,7 @@ import * as OpenAiSchema from "./OpenAiSchema.ts"
42
42
  * Effect service interface for the handwritten OpenAI client.
43
43
  *
44
44
  * **Details**
45
+ *
45
46
  * 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`.
46
47
  *
47
48
  * @category models
@@ -586,13 +587,14 @@ const decodeEvent = Schema.decodeUnknownSync(Schema.fromJsonString(AllEvents))
586
587
  /**
587
588
  * Uses OpenAI's websocket mode for all responses within the provided effect.
588
589
  *
589
- * Note: This only works with the following WebSocket constructor layers:
590
+ * **Gotchas**
591
+ *
592
+ * This only works with the following WebSocket constructor layers:
590
593
  *
591
594
  * - `NodeSocket.layerWebSocketConstructorWS`
592
595
  * - `BunSocket.layerWebSocketConstructor`
593
596
  *
594
- * This is because it needs to use non-standard options for setting the
595
- * Authorization header.
597
+ * This is because it needs to use non-standard options for setting the Authorization header.
596
598
  *
597
599
  * @category Websocket mode
598
600
  * @since 4.0.0
@@ -614,13 +616,14 @@ export const withWebSocketMode = <A, E, R>(
614
616
  /**
615
617
  * Uses OpenAI's websocket mode for all responses that use the Layer.
616
618
  *
617
- * Note: This only works with the following WebSocket constructor layers:
619
+ * **Gotchas**
620
+ *
621
+ * This only works with the following WebSocket constructor layers:
618
622
  *
619
623
  * - `NodeSocket.layerWebSocketConstructorWS`
620
624
  * - `BunSocket.layerWebSocketConstructor`
621
625
  *
622
- * This is because it needs to use non-standard options for setting the
623
- * Authorization header.
626
+ * This is because it needs to use non-standard options for setting the Authorization header.
624
627
  *
625
628
  * @category Websocket mode
626
629
  * @since 4.0.0
@@ -31,6 +31,8 @@ export type OpenAiErrorMetadata = {
31
31
  /**
32
32
  * OpenAI-specific rate limit metadata fields.
33
33
  *
34
+ * **Details**
35
+ *
34
36
  * Extends base error metadata with rate limit specific information from
35
37
  * OpenAI's rate limit headers.
36
38
  *
@@ -60,6 +62,8 @@ declare module "effect/unstable/ai/AiError" {
60
62
  /**
61
63
  * OpenAI metadata attached to `RateLimitError` values.
62
64
  *
65
+ * **Details**
66
+ *
63
67
  * Captures OpenAI error details together with rate limit header information
64
68
  * from responses where the provider rejected the request because a limit was
65
69
  * reached.
@@ -77,6 +81,8 @@ declare module "effect/unstable/ai/AiError" {
77
81
  /**
78
82
  * OpenAI metadata attached to `QuotaExhaustedError` values.
79
83
  *
84
+ * **Details**
85
+ *
80
86
  * Preserves provider error details for failures caused by exhausted account,
81
87
  * billing, or usage quota.
82
88
  *
@@ -93,6 +99,8 @@ declare module "effect/unstable/ai/AiError" {
93
99
  /**
94
100
  * OpenAI metadata attached to `AuthenticationError` values.
95
101
  *
102
+ * **Details**
103
+ *
96
104
  * Preserves provider error details for failed API key, authorization, or
97
105
  * permission checks.
98
106
  *
@@ -109,6 +117,8 @@ declare module "effect/unstable/ai/AiError" {
109
117
  /**
110
118
  * OpenAI metadata attached to `ContentPolicyError` values.
111
119
  *
120
+ * **Details**
121
+ *
112
122
  * Preserves provider error details when OpenAI rejects input or output because
113
123
  * it violates a content policy.
114
124
  *
@@ -125,6 +135,8 @@ declare module "effect/unstable/ai/AiError" {
125
135
  /**
126
136
  * OpenAI metadata attached to `InvalidRequestError` values.
127
137
  *
138
+ * **Details**
139
+ *
128
140
  * Preserves provider error details for malformed requests, unsupported
129
141
  * parameters, or other request validation failures reported by OpenAI.
130
142
  *
@@ -141,6 +153,8 @@ declare module "effect/unstable/ai/AiError" {
141
153
  /**
142
154
  * OpenAI metadata attached to `InternalProviderError` values.
143
155
  *
156
+ * **Details**
157
+ *
144
158
  * Preserves provider error details for OpenAI-side failures such as transient
145
159
  * server errors.
146
160
  *
@@ -157,6 +171,8 @@ declare module "effect/unstable/ai/AiError" {
157
171
  /**
158
172
  * OpenAI metadata attached to `InvalidOutputError` values.
159
173
  *
174
+ * **Details**
175
+ *
160
176
  * Preserves provider error details when an OpenAI response cannot be parsed or
161
177
  * validated as the expected output.
162
178
  *
@@ -173,6 +189,8 @@ declare module "effect/unstable/ai/AiError" {
173
189
  /**
174
190
  * OpenAI metadata attached to `StructuredOutputError` values.
175
191
  *
192
+ * **Details**
193
+ *
176
194
  * Preserves provider error details when OpenAI returns content that does not
177
195
  * satisfy the requested structured output schema.
178
196
  *
@@ -189,6 +207,8 @@ declare module "effect/unstable/ai/AiError" {
189
207
  /**
190
208
  * OpenAI metadata attached to `UnsupportedSchemaError` values.
191
209
  *
210
+ * **Details**
211
+ *
192
212
  * Preserves provider error details when an unsupported schema failure is
193
213
  * associated with an OpenAI response.
194
214
  *
@@ -205,6 +225,8 @@ declare module "effect/unstable/ai/AiError" {
205
225
  /**
206
226
  * OpenAI metadata attached to `UnknownError` values.
207
227
  *
228
+ * **Details**
229
+ *
208
230
  * Preserves provider error details for OpenAI failures that do not map cleanly
209
231
  * to a more specific AI error category.
210
232
  *
@@ -18,6 +18,7 @@ const ImageDetail = Schema.Literals(["low", "high", "auto"])
18
18
  * Schema for optional `include` values on OpenAI Responses requests.
19
19
  *
20
20
  * **Details**
21
+ *
21
22
  * These values request additional response fields such as image URLs, encrypted reasoning content, output logprobs, code interpreter outputs, or web search sources.
22
23
  *
23
24
  * @category schemas
@@ -17,7 +17,7 @@ import * as Telemetry from "effect/unstable/ai/Telemetry"
17
17
  * The attributes used to describe telemetry in the context of Generative
18
18
  * Artificial Intelligence (GenAI) Models requests and responses.
19
19
  *
20
- * {@see https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/}
20
+ * @see https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/
21
21
  *
22
22
  * @category models
23
23
  * @since 4.0.0
@@ -78,6 +78,8 @@ export interface ResponseAttributes {
78
78
  * The `gen_ai.openai.request.response_format` attribute has the following
79
79
  * list of well-known values.
80
80
  *
81
+ * **Details**
82
+ *
81
83
  * If one of them applies, then the respective value **MUST** be used;
82
84
  * otherwise, a custom value **MAY** be used.
83
85
  *
@@ -90,6 +92,8 @@ export type WellKnownResponseFormat = "json_object" | "json_schema" | "text"
90
92
  * The `gen_ai.openai.request.service_tier` attribute has the following
91
93
  * list of well-known values.
92
94
  *
95
+ * **Details**
96
+ *
93
97
  * If one of them applies, then the respective value **MUST** be used;
94
98
  * otherwise, a custom value **MAY** be used.
95
99
  *
@@ -123,7 +127,9 @@ const addOpenAiResponseAttributes = Telemetry.addSpanAttributes("gen_ai.openai.r
123
127
  * Applies the specified OpenAi GenAI telemetry attributes to the provided
124
128
  * `Span`.
125
129
  *
126
- * **NOTE**: This method will mutate the `Span` **in-place**.
130
+ * **Gotchas**
131
+ *
132
+ * This method will mutate the `Span` **in-place**.
127
133
  *
128
134
  * @category tracing
129
135
  * @since 4.0.0
@@ -133,7 +139,9 @@ export const addGenAIAnnotations: {
133
139
  * Applies the specified OpenAi GenAI telemetry attributes to the provided
134
140
  * `Span`.
135
141
  *
136
- * **NOTE**: This method will mutate the `Span` **in-place**.
142
+ * **Gotchas**
143
+ *
144
+ * This method will mutate the `Span` **in-place**.
137
145
  *
138
146
  * @category tracing
139
147
  * @since 4.0.0
@@ -143,7 +151,9 @@ export const addGenAIAnnotations: {
143
151
  * Applies the specified OpenAi GenAI telemetry attributes to the provided
144
152
  * `Span`.
145
153
  *
146
- * **NOTE**: This method will mutate the `Span` **in-place**.
154
+ * **Gotchas**
155
+ *
156
+ * This method will mutate the `Span` **in-place**.
147
157
  *
148
158
  * @category tracing
149
159
  * @since 4.0.0
package/src/OpenAiTool.ts CHANGED
@@ -28,11 +28,9 @@ export type OpenAiTool =
28
28
  | ReturnType<typeof WebSearchPreview>
29
29
 
30
30
  /**
31
- * OpenAI Apply Patch tool.
32
- *
33
- * Allows the model to apply diffs by creating, deleting, or updating files.
34
- * This is a local tool that runs in your environment and requires a handler
35
- * to execute file operations.
31
+ * OpenAI Apply Patch tool that allows the model to apply diffs by creating,
32
+ * deleting, or updating files. This local tool runs in your environment and
33
+ * requires a handler to execute file operations.
36
34
  *
37
35
  * @category tools
38
36
  * @since 4.0.0
@@ -53,9 +51,8 @@ export const ApplyPatch = Tool.providerDefined({
53
51
  })
54
52
 
55
53
  /**
56
- * OpenAI Code Interpreter tool.
57
- *
58
- * Allows the model to execute Python code in a sandboxed environment.
54
+ * OpenAI Code Interpreter tool that allows the model to execute Python code in
55
+ * a sandboxed environment.
59
56
  *
60
57
  * @category tools
61
58
  * @since 4.0.0
@@ -77,9 +74,8 @@ export const CodeInterpreter = Tool.providerDefined({
77
74
  })
78
75
 
79
76
  /**
80
- * OpenAI File Search tool.
81
- *
82
- * Enables the model to search through uploaded files and vector stores.
77
+ * OpenAI File Search tool that enables the model to search through uploaded
78
+ * files and vector stores.
83
79
  *
84
80
  * @category tools
85
81
  * @since 4.0.0
@@ -102,9 +98,8 @@ export const FileSearch = Tool.providerDefined({
102
98
  })
103
99
 
104
100
  /**
105
- * OpenAI Image Generation tool.
106
- *
107
- * Enables the model to generate images using the GPT image models.
101
+ * OpenAI Image Generation tool that enables the model to generate images using
102
+ * the GPT image models.
108
103
  *
109
104
  * @category tools
110
105
  * @since 4.0.0
@@ -131,10 +126,9 @@ export const ImageGeneration = Tool.providerDefined({
131
126
  })
132
127
 
133
128
  /**
134
- * OpenAI Local Shell tool.
135
- *
136
- * Enables the model to run a command with a local shell. This is a local tool
137
- * that runs in your environment and requires a handler to execute commands.
129
+ * OpenAI Local Shell tool that enables the model to run a command with a local
130
+ * shell. This local tool runs in your environment and requires a handler to
131
+ * execute commands.
138
132
  *
139
133
  * @category tools
140
134
  * @since 4.0.0
@@ -153,10 +147,8 @@ export const LocalShell = Tool.providerDefined({
153
147
  })
154
148
 
155
149
  /**
156
- * OpenAI MCP tool.
157
- *
158
- * Gives the model access to additional tools via remote Model Context Protocol
159
- * (MCP) servers
150
+ * OpenAI MCP tool that gives the model access to additional tools via remote
151
+ * Model Context Protocol (MCP) servers.
160
152
  *
161
153
  * @category tools
162
154
  * @since 4.0.0
@@ -186,11 +178,9 @@ export const Mcp = Tool.providerDefined({
186
178
  })
187
179
 
188
180
  /**
189
- * OpenAI Function Shell tool.
190
- *
191
- * Enables the model to execute one or more shell commands in a managed
192
- * environment. This is a local tool that runs in your environment and requires
193
- * a handler to execute commands.
181
+ * OpenAI Function Shell tool that enables the model to execute one or more shell
182
+ * commands in a managed environment. This local tool runs in your environment
183
+ * and requires a handler to execute commands.
194
184
  *
195
185
  * @category tools
196
186
  * @since 4.0.0
@@ -209,9 +199,8 @@ export const Shell = Tool.providerDefined({
209
199
  })
210
200
 
211
201
  /**
212
- * OpenAI Web Search tool.
213
- *
214
- * Enables the model to search the web for information.
202
+ * OpenAI Web Search tool that enables the model to search the web for
203
+ * information.
215
204
  *
216
205
  * @category tools
217
206
  * @since 4.0.0
@@ -235,9 +224,8 @@ export const WebSearch = Tool.providerDefined({
235
224
  })
236
225
 
237
226
  /**
238
- * OpenAI Web Search Preview tool.
239
- *
240
- * Preview version of the web search tool with additional features.
227
+ * OpenAI Web Search Preview tool, a preview version of the web search tool with
228
+ * additional features.
241
229
  *
242
230
  * @category tools
243
231
  * @since 4.0.0