@opencode/ai 0.0.0-dev-1189 → 0.0.0-dev-1219
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/protocols/google-decisions.d.ts +13 -0
- package/dist/protocols/google-decisions.js +133 -0
- package/dist/protocols/index.d.ts +1 -0
- package/dist/protocols/index.js +1 -0
- package/dist/protocols/system-one.d.ts +33 -1
- package/dist/protocols/system-one.js +11 -2
- package/dist/provider-error.js +6 -0
- package/dist/providers/google/decisions.d.ts +2 -0
- package/dist/providers/google/decisions.js +1 -0
- package/dist/providers/google.d.ts +6 -0
- package/dist/providers/google.js +9 -0
- package/package.json +11 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { DecisionRoute } from "../route/decision.js";
|
|
3
|
+
import { type ProviderOptions } from "../schema/index.js";
|
|
4
|
+
export declare const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
5
|
+
declare const Options: Schema.Struct<{
|
|
6
|
+
/** Token budget for every image and video input; `ultra_high` applies to images only. */
|
|
7
|
+
readonly mediaResolution: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium" | "ultra_high">, import("../schema/options.js").OpenString<"high" | "low" | "medium" | "ultra_high">>>;
|
|
8
|
+
}>;
|
|
9
|
+
/** Known fields map to their wire names; anything else is sent as given. */
|
|
10
|
+
export type OptionsInput = ProviderOptions & typeof Options.Encoded;
|
|
11
|
+
export declare const protocol: DecisionRoute.Protocol;
|
|
12
|
+
export declare const route: DecisionRoute.Route;
|
|
13
|
+
export * as GoogleDecisions from "./google-decisions.js";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { DecisionResponse, DecisionUsage } from "../decision.js";
|
|
3
|
+
import { DecisionRoute } from "../route/decision.js";
|
|
4
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
6
|
+
import { AIError, ProviderID, UnsupportedOperationError, mergeJsonRecords, } from "../schema/index.js";
|
|
7
|
+
import { encodeJson } from "../utils/json.js";
|
|
8
|
+
import { JsonObject, knownString, ProviderShared } from "./shared.js";
|
|
9
|
+
import { SystemOne } from "./system-one.js";
|
|
10
|
+
import { MediaInput } from "./utils/media-input.js";
|
|
11
|
+
const ID = "google-decisions";
|
|
12
|
+
const NAME = "Google Decisions";
|
|
13
|
+
export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
14
|
+
const Options = Schema.Struct({
|
|
15
|
+
/** Token budget for every image and video input; `ultra_high` applies to images only. */
|
|
16
|
+
mediaResolution: Schema.optional(knownString()),
|
|
17
|
+
});
|
|
18
|
+
const Usage = Schema.StructWithRest(Schema.Struct({
|
|
19
|
+
total_input_tokens: Schema.optional(Schema.Number),
|
|
20
|
+
total_output_tokens: Schema.optional(Schema.Number),
|
|
21
|
+
total_tokens: Schema.optional(Schema.Number),
|
|
22
|
+
}), [JsonObject]);
|
|
23
|
+
const Response = Schema.Struct({
|
|
24
|
+
answers: Schema.Record(Schema.String, SystemOne.Answer),
|
|
25
|
+
usage: Schema.optional(Usage),
|
|
26
|
+
});
|
|
27
|
+
const decodeOptions = ProviderShared.validateWith(Schema.decodeUnknownEffect(Options));
|
|
28
|
+
const fromRequest = Effect.fn("GoogleDecisions.fromRequest")(function* (request) {
|
|
29
|
+
const options = yield* decodeOptions(request.providerOptions ?? {});
|
|
30
|
+
const { mediaResolution: _, ...native } = request.providerOptions ?? {};
|
|
31
|
+
return {
|
|
32
|
+
...mergeJsonRecords(native, request.http?.body),
|
|
33
|
+
model: request.model.id,
|
|
34
|
+
input: separateText(yield* Effect.forEach(request.input, (part) => inputPart(request, part, options.mediaResolution))),
|
|
35
|
+
questions: {
|
|
36
|
+
...(yield* SystemOne.encodeQuestions(request.questions)),
|
|
37
|
+
// Google names System One's predicate criteria `true_description` and `false_description`.
|
|
38
|
+
...Object.fromEntries(request.questions.flatMap((question) => question.type === "predicate" && question.criteria !== undefined
|
|
39
|
+
? [
|
|
40
|
+
[
|
|
41
|
+
question.name,
|
|
42
|
+
{
|
|
43
|
+
type: "noul",
|
|
44
|
+
instructions: question.instructions,
|
|
45
|
+
criteria: {
|
|
46
|
+
...(question.criteria.true === undefined ? {} : { true_description: question.criteria.true }),
|
|
47
|
+
...(question.criteria.false === undefined ? {} : { false_description: question.criteria.false }),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
]
|
|
52
|
+
: [])),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const inputPart = (request, part, resolution) => {
|
|
57
|
+
if (part.type === "text")
|
|
58
|
+
return Effect.succeed({ type: "text", text: part.text });
|
|
59
|
+
// Google reads every text block as text; JSON is serialized so its keys are never parsed as content blocks.
|
|
60
|
+
if (part.type === "json")
|
|
61
|
+
return Effect.succeed({ type: "text", text: encodeJson(part.value) });
|
|
62
|
+
return mediaPart(request, part.media, resolution);
|
|
63
|
+
};
|
|
64
|
+
// Google joins adjacent text blocks with no separator, so each one after another starts on a new line.
|
|
65
|
+
const separateText = (blocks) => blocks.map((block, index) => block.type === "text" && blocks[index - 1]?.type === "text" ? { ...block, text: `\n${block.text}` } : block);
|
|
66
|
+
const mediaPart = (request, asset, resolution) => {
|
|
67
|
+
const type = asset.kind === "image" || asset.kind === "audio" || asset.kind === "video"
|
|
68
|
+
? asset.kind
|
|
69
|
+
: asset.mediaType.toLowerCase() === "application/pdf"
|
|
70
|
+
? "document"
|
|
71
|
+
: undefined;
|
|
72
|
+
if (type === undefined)
|
|
73
|
+
return Effect.fail(new AIError({
|
|
74
|
+
reason: new UnsupportedOperationError({
|
|
75
|
+
operation: "decision.media",
|
|
76
|
+
provider: request.model.provider,
|
|
77
|
+
route: request.model.route.id,
|
|
78
|
+
message: `${NAME} takes images, audio, video and PDFs; got ${asset.mediaType}`,
|
|
79
|
+
}),
|
|
80
|
+
}));
|
|
81
|
+
const block = {
|
|
82
|
+
type,
|
|
83
|
+
mime_type: asset.mediaType.toLowerCase(),
|
|
84
|
+
// `ultra_high` is image-only, so video keeps Google's default for it.
|
|
85
|
+
...(resolution !== undefined && (type === "image" || (type === "video" && resolution !== "ultra_high"))
|
|
86
|
+
? { resolution }
|
|
87
|
+
: {}),
|
|
88
|
+
};
|
|
89
|
+
const inline = asset.inline();
|
|
90
|
+
if (inline)
|
|
91
|
+
return Effect.succeed({ ...block, data: inline.base64 });
|
|
92
|
+
// Google fetches URLs itself, so one that needs our download credentials can't be forwarded.
|
|
93
|
+
if (asset.source.type === "url" && /^https:\/\//i.test(asset.source.url) && asset.headers === undefined)
|
|
94
|
+
return Effect.succeed({ ...block, uri: asset.source.url });
|
|
95
|
+
const file = MediaInput.refID(asset, ProviderID.make("google"));
|
|
96
|
+
if (file !== undefined)
|
|
97
|
+
return Effect.succeed({ ...block, uri: file });
|
|
98
|
+
return Effect.fail(ProviderShared.invalidRequest(`${NAME} accepts inline media, public HTTPS URLs and Google Files API URIs; materialize ${asset.source.type} media first`));
|
|
99
|
+
};
|
|
100
|
+
const decodeDocument = MediaProtocol.identity({ id: ID, name: NAME, provider: "google" }).decodeJson(Response);
|
|
101
|
+
export const protocol = DecisionRoute.protocol({
|
|
102
|
+
id: ID,
|
|
103
|
+
name: NAME,
|
|
104
|
+
body: { from: fromRequest },
|
|
105
|
+
response: {
|
|
106
|
+
decode: Effect.fn("GoogleDecisions.decodeResponse")(function* (response, context) {
|
|
107
|
+
const output = yield* decodeDocument(response);
|
|
108
|
+
const data = output.value;
|
|
109
|
+
const answers = data.answers;
|
|
110
|
+
const names = context.request.questions.map((question) => question.name);
|
|
111
|
+
if (Object.keys(answers).length !== names.length || !names.every((name) => Object.hasOwn(answers, name)))
|
|
112
|
+
return yield* output.invalid(`${NAME} answers do not match the requested questions`);
|
|
113
|
+
return new DecisionResponse({
|
|
114
|
+
answers: context.request.questions.map((question) => SystemOne.toAnswer(question, answers[question.name])),
|
|
115
|
+
usage: data.usage === undefined
|
|
116
|
+
? undefined
|
|
117
|
+
: new DecisionUsage({
|
|
118
|
+
inputTokens: data.usage.total_input_tokens,
|
|
119
|
+
outputTokens: data.usage.total_output_tokens,
|
|
120
|
+
totalTokens: ProviderShared.totalTokens(data.usage.total_input_tokens, data.usage.total_output_tokens, data.usage.total_tokens),
|
|
121
|
+
}),
|
|
122
|
+
providerMetadata: data.usage === undefined ? undefined : { [context.providerMetadataKey]: { usage: data.usage } },
|
|
123
|
+
});
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
export const route = DecisionRoute.make({
|
|
128
|
+
id: ID,
|
|
129
|
+
provider: "google",
|
|
130
|
+
protocol,
|
|
131
|
+
endpoint: Endpoint.path("/decisions", { baseURL: DEFAULT_BASE_URL }),
|
|
132
|
+
});
|
|
133
|
+
export * as GoogleDecisions from "./google-decisions.js";
|
|
@@ -3,6 +3,7 @@ export * as BedrockConverse from "./bedrock-converse.js";
|
|
|
3
3
|
export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js";
|
|
4
4
|
export * as CohereChat from "./cohere-chat.js";
|
|
5
5
|
export * as Gemini from "./gemini.js";
|
|
6
|
+
export * as GoogleDecisions from "./google-decisions.js";
|
|
6
7
|
export * as GoogleEmbedContent from "./google-embed-content.js";
|
|
7
8
|
export * as GoogleInteractions from "./google-interactions.js";
|
|
8
9
|
export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js";
|
package/dist/protocols/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * as BedrockConverse from "./bedrock-converse.js";
|
|
|
3
3
|
export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js";
|
|
4
4
|
export * as CohereChat from "./cohere-chat.js";
|
|
5
5
|
export * as Gemini from "./gemini.js";
|
|
6
|
+
export * as GoogleDecisions from "./google-decisions.js";
|
|
6
7
|
export * as GoogleEmbedContent from "./google-embed-content.js";
|
|
7
8
|
export * as GoogleInteractions from "./google-interactions.js";
|
|
8
9
|
export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js";
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import { DecisionResponse, type DecisionModelCompatibility, type DecisionRequest } from "../decision.js";
|
|
2
|
+
import { DecisionResponse, type DecisionAnswer, type DecisionModelCompatibility, type DecisionQuestion, type DecisionRequest } from "../decision.js";
|
|
3
3
|
import { DecisionRoute } from "../route/decision.js";
|
|
4
4
|
import { AIError } from "../schema/index.js";
|
|
5
5
|
export declare const DEFAULT_PATH = "/systemone";
|
|
6
6
|
export declare const DEFAULT_BASE_URL = "https://api.typesafe.ai/v1";
|
|
7
7
|
/** `state.messages` is Baseten's own placement (parts in a user message inside `state.messages`), set by its provider. */
|
|
8
8
|
type MediaInput = NonNullable<DecisionModelCompatibility["mediaInput"]> | "state.messages";
|
|
9
|
+
declare const Answer: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
10
|
+
readonly type: Schema.Literal<"noul">;
|
|
11
|
+
readonly noul: Schema.Number;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly type: Schema.Literal<"choice">;
|
|
14
|
+
readonly choice: Schema.String;
|
|
15
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
16
|
+
readonly confidence: Schema.Number;
|
|
17
|
+
}>, Schema.Struct<{
|
|
18
|
+
readonly type: Schema.Literal<"score">;
|
|
19
|
+
readonly score: Schema.Number;
|
|
20
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
21
|
+
readonly confidence: Schema.Number;
|
|
22
|
+
}>]>;
|
|
9
23
|
export declare const Response: Schema.Struct<{
|
|
10
24
|
readonly model: Schema.String;
|
|
11
25
|
readonly answers: Schema.$Record<Schema.String, Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
@@ -48,12 +62,28 @@ export declare const encodeBody: (request: DecisionRequest<import("../decision.j
|
|
|
48
62
|
};
|
|
49
63
|
};
|
|
50
64
|
}, AIError, never>;
|
|
65
|
+
declare const encodeQuestions: (questions: ReadonlyArray<DecisionQuestion>) => Effect.Effect<any, AIError, never>;
|
|
51
66
|
/** Map System One's answers, keyed by question name, back to the request's question order. */
|
|
52
67
|
export declare const toResponse: (data: Response, request: DecisionRequest, providerMetadataKey: string, invalid: (message: string) => AIError) => Effect.Effect<never, AIError, never> | Effect.Effect<DecisionResponse, never, never>;
|
|
68
|
+
declare const toAnswer: (question: DecisionQuestion, answer: typeof Answer.Type) => DecisionAnswer;
|
|
53
69
|
export declare const protocol: DecisionRoute.Protocol;
|
|
54
70
|
/** TypeSafe's API, the reference System One host; other hosts change the endpoint and auth with `route.with(...)`. */
|
|
55
71
|
export declare const route: DecisionRoute.Route;
|
|
56
72
|
export declare const SystemOne: {
|
|
73
|
+
readonly Answer: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
74
|
+
readonly type: Schema.Literal<"noul">;
|
|
75
|
+
readonly noul: Schema.Number;
|
|
76
|
+
}>, Schema.Struct<{
|
|
77
|
+
readonly type: Schema.Literal<"choice">;
|
|
78
|
+
readonly choice: Schema.String;
|
|
79
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
80
|
+
readonly confidence: Schema.Number;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
readonly type: Schema.Literal<"score">;
|
|
83
|
+
readonly score: Schema.Number;
|
|
84
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
85
|
+
readonly confidence: Schema.Number;
|
|
86
|
+
}>]>;
|
|
57
87
|
readonly Response: Schema.Struct<{
|
|
58
88
|
readonly model: Schema.String;
|
|
59
89
|
readonly answers: Schema.$Record<Schema.String, Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
@@ -94,6 +124,8 @@ export declare const SystemOne: {
|
|
|
94
124
|
};
|
|
95
125
|
};
|
|
96
126
|
}, AIError, never>;
|
|
127
|
+
readonly encodeQuestions: typeof encodeQuestions;
|
|
128
|
+
readonly toAnswer: typeof toAnswer;
|
|
97
129
|
readonly toResponse: typeof toResponse;
|
|
98
130
|
readonly protocol: DecisionRoute.Protocol;
|
|
99
131
|
readonly route: DecisionRoute.Route;
|
|
@@ -67,7 +67,7 @@ const encodeQuestions = (questions) => Effect.forEach(questions, (question) => {
|
|
|
67
67
|
// Options are map keys, so `true` is sent as "true" and mapped back by `choiceValue`.
|
|
68
68
|
const keys = question.choices.map((choice) => String(choice.value));
|
|
69
69
|
if (new Set(keys).size !== keys.length)
|
|
70
|
-
return Effect.fail(ProviderShared.invalidRequest(`
|
|
70
|
+
return Effect.fail(ProviderShared.invalidRequest(`Decision choice options are sent as string keys; "${question.name}" has a boolean and a string with the same text`));
|
|
71
71
|
return Effect.succeed([
|
|
72
72
|
question.name,
|
|
73
73
|
{
|
|
@@ -234,4 +234,13 @@ export const route = DecisionRoute.make({
|
|
|
234
234
|
protocol,
|
|
235
235
|
endpoint: Endpoint.path("/systemone", { baseURL: DEFAULT_BASE_URL }),
|
|
236
236
|
});
|
|
237
|
-
export const SystemOne = {
|
|
237
|
+
export const SystemOne = {
|
|
238
|
+
Answer,
|
|
239
|
+
Response,
|
|
240
|
+
encodeBody,
|
|
241
|
+
encodeQuestions,
|
|
242
|
+
toAnswer,
|
|
243
|
+
toResponse,
|
|
244
|
+
protocol,
|
|
245
|
+
route,
|
|
246
|
+
};
|
package/dist/provider-error.js
CHANGED
|
@@ -110,6 +110,12 @@ const CONTENT_POLICY_CODES = new Set([
|
|
|
110
110
|
"refusal",
|
|
111
111
|
"datainspectionfailed",
|
|
112
112
|
"moderation_blocked",
|
|
113
|
+
// Gemini Decisions rejects blocked input with these `error.code` strings on a 400.
|
|
114
|
+
"safety",
|
|
115
|
+
"prohibited_content",
|
|
116
|
+
"blocklist",
|
|
117
|
+
"image_safety",
|
|
118
|
+
"content_blocked",
|
|
113
119
|
]);
|
|
114
120
|
// OpenCode Zen replaces upstream codes outside its allow-list but keeps the original
|
|
115
121
|
// as a `[code]` label at the start of the rewritten message.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { decisionModel as model } from "../google.js";
|
|
@@ -3,6 +3,7 @@ import type { ProviderPackage } from "../provider-package.js";
|
|
|
3
3
|
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
4
4
|
import { Gemini } from "../protocols/gemini.js";
|
|
5
5
|
import { type OptionsInput as GoogleEmbeddingOptionsInput } from "../protocols/google-embed-content.js";
|
|
6
|
+
import { GoogleDecisions } from "../protocols/google-decisions.js";
|
|
6
7
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
7
8
|
export type { OptionsInput as GoogleEmbeddingOptions } from "../protocols/google-embed-content.js";
|
|
8
9
|
export type { GoogleImageOptions } from "../protocols/google-images.js";
|
|
@@ -12,6 +13,7 @@ export type { GoogleVideoOptions } from "../protocols/google-video.js";
|
|
|
12
13
|
export type GeminiOptionsInput = Gemini.OptionsInput;
|
|
13
14
|
export type GeminiProviderOptionsInput = Gemini.ProviderOptionsInput;
|
|
14
15
|
export type GoogleInteractionsOptionsInput = GoogleInteractions.OptionsInput;
|
|
16
|
+
export type GoogleDecisionsOptionsInput = GoogleDecisions.OptionsInput;
|
|
15
17
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
16
18
|
export declare const routes: (import("../route.js").Route<{
|
|
17
19
|
readonly cachedContent?: string | undefined;
|
|
@@ -184,6 +186,7 @@ export declare const configure: (input?: Config) => {
|
|
|
184
186
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
185
187
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
186
188
|
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
189
|
+
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<GoogleDecisions.OptionsInput>;
|
|
187
190
|
configure: typeof configure;
|
|
188
191
|
};
|
|
189
192
|
export declare const provider: {
|
|
@@ -202,11 +205,13 @@ export declare const provider: {
|
|
|
202
205
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
203
206
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
204
207
|
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
208
|
+
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<GoogleDecisions.OptionsInput>;
|
|
205
209
|
configure: typeof configure;
|
|
206
210
|
};
|
|
207
211
|
export declare const model: ProviderPackage.Model<Settings, Gemini.ProviderOptionsInput>;
|
|
208
212
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
209
213
|
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
214
|
+
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<GoogleDecisions.OptionsInput>;
|
|
210
215
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
211
216
|
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
212
217
|
export declare const gemini: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
@@ -220,3 +225,4 @@ export declare const interactions: (modelID: string | ModelID) => import("../sch
|
|
|
220
225
|
export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-video.js").GoogleVideoOptions>;
|
|
221
226
|
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
222
227
|
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
228
|
+
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<GoogleDecisions.OptionsInput>;
|
package/dist/providers/google.js
CHANGED
|
@@ -4,6 +4,7 @@ import { MediaRoute } from "../route/media.js";
|
|
|
4
4
|
import { ProviderID } from "../schema/index.js";
|
|
5
5
|
import { Gemini } from "../protocols/gemini.js";
|
|
6
6
|
import { GoogleEmbedContent, } from "../protocols/google-embed-content.js";
|
|
7
|
+
import { GoogleDecisions } from "../protocols/google-decisions.js";
|
|
7
8
|
import { GoogleInteractions } from "../protocols/google-interactions.js";
|
|
8
9
|
import { GoogleImages } from "../protocols/google-images.js";
|
|
9
10
|
import { GoogleSpeech } from "../protocols/google-speech.js";
|
|
@@ -42,6 +43,9 @@ export const configure = (input = {}) => {
|
|
|
42
43
|
speech: (modelID) => GoogleSpeech.model({ ...media, id: modelID }),
|
|
43
44
|
transcription: (modelID) => GoogleTranscription.model({ ...media, id: modelID }),
|
|
44
45
|
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
46
|
+
decision: (modelID, providerOptions) => GoogleDecisions.route
|
|
47
|
+
.with({ endpoint: { baseURL: media.baseURL }, auth: media.auth, headers: media.headers, http: media.http })
|
|
48
|
+
.model({ id: modelID, providerOptions }),
|
|
45
49
|
configure,
|
|
46
50
|
};
|
|
47
51
|
};
|
|
@@ -55,6 +59,10 @@ export const embeddingModel = (modelID, settings) => {
|
|
|
55
59
|
const input = toConfig(settings);
|
|
56
60
|
return configure(input).embedding(modelID, input.providerOptions);
|
|
57
61
|
};
|
|
62
|
+
export const decisionModel = (modelID, settings) => {
|
|
63
|
+
const input = toConfig(settings);
|
|
64
|
+
return configure(input).decision(modelID, input.providerOptions);
|
|
65
|
+
};
|
|
58
66
|
export const image = provider.image;
|
|
59
67
|
export const embedding = provider.embedding;
|
|
60
68
|
export const gemini = provider.gemini;
|
|
@@ -62,3 +70,4 @@ export const interactions = provider.interactions;
|
|
|
62
70
|
export const video = provider.video;
|
|
63
71
|
export const speech = provider.speech;
|
|
64
72
|
export const transcription = provider.transcription;
|
|
73
|
+
export const decision = provider.decision;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-1219",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -260,6 +260,10 @@
|
|
|
260
260
|
"types": "./dist/providers/google-vertex/responses.d.ts",
|
|
261
261
|
"import": "./dist/providers/google-vertex/responses.js"
|
|
262
262
|
},
|
|
263
|
+
"./providers/google/decisions": {
|
|
264
|
+
"types": "./dist/providers/google/decisions.d.ts",
|
|
265
|
+
"import": "./dist/providers/google/decisions.js"
|
|
266
|
+
},
|
|
263
267
|
"./providers/google/embeddings": {
|
|
264
268
|
"types": "./dist/providers/google/embeddings.d.ts",
|
|
265
269
|
"import": "./dist/providers/google/embeddings.js"
|
|
@@ -516,6 +520,10 @@
|
|
|
516
520
|
"types": "./dist/protocols/deepgram-transcription.d.ts",
|
|
517
521
|
"import": "./dist/protocols/deepgram-transcription.js"
|
|
518
522
|
},
|
|
523
|
+
"./protocols/google-decisions": {
|
|
524
|
+
"types": "./dist/protocols/google-decisions.d.ts",
|
|
525
|
+
"import": "./dist/protocols/google-decisions.js"
|
|
526
|
+
},
|
|
519
527
|
"./protocols/google-images": {
|
|
520
528
|
"types": "./dist/protocols/google-images.d.ts",
|
|
521
529
|
"import": "./dist/protocols/google-images.js"
|
|
@@ -576,7 +584,7 @@
|
|
|
576
584
|
"devDependencies": {
|
|
577
585
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
578
586
|
"@effect/platform-node": "4.1.0",
|
|
579
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
587
|
+
"@opencode/http-recorder": "0.0.0-dev-1219",
|
|
580
588
|
"@tsconfig/bun": "1.0.9",
|
|
581
589
|
"@types/bun": "1.4.3",
|
|
582
590
|
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
@@ -586,7 +594,7 @@
|
|
|
586
594
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
587
595
|
"@smithy/eventstream-codec": "4.2.14",
|
|
588
596
|
"@smithy/util-utf8": "4.2.2",
|
|
589
|
-
"@opencode/schema": "0.0.0-dev-
|
|
597
|
+
"@opencode/schema": "0.0.0-dev-1219",
|
|
590
598
|
"aws4fetch": "1.0.20",
|
|
591
599
|
"effect": "4.1.0",
|
|
592
600
|
"google-auth-library": "10.5.0"
|