@effect/ai-openai-compat 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/src/index.ts CHANGED
@@ -1,16 +1,59 @@
1
1
  /**
2
- * @since 1.0.0
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 1.0.0
8
+ * The `OpenAiClient` module provides an Effect service for calling
9
+ * OpenAI-compatible chat completions and embeddings APIs. It builds on the
10
+ * Effect HTTP client, adds authentication and OpenAI header handling, and
11
+ * exposes typed helpers for regular responses, server-sent event streaming, and
12
+ * embedding requests.
13
+ *
14
+ * **Common tasks**
15
+ *
16
+ * - Create a client service directly with {@link make}
17
+ * - Provide the service as a layer with {@link layer} or {@link layerConfig}
18
+ * - Send non-streaming chat completion requests with `createResponse`
19
+ * - Send streaming chat completion requests with `createResponseStream`
20
+ * - Generate embeddings with `createEmbedding`
21
+ * - Reuse the exported request and response types when integrating compatible providers
22
+ *
23
+ * **Gotchas**
24
+ *
25
+ * - The default base URL is `https://api.openai.com/v1`; set `apiUrl` for other
26
+ * OpenAI-compatible providers.
27
+ * - `createResponseStream` forces `stream: true` and requests usage events with
28
+ * `stream_options.include_usage`.
29
+ * - HTTP and schema decoding failures are mapped into `AiError`.
30
+ *
31
+ * @since 4.0.0
9
32
  */
10
33
  export * as OpenAiClient from "./OpenAiClient.ts"
11
34
 
12
35
  /**
13
- * @since 1.0.0
36
+ * The `OpenAiConfig` module provides shared configuration for clients that
37
+ * talk to OpenAI-compatible APIs. It is used to customize the HTTP client
38
+ * wiring around a provider without changing the higher-level model,
39
+ * embeddings, or tool-calling APIs that consume the client.
40
+ *
41
+ * **Common tasks**
42
+ *
43
+ * - Install a client transform with {@link withClientTransform}
44
+ * - Add provider-specific HTTP behavior, such as headers, retries, proxies, or
45
+ * instrumentation
46
+ * - Read the active configuration from the Effect context when implementing
47
+ * OpenAI-compatible integrations
48
+ *
49
+ * **Gotchas**
50
+ *
51
+ * - The transform receives and returns an `HttpClient`, so it should preserve
52
+ * the existing client behavior unless it intentionally replaces it
53
+ * - Configuration is provided through Effect context and is scoped to the
54
+ * effect that receives the service
55
+ *
56
+ * @since 4.0.0
14
57
  */
15
58
  export * as OpenAiConfig from "./OpenAiConfig.ts"
16
59
 
@@ -19,12 +62,25 @@ export * as OpenAiConfig from "./OpenAiConfig.ts"
19
62
  *
20
63
  * Provides an EmbeddingModel implementation for OpenAI-compatible embeddings APIs.
21
64
  *
22
- * @since 1.0.0
65
+ * @since 4.0.0
23
66
  */
24
67
  export * as OpenAiEmbeddingModel from "./OpenAiEmbeddingModel.ts"
25
68
 
26
69
  /**
27
- * @since 1.0.0
70
+ * The `OpenAiError` module defines OpenAI-specific metadata that can be
71
+ * attached to the shared `AiError` error types used by the AI packages. It is
72
+ * primarily used by OpenAI-compatible clients to preserve provider details
73
+ * such as error codes, error types, request IDs, and rate limit headers while
74
+ * still exposing errors through the provider-neutral Effect AI error model.
75
+ *
76
+ * Use this module when mapping OpenAI API failures into `AiError` values and
77
+ * when consumers need enough structured metadata to debug failed requests,
78
+ * inspect quota or rate limit responses, or correlate an error with OpenAI
79
+ * support. The exported types are metadata shapes only; the module augmentation
80
+ * makes those shapes available on the corresponding shared AI error metadata
81
+ * interfaces without defining new runtime error classes.
82
+ *
83
+ * @since 4.0.0
28
84
  */
29
85
  export * as OpenAiError from "./OpenAiError.ts"
30
86
 
@@ -34,7 +90,7 @@ export * as OpenAiError from "./OpenAiError.ts"
34
90
  * Provides a LanguageModel implementation for OpenAI's chat completions API,
35
91
  * supporting text generation, structured output, tool calling, and streaming.
36
92
  *
37
- * @since 1.0.0
93
+ * @since 4.0.0
38
94
  */
39
95
  export * as OpenAiLanguageModel from "./OpenAiLanguageModel.ts"
40
96
 
@@ -45,6 +101,6 @@ export * as OpenAiLanguageModel from "./OpenAiLanguageModel.ts"
45
101
  * semantic conventions, extending the base GenAI attributes with OpenAI-specific
46
102
  * request and response metadata.
47
103
  *
48
- * @since 1.0.0
104
+ * @since 4.0.0
49
105
  */
50
106
  export * as OpenAiTelemetry from "./OpenAiTelemetry.ts"