@opencode/ai 0.0.0-dev-21798 → 0.0.0-dev-21800
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/README.md +55 -55
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -1
- package/dist/decision-client.d.ts +21 -0
- package/dist/decision-client.js +55 -0
- package/dist/decision.d.ts +452 -0
- package/dist/decision.js +143 -0
- package/dist/experimental.d.ts +0 -3
- package/dist/experimental.js +0 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/promise.d.ts +10 -1
- package/dist/promise.js +5 -0
- package/dist/protocols/alibaba-messages.d.ts +34 -0
- package/dist/protocols/anthropic-messages.d.ts +102 -0
- package/dist/protocols/anthropic-messages.js +32 -8
- package/dist/protocols/cloudflare-run-decisions.d.ts +9 -0
- package/dist/protocols/cloudflare-run-decisions.js +36 -0
- package/dist/protocols/index.d.ts +3 -0
- package/dist/protocols/index.js +3 -0
- package/dist/protocols/meta-messages.d.ts +34 -0
- package/dist/protocols/meta-messages.js +12 -0
- package/dist/protocols/openai-decisions.d.ts +22 -0
- package/dist/protocols/openai-decisions.js +108 -0
- package/dist/protocols/shared.d.ts +1 -1
- package/dist/protocols/shared.js +2 -2
- package/dist/protocols/system-one.d.ts +99 -0
- package/dist/protocols/system-one.js +228 -0
- package/dist/protocols/zai-messages.d.ts +34 -0
- package/dist/providers/alibaba.d.ts +34 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +34 -0
- package/dist/providers/anthropic-compatible.d.ts +34 -0
- package/dist/providers/anthropic.d.ts +34 -0
- package/dist/providers/baseten.d.ts +4 -10
- package/dist/providers/baseten.js +21 -8
- package/dist/providers/cloudflare-ai-gateway.d.ts +69 -3
- package/dist/providers/cloudflare-ai-gateway.js +10 -10
- package/dist/providers/cloudflare-workers-ai.d.ts +1 -3
- package/dist/providers/cloudflare-workers-ai.js +11 -12
- package/dist/providers/digitalocean.d.ts +3 -9
- package/dist/providers/digitalocean.js +10 -10
- package/dist/providers/google-vertex-messages.d.ts +34 -0
- package/dist/providers/meta.d.ts +34 -0
- package/dist/providers/minimax.d.ts +34 -0
- package/dist/providers/moonshot.d.ts +34 -0
- package/dist/providers/openai.d.ts +5 -10
- package/dist/providers/openai.js +11 -7
- package/dist/providers/opencode.d.ts +3 -9
- package/dist/providers/opencode.js +9 -9
- package/dist/providers/openrouter.d.ts +4 -10
- package/dist/providers/openrouter.js +8 -9
- package/dist/providers/typesafe-ai.d.ts +3 -9
- package/dist/providers/typesafe-ai.js +9 -9
- package/dist/providers/vercel-ai-gateway.d.ts +4 -15
- package/dist/providers/vercel-ai-gateway.js +13 -80
- package/dist/providers/zai-coding-plan.d.ts +34 -0
- package/dist/route/client.js +11 -0
- package/dist/route/decision.d.ts +57 -0
- package/dist/route/decision.js +74 -0
- package/package.json +3 -3
- package/dist/experimental/cloudflare-run-evaluation.d.ts +0 -15
- package/dist/experimental/cloudflare-run-evaluation.js +0 -43
- package/dist/experimental/evaluation-client.d.ts +0 -21
- package/dist/experimental/evaluation-client.js +0 -64
- package/dist/experimental/evaluation.d.ts +0 -242
- package/dist/experimental/evaluation.js +0 -108
- package/dist/experimental/openai-decisions.d.ts +0 -23
- package/dist/experimental/openai-decisions.js +0 -115
- package/dist/experimental/system-one.d.ts +0 -114
- package/dist/experimental/system-one.js +0 -140
|
@@ -286,6 +286,23 @@ export declare const messagesRoute: import("../route/client.js").Route<{
|
|
|
286
286
|
readonly transformations?: {
|
|
287
287
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
288
288
|
} | undefined;
|
|
289
|
+
} | {
|
|
290
|
+
readonly type: "video";
|
|
291
|
+
readonly source: {
|
|
292
|
+
readonly type: "base64";
|
|
293
|
+
readonly media_type: string;
|
|
294
|
+
readonly data: string;
|
|
295
|
+
} | {
|
|
296
|
+
readonly type: "url";
|
|
297
|
+
readonly url: string;
|
|
298
|
+
} | {
|
|
299
|
+
readonly type: "file";
|
|
300
|
+
readonly file_id: string;
|
|
301
|
+
};
|
|
302
|
+
readonly cache_control?: {
|
|
303
|
+
readonly type: "ephemeral";
|
|
304
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
305
|
+
} | undefined;
|
|
289
306
|
} | {
|
|
290
307
|
readonly type: "document";
|
|
291
308
|
readonly source: {
|
|
@@ -342,6 +359,23 @@ export declare const messagesRoute: import("../route/client.js").Route<{
|
|
|
342
359
|
readonly transformations?: {
|
|
343
360
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
344
361
|
} | undefined;
|
|
362
|
+
} | {
|
|
363
|
+
readonly type: "video";
|
|
364
|
+
readonly source: {
|
|
365
|
+
readonly type: "base64";
|
|
366
|
+
readonly media_type: string;
|
|
367
|
+
readonly data: string;
|
|
368
|
+
} | {
|
|
369
|
+
readonly type: "url";
|
|
370
|
+
readonly url: string;
|
|
371
|
+
} | {
|
|
372
|
+
readonly type: "file";
|
|
373
|
+
readonly file_id: string;
|
|
374
|
+
};
|
|
375
|
+
readonly cache_control?: {
|
|
376
|
+
readonly type: "ephemeral";
|
|
377
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
378
|
+
} | undefined;
|
|
345
379
|
} | {
|
|
346
380
|
readonly type: "document";
|
|
347
381
|
readonly source: {
|
|
@@ -691,6 +725,23 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
691
725
|
readonly transformations?: {
|
|
692
726
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
693
727
|
} | undefined;
|
|
728
|
+
} | {
|
|
729
|
+
readonly type: "video";
|
|
730
|
+
readonly source: {
|
|
731
|
+
readonly type: "base64";
|
|
732
|
+
readonly media_type: string;
|
|
733
|
+
readonly data: string;
|
|
734
|
+
} | {
|
|
735
|
+
readonly type: "url";
|
|
736
|
+
readonly url: string;
|
|
737
|
+
} | {
|
|
738
|
+
readonly type: "file";
|
|
739
|
+
readonly file_id: string;
|
|
740
|
+
};
|
|
741
|
+
readonly cache_control?: {
|
|
742
|
+
readonly type: "ephemeral";
|
|
743
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
744
|
+
} | undefined;
|
|
694
745
|
} | {
|
|
695
746
|
readonly type: "document";
|
|
696
747
|
readonly source: {
|
|
@@ -747,6 +798,23 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
747
798
|
readonly transformations?: {
|
|
748
799
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
749
800
|
} | undefined;
|
|
801
|
+
} | {
|
|
802
|
+
readonly type: "video";
|
|
803
|
+
readonly source: {
|
|
804
|
+
readonly type: "base64";
|
|
805
|
+
readonly media_type: string;
|
|
806
|
+
readonly data: string;
|
|
807
|
+
} | {
|
|
808
|
+
readonly type: "url";
|
|
809
|
+
readonly url: string;
|
|
810
|
+
} | {
|
|
811
|
+
readonly type: "file";
|
|
812
|
+
readonly file_id: string;
|
|
813
|
+
};
|
|
814
|
+
readonly cache_control?: {
|
|
815
|
+
readonly type: "ephemeral";
|
|
816
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
817
|
+
} | undefined;
|
|
750
818
|
} | {
|
|
751
819
|
readonly type: "document";
|
|
752
820
|
readonly source: {
|
|
@@ -1257,9 +1325,7 @@ export declare const configure: (input: LanguageModelOptions) => {
|
|
|
1257
1325
|
endpoint: import("../route/client.js").CompactOperation;
|
|
1258
1326
|
trigger: import("../route/client.js").TriggerCompactOperation;
|
|
1259
1327
|
}>;
|
|
1260
|
-
|
|
1261
|
-
evaluation: (value: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
1262
|
-
};
|
|
1328
|
+
decision: (value: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
1263
1329
|
configure: typeof configure;
|
|
1264
1330
|
};
|
|
1265
1331
|
export declare const provider: {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SystemOne } from "../experimental/system-one.js";
|
|
1
|
+
import { CloudflareRunDecisions } from "../protocols/cloudflare-run-decisions.js";
|
|
3
2
|
import { AnthropicMessages, OpenAIChat, OpenAIResponses } from "../protocols/index.js";
|
|
4
3
|
import { Auth } from "../route/auth.js";
|
|
5
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
6
|
-
import {
|
|
5
|
+
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
7
6
|
import { encodeJson } from "../utils/json.js";
|
|
8
7
|
export const id = ProviderID.make("cloudflare-ai-gateway");
|
|
9
8
|
export const authEnvVars = ["CLOUDFLARE_API_TOKEN", "CF_AIG_TOKEN"];
|
|
@@ -83,15 +82,16 @@ export const configure = (input) => {
|
|
|
83
82
|
const responses = responsesRoute.with(passthrough("openai"));
|
|
84
83
|
const messages = messagesRoute.with(passthrough("anthropic/v1"));
|
|
85
84
|
const chat = route.with(rest);
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
// The Run API base is derived per call so a chat-only configuration without an account still constructs.
|
|
86
|
+
const decision = (value) => CloudflareRunDecisions.route
|
|
87
|
+
.with({
|
|
88
88
|
provider: id,
|
|
89
|
+
endpoint: { baseURL: runBaseURL(input) },
|
|
89
90
|
auth: rest.auth,
|
|
90
|
-
baseURL: runBaseURL(input),
|
|
91
91
|
headers: rest.headers,
|
|
92
|
-
http:
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
http: input.http,
|
|
93
|
+
})
|
|
94
|
+
.model({ id: value });
|
|
95
95
|
return {
|
|
96
96
|
id,
|
|
97
97
|
model: (value) => {
|
|
@@ -105,7 +105,7 @@ export const configure = (input) => {
|
|
|
105
105
|
return chat.model({ id: value.slice("workers-ai/".length) });
|
|
106
106
|
return chat.model({ id: value });
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
decision,
|
|
109
109
|
configure,
|
|
110
110
|
};
|
|
111
111
|
};
|
|
@@ -286,9 +286,7 @@ export declare const routes: Route<{
|
|
|
286
286
|
export declare const configure: (input: LanguageModelOptions) => {
|
|
287
287
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
288
288
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
289
|
-
|
|
290
|
-
evaluation: (modelID: string | ModelID) => import("../experimental/evaluation.js").EvaluationModel<import("../experimental/evaluation.js").EvaluationOptions>;
|
|
291
|
-
};
|
|
289
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
292
290
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("./cloudflare-workers-ai.js").CloudflareWorkersAIImageOptions>;
|
|
293
291
|
configure: typeof configure;
|
|
294
292
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EvaluationRounding } from "../experimental/evaluation.js";
|
|
1
|
+
import { CloudflareRunDecisions } from "../protocols/cloudflare-run-decisions.js";
|
|
3
2
|
import { CloudflareWorkersAIImages } from "../protocols/cloudflare-workers-ai-images.js";
|
|
4
3
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
5
4
|
import { AuthOptions } from "../route/auth-options.js";
|
|
6
5
|
import { Route } from "../route/client.js";
|
|
7
6
|
import { Endpoint } from "../route/endpoint.js";
|
|
8
7
|
import { MediaRoute } from "../route/media.js";
|
|
9
|
-
import {
|
|
8
|
+
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
10
9
|
export const id = ProviderID.make("cloudflare-workers-ai");
|
|
11
10
|
export const authEnvVars = ["CLOUDFLARE_API_KEY", "CLOUDFLARE_WORKERS_AI_TOKEN", "CLOUDFLARE_API_TOKEN"];
|
|
12
11
|
export const baseURL = (input) => {
|
|
@@ -38,24 +37,24 @@ export const route = Route.make({
|
|
|
38
37
|
framing: OpenAIChat.framing,
|
|
39
38
|
});
|
|
40
39
|
export const routes = [route];
|
|
41
|
-
const clefRounding = new EvaluationRounding({ probabilityDecimals: 4, scoreDecimals: 4 });
|
|
42
40
|
export const configure = (input) => {
|
|
43
41
|
const { accountId: _accountId, apiKey: _apiKey, auth: _auth, baseURL: _baseURL, ...defaults } = input;
|
|
44
42
|
const auth = AuthOptions.bearer(input, authEnvVars);
|
|
45
43
|
const configured = route.with({ ...defaults, endpoint: { baseURL: baseURL(input) }, auth });
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
// The Run API base is derived per call so a chat-only configuration without an account still constructs.
|
|
45
|
+
const decision = (modelID) => CloudflareRunDecisions.route
|
|
46
|
+
.with({
|
|
48
47
|
provider: id,
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
endpoint: { baseURL: runBaseURL(input) },
|
|
49
|
+
auth: auth,
|
|
51
50
|
headers: input.headers,
|
|
52
|
-
http:
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
http: input.http,
|
|
52
|
+
})
|
|
53
|
+
.model({ id: modelID });
|
|
55
54
|
return {
|
|
56
55
|
id,
|
|
57
56
|
model: (modelID) => configured.model({ id: modelID }),
|
|
58
|
-
|
|
57
|
+
decision,
|
|
59
58
|
image: (modelID) => CloudflareWorkersAIImages.model({
|
|
60
59
|
...MediaRoute.deployment({ ...input, baseURL: runBaseURL(input) }, auth),
|
|
61
60
|
id: modelID,
|
|
@@ -484,21 +484,15 @@ export declare const routes: Route<{
|
|
|
484
484
|
export declare const configure: (input?: LanguageModelOptions) => {
|
|
485
485
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
486
486
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
487
|
-
|
|
488
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
489
|
-
};
|
|
487
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
490
488
|
configure: typeof configure;
|
|
491
489
|
};
|
|
492
490
|
export declare const provider: {
|
|
493
491
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
494
492
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
495
|
-
|
|
496
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
497
|
-
};
|
|
493
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
498
494
|
configure: typeof configure;
|
|
499
495
|
};
|
|
500
|
-
export declare const
|
|
501
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
502
|
-
};
|
|
496
|
+
export declare const decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
503
497
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
504
498
|
export * as DigitalOcean from "./digitalocean.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { SystemOne } from "../protocols/system-one.js";
|
|
2
3
|
import { cacheControl } from "../protocols/utils/cache.js";
|
|
3
4
|
import { AuthOptions } from "../route/auth-options.js";
|
|
4
5
|
import { Route } from "../route/client.js";
|
|
5
6
|
import { Endpoint } from "../route/endpoint.js";
|
|
6
7
|
import { Protocol } from "../route/protocol.js";
|
|
7
|
-
import {
|
|
8
|
-
import { SystemOne } from "../experimental/system-one.js";
|
|
8
|
+
import { ProviderID } from "../schema/index.js";
|
|
9
9
|
export const id = ProviderID.make("digitalocean");
|
|
10
10
|
const baseURL = "https://inference.do-ai.run/v1";
|
|
11
11
|
export const protocol = Protocol.make({
|
|
@@ -33,16 +33,16 @@ export const configure = (input = {}) => {
|
|
|
33
33
|
endpoint: { baseURL: endpoint ?? baseURL },
|
|
34
34
|
auth,
|
|
35
35
|
});
|
|
36
|
-
const
|
|
37
|
-
id: modelID,
|
|
36
|
+
const decisionRoute = SystemOne.route.with({
|
|
38
37
|
provider: id,
|
|
39
38
|
providerMetadataKey: "digitalocean",
|
|
39
|
+
endpoint: { baseURL: endpoint ?? baseURL },
|
|
40
40
|
auth,
|
|
41
|
-
|
|
42
|
-
headers: input.headers,
|
|
43
|
-
http:
|
|
44
|
-
rounding: SystemOne.jevRounding,
|
|
41
|
+
// DigitalOcean serves TypeSafe's Jev, which needs this header for images.
|
|
42
|
+
headers: { "TypeSafe-Danger-Zone-Images": "true", ...input.headers },
|
|
43
|
+
http: input.http,
|
|
45
44
|
});
|
|
45
|
+
const decision = (modelID) => decisionRoute.model({ id: modelID });
|
|
46
46
|
return {
|
|
47
47
|
id,
|
|
48
48
|
model: (modelID) => configured.model({
|
|
@@ -51,12 +51,12 @@ export const configure = (input = {}) => {
|
|
|
51
51
|
supportsPromptCacheKey: true,
|
|
52
52
|
},
|
|
53
53
|
}),
|
|
54
|
-
|
|
54
|
+
decision,
|
|
55
55
|
configure,
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
export const provider = configure();
|
|
59
|
-
export const
|
|
59
|
+
export const decision = provider.decision;
|
|
60
60
|
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
61
61
|
apiKey,
|
|
62
62
|
baseURL,
|
|
@@ -69,6 +69,23 @@ export declare const routes: Route<{
|
|
|
69
69
|
readonly transformations?: {
|
|
70
70
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
71
71
|
} | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
readonly type: "video";
|
|
74
|
+
readonly source: {
|
|
75
|
+
readonly type: "base64";
|
|
76
|
+
readonly media_type: string;
|
|
77
|
+
readonly data: string;
|
|
78
|
+
} | {
|
|
79
|
+
readonly type: "url";
|
|
80
|
+
readonly url: string;
|
|
81
|
+
} | {
|
|
82
|
+
readonly type: "file";
|
|
83
|
+
readonly file_id: string;
|
|
84
|
+
};
|
|
85
|
+
readonly cache_control?: {
|
|
86
|
+
readonly type: "ephemeral";
|
|
87
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
88
|
+
} | undefined;
|
|
72
89
|
} | {
|
|
73
90
|
readonly type: "document";
|
|
74
91
|
readonly source: {
|
|
@@ -125,6 +142,23 @@ export declare const routes: Route<{
|
|
|
125
142
|
readonly transformations?: {
|
|
126
143
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
127
144
|
} | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
readonly type: "video";
|
|
147
|
+
readonly source: {
|
|
148
|
+
readonly type: "base64";
|
|
149
|
+
readonly media_type: string;
|
|
150
|
+
readonly data: string;
|
|
151
|
+
} | {
|
|
152
|
+
readonly type: "url";
|
|
153
|
+
readonly url: string;
|
|
154
|
+
} | {
|
|
155
|
+
readonly type: "file";
|
|
156
|
+
readonly file_id: string;
|
|
157
|
+
};
|
|
158
|
+
readonly cache_control?: {
|
|
159
|
+
readonly type: "ephemeral";
|
|
160
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
161
|
+
} | undefined;
|
|
128
162
|
} | {
|
|
129
163
|
readonly type: "document";
|
|
130
164
|
readonly source: {
|
package/dist/providers/meta.d.ts
CHANGED
|
@@ -396,6 +396,23 @@ export declare const routes: (Route<{
|
|
|
396
396
|
readonly transformations?: {
|
|
397
397
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
398
398
|
} | undefined;
|
|
399
|
+
} | {
|
|
400
|
+
readonly type: "video";
|
|
401
|
+
readonly source: {
|
|
402
|
+
readonly type: "base64";
|
|
403
|
+
readonly media_type: string;
|
|
404
|
+
readonly data: string;
|
|
405
|
+
} | {
|
|
406
|
+
readonly type: "url";
|
|
407
|
+
readonly url: string;
|
|
408
|
+
} | {
|
|
409
|
+
readonly type: "file";
|
|
410
|
+
readonly file_id: string;
|
|
411
|
+
};
|
|
412
|
+
readonly cache_control?: {
|
|
413
|
+
readonly type: "ephemeral";
|
|
414
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
415
|
+
} | undefined;
|
|
399
416
|
} | {
|
|
400
417
|
readonly type: "document";
|
|
401
418
|
readonly source: {
|
|
@@ -452,6 +469,23 @@ export declare const routes: (Route<{
|
|
|
452
469
|
readonly transformations?: {
|
|
453
470
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
454
471
|
} | undefined;
|
|
472
|
+
} | {
|
|
473
|
+
readonly type: "video";
|
|
474
|
+
readonly source: {
|
|
475
|
+
readonly type: "base64";
|
|
476
|
+
readonly media_type: string;
|
|
477
|
+
readonly data: string;
|
|
478
|
+
} | {
|
|
479
|
+
readonly type: "url";
|
|
480
|
+
readonly url: string;
|
|
481
|
+
} | {
|
|
482
|
+
readonly type: "file";
|
|
483
|
+
readonly file_id: string;
|
|
484
|
+
};
|
|
485
|
+
readonly cache_control?: {
|
|
486
|
+
readonly type: "ephemeral";
|
|
487
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
488
|
+
} | undefined;
|
|
455
489
|
} | {
|
|
456
490
|
readonly type: "document";
|
|
457
491
|
readonly source: {
|
|
@@ -83,6 +83,23 @@ export declare const routes: (Route<{
|
|
|
83
83
|
readonly transformations?: {
|
|
84
84
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
85
85
|
} | undefined;
|
|
86
|
+
} | {
|
|
87
|
+
readonly type: "video";
|
|
88
|
+
readonly source: {
|
|
89
|
+
readonly type: "base64";
|
|
90
|
+
readonly media_type: string;
|
|
91
|
+
readonly data: string;
|
|
92
|
+
} | {
|
|
93
|
+
readonly type: "url";
|
|
94
|
+
readonly url: string;
|
|
95
|
+
} | {
|
|
96
|
+
readonly type: "file";
|
|
97
|
+
readonly file_id: string;
|
|
98
|
+
};
|
|
99
|
+
readonly cache_control?: {
|
|
100
|
+
readonly type: "ephemeral";
|
|
101
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
102
|
+
} | undefined;
|
|
86
103
|
} | {
|
|
87
104
|
readonly type: "document";
|
|
88
105
|
readonly source: {
|
|
@@ -139,6 +156,23 @@ export declare const routes: (Route<{
|
|
|
139
156
|
readonly transformations?: {
|
|
140
157
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
141
158
|
} | undefined;
|
|
159
|
+
} | {
|
|
160
|
+
readonly type: "video";
|
|
161
|
+
readonly source: {
|
|
162
|
+
readonly type: "base64";
|
|
163
|
+
readonly media_type: string;
|
|
164
|
+
readonly data: string;
|
|
165
|
+
} | {
|
|
166
|
+
readonly type: "url";
|
|
167
|
+
readonly url: string;
|
|
168
|
+
} | {
|
|
169
|
+
readonly type: "file";
|
|
170
|
+
readonly file_id: string;
|
|
171
|
+
};
|
|
172
|
+
readonly cache_control?: {
|
|
173
|
+
readonly type: "ephemeral";
|
|
174
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
175
|
+
} | undefined;
|
|
142
176
|
} | {
|
|
143
177
|
readonly type: "document";
|
|
144
178
|
readonly source: {
|
|
@@ -81,6 +81,23 @@ export declare const routes: (Route<{
|
|
|
81
81
|
readonly transformations?: {
|
|
82
82
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
83
83
|
} | undefined;
|
|
84
|
+
} | {
|
|
85
|
+
readonly type: "video";
|
|
86
|
+
readonly source: {
|
|
87
|
+
readonly type: "base64";
|
|
88
|
+
readonly media_type: string;
|
|
89
|
+
readonly data: string;
|
|
90
|
+
} | {
|
|
91
|
+
readonly type: "url";
|
|
92
|
+
readonly url: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly type: "file";
|
|
95
|
+
readonly file_id: string;
|
|
96
|
+
};
|
|
97
|
+
readonly cache_control?: {
|
|
98
|
+
readonly type: "ephemeral";
|
|
99
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
100
|
+
} | undefined;
|
|
84
101
|
} | {
|
|
85
102
|
readonly type: "document";
|
|
86
103
|
readonly source: {
|
|
@@ -137,6 +154,23 @@ export declare const routes: (Route<{
|
|
|
137
154
|
readonly transformations?: {
|
|
138
155
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
139
156
|
} | undefined;
|
|
157
|
+
} | {
|
|
158
|
+
readonly type: "video";
|
|
159
|
+
readonly source: {
|
|
160
|
+
readonly type: "base64";
|
|
161
|
+
readonly media_type: string;
|
|
162
|
+
readonly data: string;
|
|
163
|
+
} | {
|
|
164
|
+
readonly type: "url";
|
|
165
|
+
readonly url: string;
|
|
166
|
+
} | {
|
|
167
|
+
readonly type: "file";
|
|
168
|
+
readonly file_id: string;
|
|
169
|
+
};
|
|
170
|
+
readonly cache_control?: {
|
|
171
|
+
readonly type: "ephemeral";
|
|
172
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
173
|
+
} | undefined;
|
|
140
174
|
} | {
|
|
141
175
|
readonly type: "document";
|
|
142
176
|
readonly source: {
|
|
@@ -4,11 +4,12 @@ import type { ProviderPackage } from "../provider-package.js";
|
|
|
4
4
|
import { ToolDefinition, type ModelID, type OpenString } from "../schema/index.js";
|
|
5
5
|
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
6
6
|
import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
7
|
+
import { type OptionsInput as OpenAIDecisionOptionsInput } from "../protocols/openai-decisions.js";
|
|
7
8
|
export type { OpenAIOptionsInput, OpenAIResponseIncludable } from "./openai-options.js";
|
|
8
9
|
export type { OpenAIImageOptions } from "../protocols/openai-images.js";
|
|
9
10
|
export type { OpenAISpeechOptions } from "../protocols/openai-speech.js";
|
|
10
11
|
export type { OpenAITranscriptionOptions } from "../protocols/openai-transcription.js";
|
|
11
|
-
export type { OpenAIDecisionOptions } from "../
|
|
12
|
+
export type { OptionsInput as OpenAIDecisionOptions } from "../protocols/openai-decisions.js";
|
|
12
13
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
13
14
|
export declare const routes: (Route<{
|
|
14
15
|
readonly model: string;
|
|
@@ -385,9 +386,7 @@ export declare const configure: (input?: Config) => {
|
|
|
385
386
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
386
387
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
387
388
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
388
|
-
|
|
389
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental/openai-decisions.js").OpenAIDecisionOptions>;
|
|
390
|
-
};
|
|
389
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
391
390
|
configure: typeof configure;
|
|
392
391
|
};
|
|
393
392
|
export declare const provider: {
|
|
@@ -404,9 +403,7 @@ export declare const provider: {
|
|
|
404
403
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
405
404
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
406
405
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
407
|
-
|
|
408
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental/openai-decisions.js").OpenAIDecisionOptions>;
|
|
409
|
-
};
|
|
406
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
|
410
407
|
configure: typeof configure;
|
|
411
408
|
};
|
|
412
409
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput, typeof OpenAIResponses.route.compact>["model"];
|
|
@@ -419,6 +416,4 @@ export declare const chat: (id: string | ModelID) => import("../schema/options.j
|
|
|
419
416
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
420
417
|
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/openai-speech.js").OpenAISpeechOptions>;
|
|
421
418
|
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/openai-transcription.js").OpenAITranscriptionOptions>;
|
|
422
|
-
export declare const
|
|
423
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental/openai-decisions.js").OpenAIDecisionOptions>;
|
|
424
|
-
};
|
|
419
|
+
export declare const decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<OpenAIDecisionOptionsInput>;
|
package/dist/providers/openai.js
CHANGED
|
@@ -7,7 +7,7 @@ import { withOpenAIOptions } from "./openai-options.js";
|
|
|
7
7
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
8
8
|
import { OpenAISpeech } from "../protocols/openai-speech.js";
|
|
9
9
|
import { OpenAITranscription } from "../protocols/openai-transcription.js";
|
|
10
|
-
import { OpenAIDecisions } from "../
|
|
10
|
+
import { OpenAIDecisions } from "../protocols/openai-decisions.js";
|
|
11
11
|
export const id = ProviderID.make("openai");
|
|
12
12
|
export const routes = [OpenAIResponses.route, OpenAIChat.route];
|
|
13
13
|
export const imageGeneration = (options = {}) => ToolDefinition.make({
|
|
@@ -41,9 +41,7 @@ export const configure = (input = {}) => {
|
|
|
41
41
|
const responsesRoute = configuredRoute(OpenAIResponses.route, input);
|
|
42
42
|
const chatRoute = configuredRoute(OpenAIChat.route, input);
|
|
43
43
|
const modelDefaults = defaults(input);
|
|
44
|
-
const responses = (id) => responsesRoute
|
|
45
|
-
.with(withOpenAIOptions(id, modelDefaults))
|
|
46
|
-
.model({ id });
|
|
44
|
+
const responses = (id) => responsesRoute.with(withOpenAIOptions(id, modelDefaults)).model({ id });
|
|
47
45
|
const chat = (id) => chatRoute.with(withOpenAIOptions(id, modelDefaults)).model({
|
|
48
46
|
id,
|
|
49
47
|
compatibility: { supportsPromptCacheKey: true },
|
|
@@ -56,7 +54,13 @@ export const configure = (input = {}) => {
|
|
|
56
54
|
const image = (modelID) => OpenAIImages.model({ ...media, id: modelID });
|
|
57
55
|
const speech = (modelID) => OpenAISpeech.model({ ...media, id: modelID });
|
|
58
56
|
const transcription = (modelID) => OpenAITranscription.model({ ...media, id: modelID });
|
|
59
|
-
const
|
|
57
|
+
const decisionRoute = OpenAIDecisions.route.with({
|
|
58
|
+
endpoint: { baseURL: media.baseURL },
|
|
59
|
+
auth: media.auth,
|
|
60
|
+
headers: media.headers,
|
|
61
|
+
http: media.http,
|
|
62
|
+
});
|
|
63
|
+
const decision = (modelID) => decisionRoute.model({ id: modelID });
|
|
60
64
|
return {
|
|
61
65
|
id,
|
|
62
66
|
model: responses,
|
|
@@ -65,7 +69,7 @@ export const configure = (input = {}) => {
|
|
|
65
69
|
image,
|
|
66
70
|
speech,
|
|
67
71
|
transcription,
|
|
68
|
-
|
|
72
|
+
decision,
|
|
69
73
|
configure,
|
|
70
74
|
};
|
|
71
75
|
};
|
|
@@ -94,4 +98,4 @@ export const chat = provider.chat;
|
|
|
94
98
|
export const image = provider.image;
|
|
95
99
|
export const speech = provider.speech;
|
|
96
100
|
export const transcription = provider.transcription;
|
|
97
|
-
export const
|
|
101
|
+
export const decision = provider.decision;
|
|
@@ -8,19 +8,13 @@ export type Options = ProviderAuthOption<"optional"> & {
|
|
|
8
8
|
};
|
|
9
9
|
export declare const configure: (input?: Options) => {
|
|
10
10
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
11
|
-
|
|
12
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
13
|
-
};
|
|
11
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
14
12
|
configure: typeof configure;
|
|
15
13
|
};
|
|
16
14
|
export declare const provider: {
|
|
17
15
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
18
|
-
|
|
19
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
20
|
-
};
|
|
16
|
+
decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
21
17
|
configure: typeof configure;
|
|
22
18
|
};
|
|
23
|
-
export declare const
|
|
24
|
-
evaluation: (modelID: string | ModelID) => import("../experimental.js").EvaluationModel<import("../experimental.js").EvaluationOptions>;
|
|
25
|
-
};
|
|
19
|
+
export declare const decision: (modelID: string | ModelID) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
26
20
|
export * as OpenCode from "./opencode.js";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
2
2
|
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
-
import { SystemOne } from "../
|
|
3
|
+
import { SystemOne } from "../protocols/system-one.js";
|
|
4
4
|
export const id = ProviderID.make("opencode");
|
|
5
5
|
const baseURL = "https://opencode.ai/inference/systemone/v1";
|
|
6
6
|
export const configure = (input = {}) => {
|
|
7
|
-
const
|
|
8
|
-
id: modelID,
|
|
7
|
+
const route = SystemOne.route.with({
|
|
9
8
|
provider: id,
|
|
10
9
|
providerMetadataKey: "opencode",
|
|
10
|
+
endpoint: { baseURL: input.baseURL ?? baseURL },
|
|
11
11
|
auth: AuthOptions.bearer(input, "OPENCODE_API_KEY"),
|
|
12
|
-
|
|
13
|
-
headers: input.headers,
|
|
14
|
-
http:
|
|
15
|
-
rounding: SystemOne.jevRounding,
|
|
12
|
+
// Zen forwards TypeSafe's image opt-in header; text-only requests are unchanged with it.
|
|
13
|
+
headers: { "TypeSafe-Danger-Zone-Images": "true", ...input.headers },
|
|
14
|
+
http: input.http,
|
|
16
15
|
});
|
|
17
|
-
|
|
16
|
+
const decision = (modelID) => route.model({ id: modelID });
|
|
17
|
+
return { id, decision, configure };
|
|
18
18
|
};
|
|
19
19
|
export const provider = configure();
|
|
20
|
-
export const
|
|
20
|
+
export const decision = provider.decision;
|
|
21
21
|
export * as OpenCode from "./opencode.js";
|