@effect/ai-openai-compat 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/OpenAiClient.d.ts +145 -41
- package/dist/OpenAiClient.d.ts.map +1 -1
- package/dist/OpenAiClient.js +41 -5
- package/dist/OpenAiClient.js.map +1 -1
- package/dist/OpenAiConfig.d.ts +56 -8
- package/dist/OpenAiConfig.d.ts.map +1 -1
- package/dist/OpenAiConfig.js +35 -4
- package/dist/OpenAiConfig.js.map +1 -1
- package/dist/OpenAiEmbeddingModel.d.ts +14 -9
- package/dist/OpenAiEmbeddingModel.d.ts.map +1 -1
- package/dist/OpenAiEmbeddingModel.js +9 -6
- package/dist/OpenAiEmbeddingModel.js.map +1 -1
- package/dist/OpenAiError.d.ts +85 -3
- package/dist/OpenAiError.d.ts.map +1 -1
- package/dist/OpenAiError.js +14 -1
- package/dist/OpenAiLanguageModel.d.ts +161 -12
- package/dist/OpenAiLanguageModel.d.ts.map +1 -1
- package/dist/OpenAiLanguageModel.js +9 -7
- package/dist/OpenAiLanguageModel.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/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/package.json +3 -3
- package/src/OpenAiClient.ts +169 -42
- package/src/OpenAiConfig.ts +56 -8
- package/src/OpenAiEmbeddingModel.ts +16 -11
- package/src/OpenAiError.ts +85 -3
- package/src/OpenAiLanguageModel.ts +164 -15
- package/src/OpenAiTelemetry.ts +14 -11
- package/src/index.ts +7 -7
package/dist/OpenAiConfig.d.ts
CHANGED
|
@@ -1,45 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `OpenAiConfig` module provides shared configuration for clients that
|
|
3
|
+
* talk to OpenAI-compatible APIs. It is used to customize the HTTP client
|
|
4
|
+
* wiring around a provider without changing the higher-level model,
|
|
5
|
+
* embeddings, or tool-calling APIs that consume the client.
|
|
6
|
+
*
|
|
7
|
+
* **Common tasks**
|
|
8
|
+
*
|
|
9
|
+
* - Install a client transform with {@link withClientTransform}
|
|
10
|
+
* - Add provider-specific HTTP behavior, such as headers, retries, proxies, or
|
|
11
|
+
* instrumentation
|
|
12
|
+
* - Read the active configuration from the Effect context when implementing
|
|
13
|
+
* OpenAI-compatible integrations
|
|
14
|
+
*
|
|
15
|
+
* **Gotchas**
|
|
16
|
+
*
|
|
17
|
+
* - The transform receives and returns an `HttpClient`, so it should preserve
|
|
18
|
+
* the existing client behavior unless it intentionally replaces it
|
|
19
|
+
* - Configuration is provided through Effect context and is scoped to the
|
|
20
|
+
* effect that receives the service
|
|
21
|
+
*
|
|
22
|
+
* @since 4.0.0
|
|
3
23
|
*/
|
|
4
24
|
import * as Context from "effect/Context";
|
|
5
25
|
import * as Effect from "effect/Effect";
|
|
6
26
|
import type { HttpClient } from "effect/unstable/http/HttpClient";
|
|
7
27
|
declare const OpenAiConfig_base: Context.ServiceClass<OpenAiConfig, "@effect/ai-openai-compat/OpenAiConfig", OpenAiConfig.Service>;
|
|
8
28
|
/**
|
|
9
|
-
*
|
|
29
|
+
* Context service used to carry OpenAI-compatible client configuration for the
|
|
30
|
+
* current Effect scope.
|
|
31
|
+
*
|
|
10
32
|
* @category services
|
|
33
|
+
* @since 4.0.0
|
|
11
34
|
*/
|
|
12
35
|
export declare class OpenAiConfig extends OpenAiConfig_base {
|
|
13
36
|
/**
|
|
14
|
-
*
|
|
37
|
+
* Gets the configured OpenAI-compatible service from the current context when present.
|
|
38
|
+
*
|
|
39
|
+
* @since 4.0.0
|
|
15
40
|
*/
|
|
16
41
|
static readonly getOrUndefined: Effect.Effect<typeof OpenAiConfig.Service | undefined>;
|
|
17
42
|
}
|
|
18
43
|
/**
|
|
19
|
-
*
|
|
44
|
+
* Types associated with the `OpenAiConfig` context service.
|
|
45
|
+
*
|
|
46
|
+
* @since 4.0.0
|
|
20
47
|
*/
|
|
21
48
|
export declare namespace OpenAiConfig {
|
|
22
49
|
/**
|
|
23
|
-
*
|
|
50
|
+
* Configuration consumed by OpenAI-compatible clients when they build or
|
|
51
|
+
* resolve the underlying HTTP client.
|
|
52
|
+
*
|
|
24
53
|
* @category models
|
|
54
|
+
* @since 1.0.
|
|
25
55
|
*/
|
|
26
56
|
interface Service {
|
|
27
57
|
readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined;
|
|
28
58
|
}
|
|
29
59
|
}
|
|
30
60
|
/**
|
|
31
|
-
*
|
|
61
|
+
* Provides an HTTP client transform for the supplied effect.
|
|
62
|
+
*
|
|
63
|
+
* The transform is read by OpenAI-compatible provider services from the
|
|
64
|
+
* `OpenAiConfig` context and can be used to add provider-specific behavior such
|
|
65
|
+
* as headers, retries, instrumentation, or proxy routing.
|
|
66
|
+
*
|
|
32
67
|
* @category configuration
|
|
68
|
+
* @since 4.0.0
|
|
33
69
|
*/
|
|
34
70
|
export declare const withClientTransform: {
|
|
35
71
|
/**
|
|
36
|
-
*
|
|
72
|
+
* Provides an HTTP client transform for the supplied effect.
|
|
73
|
+
*
|
|
74
|
+
* The transform is read by OpenAI-compatible provider services from the
|
|
75
|
+
* `OpenAiConfig` context and can be used to add provider-specific behavior such
|
|
76
|
+
* as headers, retries, instrumentation, or proxy routing.
|
|
77
|
+
*
|
|
37
78
|
* @category configuration
|
|
79
|
+
* @since 4.0.0
|
|
38
80
|
*/
|
|
39
81
|
(transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
40
82
|
/**
|
|
41
|
-
*
|
|
83
|
+
* Provides an HTTP client transform for the supplied effect.
|
|
84
|
+
*
|
|
85
|
+
* The transform is read by OpenAI-compatible provider services from the
|
|
86
|
+
* `OpenAiConfig` context and can be used to add provider-specific behavior such
|
|
87
|
+
* as headers, retries, instrumentation, or proxy routing.
|
|
88
|
+
*
|
|
42
89
|
* @category configuration
|
|
90
|
+
* @since 4.0.0
|
|
43
91
|
*/
|
|
44
92
|
<A, E, R>(self: Effect.Effect<A, E, R>, transform: (client: HttpClient) => HttpClient): Effect.Effect<A, E, R>;
|
|
45
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiConfig.d.ts","sourceRoot":"","sources":["../src/OpenAiConfig.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OpenAiConfig.d.ts","sourceRoot":"","sources":["../src/OpenAiConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;;AAEjE;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,iBAGU;IAC1C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC,CAGrF;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC;;;;;;OAMG;IACH,UAAiB,OAAO;QACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,GAAG,SAAS,CAAA;KAC5E;CACF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE;IAChC;;;;;;;;;OASG;IACH,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAClH;;;;;;;;;OASG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACN,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAQvB,CAAA"}
|
package/dist/OpenAiConfig.js
CHANGED
|
@@ -1,22 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `OpenAiConfig` module provides shared configuration for clients that
|
|
3
|
+
* talk to OpenAI-compatible APIs. It is used to customize the HTTP client
|
|
4
|
+
* wiring around a provider without changing the higher-level model,
|
|
5
|
+
* embeddings, or tool-calling APIs that consume the client.
|
|
6
|
+
*
|
|
7
|
+
* **Common tasks**
|
|
8
|
+
*
|
|
9
|
+
* - Install a client transform with {@link withClientTransform}
|
|
10
|
+
* - Add provider-specific HTTP behavior, such as headers, retries, proxies, or
|
|
11
|
+
* instrumentation
|
|
12
|
+
* - Read the active configuration from the Effect context when implementing
|
|
13
|
+
* OpenAI-compatible integrations
|
|
14
|
+
*
|
|
15
|
+
* **Gotchas**
|
|
16
|
+
*
|
|
17
|
+
* - The transform receives and returns an `HttpClient`, so it should preserve
|
|
18
|
+
* the existing client behavior unless it intentionally replaces it
|
|
19
|
+
* - Configuration is provided through Effect context and is scoped to the
|
|
20
|
+
* effect that receives the service
|
|
21
|
+
*
|
|
22
|
+
* @since 4.0.0
|
|
3
23
|
*/
|
|
4
24
|
import * as Context from "effect/Context";
|
|
5
25
|
import * as Effect from "effect/Effect";
|
|
6
26
|
import { dual } from "effect/Function";
|
|
7
27
|
/**
|
|
8
|
-
*
|
|
28
|
+
* Context service used to carry OpenAI-compatible client configuration for the
|
|
29
|
+
* current Effect scope.
|
|
30
|
+
*
|
|
9
31
|
* @category services
|
|
32
|
+
* @since 4.0.0
|
|
10
33
|
*/
|
|
11
34
|
export class OpenAiConfig extends /*#__PURE__*/Context.Service()("@effect/ai-openai-compat/OpenAiConfig") {
|
|
12
35
|
/**
|
|
13
|
-
*
|
|
36
|
+
* Gets the configured OpenAI-compatible service from the current context when present.
|
|
37
|
+
*
|
|
38
|
+
* @since 4.0.0
|
|
14
39
|
*/
|
|
15
40
|
static getOrUndefined = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.context(), context => context.mapUnsafe.get(OpenAiConfig.key));
|
|
16
41
|
}
|
|
17
42
|
/**
|
|
18
|
-
*
|
|
43
|
+
* Provides an HTTP client transform for the supplied effect.
|
|
44
|
+
*
|
|
45
|
+
* The transform is read by OpenAI-compatible provider services from the
|
|
46
|
+
* `OpenAiConfig` context and can be used to add provider-specific behavior such
|
|
47
|
+
* as headers, retries, instrumentation, or proxy routing.
|
|
48
|
+
*
|
|
19
49
|
* @category configuration
|
|
50
|
+
* @since 4.0.0
|
|
20
51
|
*/
|
|
21
52
|
export const withClientTransform = /*#__PURE__*/dual(2, (self, transformClient) => Effect.flatMap(OpenAiConfig.getOrUndefined, config => Effect.provideService(self, OpenAiConfig, {
|
|
22
53
|
...config,
|
package/dist/OpenAiConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiConfig.js","names":["Context","Effect","dual","OpenAiConfig","Service","getOrUndefined","map","context","mapUnsafe","get","key","withClientTransform","self","transformClient","flatMap","config","provideService"],"sources":["../src/OpenAiConfig.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OpenAiConfig.js","names":["Context","Effect","dual","OpenAiConfig","Service","getOrUndefined","map","context","mapUnsafe","get","key","withClientTransform","self","transformClient","flatMap","config","provideService"],"sources":["../src/OpenAiConfig.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AAGtC;;;;;;;AAOA,OAAM,MAAOC,YAAa,sBAAQH,OAAO,CAACI,OAAO,EAG9C,CAAC,uCAAuC,CAAC;EAC1C;;;;;EAKA,OAAgBC,cAAc,gBAA2DJ,MAAM,CAACK,GAAG,cACjGL,MAAM,CAACM,OAAO,EAAS,EACtBA,OAAO,IAAKA,OAAO,CAACC,SAAS,CAACC,GAAG,CAACN,YAAY,CAACO,GAAG,CAAC,CACrD;;AAqBH;;;;;;;;;;AAUA,OAAO,MAAMC,mBAAmB,gBA0B5BT,IAAI,CAAC,CAAC,EAAE,CACVU,IAA4B,EAC5BC,eAAmD,KAEnDZ,MAAM,CAACa,OAAO,CACZX,YAAY,CAACE,cAAc,EAC1BU,MAAM,IAAKd,MAAM,CAACe,cAAc,CAACJ,IAAI,EAAET,YAAY,EAAE;EAAE,GAAGY,MAAM;EAAEF;AAAe,CAAE,CAAC,CACtF,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides an EmbeddingModel implementation for OpenAI-compatible embeddings APIs.
|
|
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";
|
|
@@ -12,8 +12,10 @@ import * as EmbeddingModel from "effect/unstable/ai/EmbeddingModel";
|
|
|
12
12
|
import * as AiModel from "effect/unstable/ai/Model";
|
|
13
13
|
import { OpenAiClient } from "./OpenAiClient.ts";
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* A model identifier accepted by an OpenAI-compatible embeddings endpoint.
|
|
16
|
+
*
|
|
16
17
|
* @category models
|
|
18
|
+
* @since 4.0.0
|
|
17
19
|
*/
|
|
18
20
|
export type Model = string;
|
|
19
21
|
declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openai-compat/OpenAiEmbeddingModel/Config", {
|
|
@@ -26,14 +28,17 @@ declare const Config_base: Context.ServiceClass<Config, "@effect/ai-openai-compa
|
|
|
26
28
|
/**
|
|
27
29
|
* Service definition for OpenAI embedding model configuration.
|
|
28
30
|
*
|
|
29
|
-
* @since 1.0.0
|
|
30
31
|
* @category context
|
|
32
|
+
* @since 4.0.0
|
|
31
33
|
*/
|
|
32
34
|
export declare class Config extends Config_base {
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Creates an OpenAI-compatible embedding model that can be used with
|
|
38
|
+
* `AiModel.provide`.
|
|
39
|
+
*
|
|
36
40
|
* @category constructors
|
|
41
|
+
* @since 4.0.0
|
|
37
42
|
*/
|
|
38
43
|
export declare const model: (model: string, options: {
|
|
39
44
|
readonly dimensions: number;
|
|
@@ -42,8 +47,8 @@ export declare const model: (model: string, options: {
|
|
|
42
47
|
/**
|
|
43
48
|
* Creates an OpenAI embedding model service.
|
|
44
49
|
*
|
|
45
|
-
* @since 1.0.0
|
|
46
50
|
* @category constructors
|
|
51
|
+
* @since 4.0.0
|
|
47
52
|
*/
|
|
48
53
|
export declare const make: (args_0: {
|
|
49
54
|
readonly model: string;
|
|
@@ -52,8 +57,8 @@ export declare const make: (args_0: {
|
|
|
52
57
|
/**
|
|
53
58
|
* Creates a layer for the OpenAI embedding model.
|
|
54
59
|
*
|
|
55
|
-
* @since 1.0.0
|
|
56
60
|
* @category layers
|
|
61
|
+
* @since 4.0.0
|
|
57
62
|
*/
|
|
58
63
|
export declare const layer: (options: {
|
|
59
64
|
readonly model: string;
|
|
@@ -62,22 +67,22 @@ export declare const layer: (options: {
|
|
|
62
67
|
/**
|
|
63
68
|
* Provides config overrides for OpenAI embedding model operations.
|
|
64
69
|
*
|
|
65
|
-
* @since 1.0.0
|
|
66
70
|
* @category configuration
|
|
71
|
+
* @since 4.0.0
|
|
67
72
|
*/
|
|
68
73
|
export declare const withConfigOverride: {
|
|
69
74
|
/**
|
|
70
75
|
* Provides config overrides for OpenAI embedding model operations.
|
|
71
76
|
*
|
|
72
|
-
* @since 1.0.0
|
|
73
77
|
* @category configuration
|
|
78
|
+
* @since 4.0.0
|
|
74
79
|
*/
|
|
75
80
|
(overrides: typeof Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Config>>;
|
|
76
81
|
/**
|
|
77
82
|
* Provides config overrides for OpenAI embedding model operations.
|
|
78
83
|
*
|
|
79
|
-
* @since 1.0.0
|
|
80
84
|
* @category configuration
|
|
85
|
+
* @since 4.0.0
|
|
81
86
|
*/
|
|
82
87
|
<A, E, R>(self: Effect.Effect<A, E, R>, overrides: typeof Config.Service): Effect.Effect<A, E, Exclude<R, Config>>;
|
|
83
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiEmbeddingModel.d.ts","sourceRoot":"","sources":["../src/OpenAiEmbeddingModel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD
|
|
1
|
+
{"version":3,"file":"OpenAiEmbeddingModel.d.ts","sourceRoot":"","sources":["../src/OpenAiEmbeddingModel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,cAAc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,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;IACtH;;;;;OAKG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;CAwBhH,CAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides an EmbeddingModel implementation for OpenAI-compatible embeddings APIs.
|
|
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,16 @@ 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 context
|
|
20
|
+
* @since 4.0.0
|
|
21
21
|
*/
|
|
22
22
|
export class Config extends /*#__PURE__*/Context.Service()("@effect/ai-openai-compat/OpenAiEmbeddingModel/Config") {}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Creates an OpenAI-compatible embedding model that can be used with
|
|
25
|
+
* `AiModel.provide`.
|
|
26
|
+
*
|
|
25
27
|
* @category constructors
|
|
28
|
+
* @since 4.0.0
|
|
26
29
|
*/
|
|
27
30
|
export const model = (model, options) => AiModel.make("openai", model, Layer.merge(layer({
|
|
28
31
|
model,
|
|
@@ -34,8 +37,8 @@ export const model = (model, options) => AiModel.make("openai", model, Layer.mer
|
|
|
34
37
|
/**
|
|
35
38
|
* Creates an OpenAI embedding model service.
|
|
36
39
|
*
|
|
37
|
-
* @since 1.0.0
|
|
38
40
|
* @category constructors
|
|
41
|
+
* @since 4.0.0
|
|
39
42
|
*/
|
|
40
43
|
export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
|
|
41
44
|
model,
|
|
@@ -66,15 +69,15 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
|
|
|
66
69
|
/**
|
|
67
70
|
* Creates a layer for the OpenAI embedding model.
|
|
68
71
|
*
|
|
69
|
-
* @since 1.0.0
|
|
70
72
|
* @category layers
|
|
73
|
+
* @since 4.0.0
|
|
71
74
|
*/
|
|
72
75
|
export const layer = options => Layer.effect(EmbeddingModel.EmbeddingModel, make(options));
|
|
73
76
|
/**
|
|
74
77
|
* Provides config overrides for OpenAI embedding model operations.
|
|
75
78
|
*
|
|
76
|
-
* @since 1.0.0
|
|
77
79
|
* @category configuration
|
|
80
|
+
* @since 4.0.0
|
|
78
81
|
*/
|
|
79
82
|
export const withConfigOverride = /*#__PURE__*/dual(2, (self, overrides) => Effect.flatMap(Effect.serviceOption(Config), config => Effect.provideService(self, Config, {
|
|
80
83
|
...(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;AAEnD,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;AAEnD,SAASC,YAAY,QAAQ,mBAAmB;AAUhD;;;;;;AAMA,OAAM,MAAOC,MAAO,sBAAQR,OAAO,CAACS,OAAO,EAaxC,CAAC,sDAAsD,CAAC;AAE3D;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAGA,CACnBA,KAAa,EACbC,OAGC,KAEDL,OAAO,CAACM,IAA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G;IACA,IAAI,CAACN,KAAK,CAACQ,OAAO,CAACL,KAAK,CAACM,SAAS,CAAC,EAAE;MACnC,OAAO1D,MAAM,CAAC8C,IAAI,CAACC,aAAa,CAAC,mDAAmDK,KAAK,CAACG,KAAK,EAAE,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,oCAAoCG,IAAI,CAACU,IAAI,wBAAwBhB,WAAW,EAAE,CAAC,CAClG;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
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `OpenAiError` module defines OpenAI-specific metadata that can be
|
|
3
|
+
* attached to the shared `AiError` error types used by the AI packages. It is
|
|
4
|
+
* primarily used by OpenAI-compatible clients to preserve provider details
|
|
5
|
+
* such as error codes, error types, request IDs, and rate limit headers while
|
|
6
|
+
* still exposing errors through the provider-neutral Effect AI error model.
|
|
7
|
+
*
|
|
8
|
+
* Use this module when mapping OpenAI API failures into `AiError` values and
|
|
9
|
+
* when consumers need enough structured metadata to debug failed requests,
|
|
10
|
+
* inspect quota or rate limit responses, or correlate an error with OpenAI
|
|
11
|
+
* support. The exported types are metadata shapes only; the module augmentation
|
|
12
|
+
* makes those shapes available on the corresponding shared AI error metadata
|
|
13
|
+
* interfaces without defining new runtime error classes.
|
|
14
|
+
*
|
|
15
|
+
* @since 4.0.0
|
|
3
16
|
*/
|
|
4
17
|
/**
|
|
5
18
|
* OpenAI-specific error metadata fields.
|
|
6
19
|
*
|
|
7
|
-
* @since 1.0.0
|
|
8
20
|
* @category models
|
|
21
|
+
* @since 4.0.0
|
|
9
22
|
*/
|
|
10
23
|
export type OpenAiErrorMetadata = {
|
|
11
24
|
/**
|
|
@@ -27,8 +40,8 @@ export type OpenAiErrorMetadata = {
|
|
|
27
40
|
* Extends base error metadata with rate limit specific information from
|
|
28
41
|
* OpenAI's rate limit headers.
|
|
29
42
|
*
|
|
30
|
-
* @since 1.0.0
|
|
31
43
|
* @category models
|
|
44
|
+
* @since 4.0.0
|
|
32
45
|
*/
|
|
33
46
|
export type OpenAiRateLimitMetadata = OpenAiErrorMetadata & {
|
|
34
47
|
/**
|
|
@@ -49,33 +62,102 @@ export type OpenAiRateLimitMetadata = OpenAiErrorMetadata & {
|
|
|
49
62
|
readonly resetTokens: string | null;
|
|
50
63
|
};
|
|
51
64
|
declare module "effect/unstable/ai/AiError" {
|
|
65
|
+
/**
|
|
66
|
+
* Metadata attached to rate limit errors returned by OpenAI-compatible APIs.
|
|
67
|
+
*
|
|
68
|
+
* @category models
|
|
69
|
+
* @since 4.0.0
|
|
70
|
+
*/
|
|
52
71
|
interface RateLimitErrorMetadata {
|
|
53
72
|
readonly openai?: OpenAiRateLimitMetadata | null;
|
|
54
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Metadata attached when an OpenAI-compatible provider reports that quota or
|
|
76
|
+
* billing limits have been exhausted.
|
|
77
|
+
*
|
|
78
|
+
* @category models
|
|
79
|
+
* @since 4.0.0
|
|
80
|
+
*/
|
|
55
81
|
interface QuotaExhaustedErrorMetadata {
|
|
56
82
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
57
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Metadata attached to authentication failures from OpenAI-compatible APIs,
|
|
86
|
+
* such as invalid, missing, or unauthorized API credentials.
|
|
87
|
+
*
|
|
88
|
+
* @category models
|
|
89
|
+
* @since 4.0.0
|
|
90
|
+
*/
|
|
58
91
|
interface AuthenticationErrorMetadata {
|
|
59
92
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
60
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Metadata attached when an OpenAI-compatible provider rejects content because
|
|
96
|
+
* it violates a safety or usage policy.
|
|
97
|
+
*
|
|
98
|
+
* @category models
|
|
99
|
+
* @since 4.0.0
|
|
100
|
+
*/
|
|
61
101
|
interface ContentPolicyErrorMetadata {
|
|
62
102
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
63
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Metadata attached to malformed or unsupported requests rejected by an
|
|
106
|
+
* OpenAI-compatible API before model execution.
|
|
107
|
+
*
|
|
108
|
+
* @category models
|
|
109
|
+
* @since 4.0.0
|
|
110
|
+
*/
|
|
64
111
|
interface InvalidRequestErrorMetadata {
|
|
65
112
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
66
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Metadata attached to unexpected server-side failures reported by an
|
|
116
|
+
* OpenAI-compatible provider.
|
|
117
|
+
*
|
|
118
|
+
* @category models
|
|
119
|
+
* @since 4.0.0
|
|
120
|
+
*/
|
|
67
121
|
interface InternalProviderErrorMetadata {
|
|
68
122
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
69
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Metadata attached when an OpenAI-compatible response cannot be converted
|
|
126
|
+
* into the expected AI package output shape.
|
|
127
|
+
*
|
|
128
|
+
* @category models
|
|
129
|
+
* @since 4.0.0
|
|
130
|
+
*/
|
|
70
131
|
interface InvalidOutputErrorMetadata {
|
|
71
132
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
72
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Metadata attached when an OpenAI-compatible structured output response does
|
|
136
|
+
* not satisfy the requested schema or parsing constraints.
|
|
137
|
+
*
|
|
138
|
+
* @category models
|
|
139
|
+
* @since 4.0.0
|
|
140
|
+
*/
|
|
73
141
|
interface StructuredOutputErrorMetadata {
|
|
74
142
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
75
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Metadata attached when an OpenAI-compatible provider cannot support the
|
|
146
|
+
* schema supplied for structured output or tool definitions.
|
|
147
|
+
*
|
|
148
|
+
* @category models
|
|
149
|
+
* @since 4.0.0
|
|
150
|
+
*/
|
|
76
151
|
interface UnsupportedSchemaErrorMetadata {
|
|
77
152
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
78
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Metadata attached when an OpenAI-compatible error response cannot be mapped
|
|
156
|
+
* to a more specific shared AI error category.
|
|
157
|
+
*
|
|
158
|
+
* @category models
|
|
159
|
+
* @since 4.0.0
|
|
160
|
+
*/
|
|
79
161
|
interface UnknownErrorMetadata {
|
|
80
162
|
readonly openai?: OpenAiErrorMetadata | null;
|
|
81
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAiError.d.ts","sourceRoot":"","sources":["../src/OpenAiError.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OpenAiError.d.ts","sourceRoot":"","sources":["../src/OpenAiError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,QAAQ,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mBAAmB,GAAG,IAAI,CAAA;KAC7C;IAED;;;;;;OAMG;IACH,UAAiB,6BAA6B;QAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAC7C;IAED;;;;;;OAMG;IACH,UAAiB,8BAA8B;QAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAC7C;IAED;;;;;;OAMG;IACH,UAAiB,oBAAoB;QACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;KAC7C;CACF"}
|
package/dist/OpenAiError.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The `OpenAiError` module defines OpenAI-specific metadata that can be
|
|
3
|
+
* attached to the shared `AiError` error types used by the AI packages. It is
|
|
4
|
+
* primarily used by OpenAI-compatible clients to preserve provider details
|
|
5
|
+
* such as error codes, error types, request IDs, and rate limit headers while
|
|
6
|
+
* still exposing errors through the provider-neutral Effect AI error model.
|
|
7
|
+
*
|
|
8
|
+
* Use this module when mapping OpenAI API failures into `AiError` values and
|
|
9
|
+
* when consumers need enough structured metadata to debug failed requests,
|
|
10
|
+
* inspect quota or rate limit responses, or correlate an error with OpenAI
|
|
11
|
+
* support. The exported types are metadata shapes only; the module augmentation
|
|
12
|
+
* makes those shapes available on the corresponding shared AI error metadata
|
|
13
|
+
* interfaces without defining new runtime error classes.
|
|
14
|
+
*
|
|
15
|
+
* @since 4.0.0
|
|
3
16
|
*/
|
|
4
17
|
export {};
|
|
5
18
|
//# sourceMappingURL=OpenAiError.js.map
|