@odla-ai/ai 0.2.1 → 0.3.0

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.
@@ -1,35 +1,22 @@
1
+ import {
2
+ stringifyBlocks
3
+ } from "./chunk-U7F6VJCV.js";
4
+ import {
5
+ toolInput
6
+ } from "./chunk-OX4TA4ZH.js";
1
7
  import {
2
8
  CapabilityError,
3
9
  emptyUsage,
4
10
  mapProviderError,
5
- normalizeError
6
- } from "./chunk-LANGYP65.js";
11
+ normalizeError,
12
+ signalWithDeadline
13
+ } from "./chunk-PXXCN2EU.js";
7
14
 
8
15
  // src/providers/google.ts
9
- import { GoogleGenAI, FunctionCallingConfigMode } from "@google/genai";
10
- var GoogleProvider = class {
11
- id = "google";
12
- client;
13
- constructor(apiKey, client) {
14
- this.client = client ?? new GoogleGenAI({ apiKey });
15
- }
16
- async create(spec, req) {
17
- try {
18
- const res = await this.client.models.generateContent(buildParams(spec, req));
19
- return mapResponse(res, req);
20
- } catch (err) {
21
- mapProviderError(err, "google");
22
- }
23
- }
24
- async *stream(spec, req) {
25
- try {
26
- const iter = await this.client.models.generateContentStream(buildParams(spec, req));
27
- yield* mapStream(iter, req);
28
- } catch (err) {
29
- yield { type: "error", error: normalizeError(err, "google").toShape() };
30
- }
31
- }
32
- };
16
+ import { GoogleGenAI } from "@google/genai";
17
+
18
+ // src/providers/google/request.ts
19
+ import { FunctionCallingConfigMode } from "@google/genai";
33
20
  function buildParams(spec, req) {
34
21
  const config = { maxOutputTokens: req.maxTokens };
35
22
  if (req.system !== void 0) {
@@ -84,9 +71,6 @@ function toPart(b) {
84
71
  return { text: "" };
85
72
  }
86
73
  }
87
- function stringifyBlocks(blocks) {
88
- return blocks.map((b) => b.type === "text" ? b.text : `[${b.type}]`).join("");
89
- }
90
74
  function buildTools(req) {
91
75
  const tools = [];
92
76
  if (req.tools && req.tools.length > 0) {
@@ -107,6 +91,8 @@ function mapToolChoice(tc) {
107
91
  if (tc === "any") return { functionCallingConfig: { mode: FunctionCallingConfigMode.ANY } };
108
92
  return { functionCallingConfig: { mode: FunctionCallingConfigMode.ANY, allowedFunctionNames: [tc.name] } };
109
93
  }
94
+
95
+ // src/providers/google/response.ts
110
96
  function mapResponse(res, req) {
111
97
  const candidate = res.candidates?.[0];
112
98
  const parts = candidate?.content?.parts ?? [];
@@ -117,7 +103,7 @@ function mapResponse(res, req) {
117
103
  else if (p.functionCall) {
118
104
  sawToolUse = true;
119
105
  const name = p.functionCall.name ?? "";
120
- content.push({ type: "tool_use", id: p.functionCall.id ?? name, name, input: p.functionCall.args ?? {} });
106
+ content.push({ type: "tool_use", id: p.functionCall.id ?? name, name, input: toolInput(p.functionCall.args ?? {}, "google", name) });
121
107
  }
122
108
  }
123
109
  return {
@@ -155,6 +141,8 @@ function mapUsage(res) {
155
141
  if (u?.cachedContentTokenCount != null) usage.cacheReadTokens = u.cachedContentTokenCount;
156
142
  return usage;
157
143
  }
144
+
145
+ // src/providers/google/stream.ts
158
146
  async function* mapStream(iter, req) {
159
147
  let started = false;
160
148
  let textOpen = false;
@@ -198,9 +186,40 @@ async function* mapStream(iter, req) {
198
186
  yield { type: "message_delta", delta: { stopReason }, usage };
199
187
  yield { type: "message_stop" };
200
188
  }
189
+
190
+ // src/providers/google.ts
191
+ var GoogleProvider = class {
192
+ id = "google";
193
+ client;
194
+ constructor(apiKey, client) {
195
+ this.client = client ?? new GoogleGenAI({ apiKey });
196
+ }
197
+ async create(spec, req) {
198
+ const signal = signalWithDeadline(req.signal, req.deadline);
199
+ try {
200
+ const params = buildParams(spec, req);
201
+ params.config = { ...params.config, abortSignal: signal };
202
+ const res = await this.client.models.generateContent(params);
203
+ return mapResponse(res, req);
204
+ } catch (err) {
205
+ mapProviderError(err, "google", signal);
206
+ }
207
+ }
208
+ async *stream(spec, req) {
209
+ const signal = signalWithDeadline(req.signal, req.deadline);
210
+ try {
211
+ const params = buildParams(spec, req);
212
+ params.config = { ...params.config, abortSignal: signal };
213
+ const iter = await this.client.models.generateContentStream(params);
214
+ yield* mapStream(iter, req);
215
+ } catch (err) {
216
+ yield { type: "error", error: normalizeError(err, "google", signal).toShape() };
217
+ }
218
+ }
219
+ };
201
220
  export {
202
221
  GoogleProvider,
203
222
  mapResponse,
204
223
  toContents
205
224
  };
206
- //# sourceMappingURL=google-3TFOFIQO.js.map
225
+ //# sourceMappingURL=google-3XV2VWVB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/providers/google.ts","../src/providers/google/request.ts","../src/providers/google/response.ts","../src/providers/google/stream.ts"],"sourcesContent":["// Google (Gemini) adapter, on @google/genai's models.generateContent /\n// generateContentStream. Gemini is natively multimodal (text + image + audio +\n// PDF), so most translation is structural: canonical messages → Gemini\n// `contents` (role \"assistant\" → \"model\"), tools → functionDeclarations,\n// system → config.systemInstruction, tool_use/tool_result → functionCall/\n// functionResponse (name-keyed). The translations live in ./google/request.\n\nimport { GoogleGenAI } from \"@google/genai\";\nimport type { ModelSpec } from \"../shape/capabilities\";\nimport type { Provider } from \"./types\";\nimport { mapProviderError, normalizeError } from \"./errors\";\nimport type { OracleEvent, OracleRequest, OracleResponse } from \"../shape/index\";\nimport { buildParams, toContents } from \"./google/request\";\nimport { mapResponse } from \"./google/response\";\nimport { mapStream } from \"./google/stream\";\nimport { signalWithDeadline } from \"../client/abort\";\n\nexport class GoogleProvider implements Provider {\n readonly id = \"google\" as const;\n private client: GoogleGenAI;\n\n constructor(apiKey: string, client?: GoogleGenAI) {\n this.client = client ?? new GoogleGenAI({ apiKey });\n }\n\n async create(spec: ModelSpec, req: OracleRequest): Promise<OracleResponse> {\n const signal = signalWithDeadline(req.signal, req.deadline);\n try {\n const params = buildParams(spec, req);\n params.config = { ...params.config, abortSignal: signal };\n const res = await this.client.models.generateContent(params);\n return mapResponse(res, req);\n } catch (err) {\n mapProviderError(err, \"google\", signal);\n }\n }\n\n async *stream(spec: ModelSpec, req: OracleRequest): AsyncIterable<OracleEvent> {\n const signal = signalWithDeadline(req.signal, req.deadline);\n try {\n const params = buildParams(spec, req);\n params.config = { ...params.config, abortSignal: signal };\n const iter = await this.client.models.generateContentStream(params);\n yield* mapStream(iter, req);\n } catch (err) {\n yield { type: \"error\", error: normalizeError(err, \"google\", signal).toShape() };\n }\n }\n}\n\n// Re-exported for the test suite (test/adapters.test.ts) and callers that pinned\n// these helpers when they lived in this file.\nexport { toContents, mapResponse };\n","// Google (Gemini) request mapping: canonical shape → generateContent params.\nimport { FunctionCallingConfigMode } from \"@google/genai\";\nimport type { Content, GenerateContentParameters, Part } from \"@google/genai\";\nimport type { ModelSpec } from \"../../shape/capabilities\";\nimport { CapabilityError, type OracleContentBlock, type OracleRequest, type ToolChoice } from \"../../shape/index\";\nimport { stringifyBlocks } from \"../blocks\";\n\nexport function buildParams(spec: ModelSpec, req: OracleRequest): GenerateContentParameters {\n const config: Record<string, unknown> = { maxOutputTokens: req.maxTokens };\n\n if (req.system !== undefined) {\n config.systemInstruction = typeof req.system === \"string\" ? req.system : req.system.map((b) => b.text).join(\"\");\n }\n if (req.temperature !== undefined) config.temperature = req.temperature;\n if (req.stopSequences && req.stopSequences.length > 0) config.stopSequences = req.stopSequences;\n\n const tools = buildTools(req);\n if (tools) config.tools = tools;\n\n const toolConfig = mapToolChoice(req.toolChoice);\n if (toolConfig) config.toolConfig = toolConfig;\n\n if (req.thinking === \"adaptive\" && spec.capabilities.thinking) {\n config.thinkingConfig = { thinkingBudget: -1 }; // -1 = dynamic (\"let the model decide\")\n }\n\n if (req.responseFormat && spec.capabilities.structuredOutput) {\n config.responseMimeType = \"application/json\";\n config.responseSchema = req.responseFormat.schema;\n }\n\n if (req.providerExtras) Object.assign(config, req.providerExtras);\n\n return { model: spec.nativeId, contents: toContents(req), config } as unknown as GenerateContentParameters;\n}\n\nexport function toContents(req: OracleRequest): Content[] {\n return req.messages.map((m) => ({\n role: m.role === \"assistant\" ? \"model\" : \"user\",\n parts: (typeof m.content === \"string\" ? [{ type: \"text\" as const, text: m.content }] : m.content).map(toPart),\n }));\n}\n\nfunction toPart(b: OracleContentBlock): Part {\n switch (b.type) {\n case \"text\":\n return { text: b.text };\n case \"image\":\n if (b.source.type !== \"base64\") throw new CapabilityError(\"Google image input requires base64 data, not a URL.\");\n return { inlineData: { mimeType: b.source.mediaType, data: b.source.data } };\n case \"audio\":\n if (b.source.type !== \"base64\") throw new CapabilityError(\"Google audio input requires base64 data, not a URL.\");\n return { inlineData: { mimeType: b.source.mediaType, data: b.source.data } };\n case \"document\":\n if (b.source.type !== \"base64\") throw new CapabilityError(\"Google document input requires base64 data, not a URL.\");\n return { inlineData: { mimeType: \"application/pdf\", data: b.source.data } };\n case \"tool_use\":\n return { functionCall: { name: b.name, args: b.input } };\n case \"tool_result\":\n return {\n functionResponse: {\n // Gemini correlates by name; the canonical tool_use id is keyed to it.\n name: b.toolUseId,\n response: { result: typeof b.content === \"string\" ? b.content : stringifyBlocks(b.content) },\n },\n };\n case \"thinking\":\n return { text: \"\" }; // no thinking input channel; drop content\n }\n}\n\nfunction buildTools(req: OracleRequest): unknown[] | undefined {\n const tools: unknown[] = [];\n if (req.tools && req.tools.length > 0) {\n tools.push({\n functionDeclarations: req.tools.map((t) => ({\n name: t.name,\n description: t.description,\n parameters: t.inputSchema,\n })),\n });\n }\n if (req.webSearch) tools.push({ googleSearch: {} });\n return tools.length > 0 ? tools : undefined;\n}\n\nfunction mapToolChoice(tc: ToolChoice | undefined): unknown | undefined {\n if (tc === undefined || tc === \"auto\") return undefined;\n if (tc === \"none\") return { functionCallingConfig: { mode: FunctionCallingConfigMode.NONE } };\n if (tc === \"any\") return { functionCallingConfig: { mode: FunctionCallingConfigMode.ANY } };\n return { functionCallingConfig: { mode: FunctionCallingConfigMode.ANY, allowedFunctionNames: [tc.name] } };\n}\n","// Google (Gemini) response mapping. mapFinish / mapUsage are also used by the\n// stream mapper (kept here so the entry ↔ stream edge stays one-directional).\nimport type { GenerateContentResponse } from \"@google/genai\";\nimport type { OracleContentBlock, OracleRequest, OracleResponse, OracleStopReason, OracleUsage } from \"../../shape/index\";\nimport { toolInput } from \"../tool-input\";\n\nexport function mapResponse(res: GenerateContentResponse, req: OracleRequest): OracleResponse {\n const candidate = res.candidates?.[0];\n const parts = candidate?.content?.parts ?? [];\n const content: OracleContentBlock[] = [];\n let sawToolUse = false;\n\n for (const p of parts) {\n if (p.text) content.push({ type: \"text\", text: p.text });\n else if (p.functionCall) {\n sawToolUse = true;\n const name = p.functionCall.name ?? \"\";\n content.push({ type: \"tool_use\", id: p.functionCall.id ?? name, name, input: toolInput(p.functionCall.args ?? {}, \"google\", name) });\n }\n }\n\n return {\n id: res.responseId ?? \"\",\n model: req.model,\n provider: \"google\",\n role: \"assistant\",\n content,\n stopReason: sawToolUse ? \"tool_use\" : mapFinish(candidate?.finishReason),\n usage: mapUsage(res),\n };\n}\n\nexport function mapFinish(reason: string | null | undefined): OracleStopReason {\n switch (reason) {\n case \"STOP\":\n return \"end_turn\";\n case \"MAX_TOKENS\":\n return \"max_tokens\";\n case \"SAFETY\":\n case \"RECITATION\":\n case \"BLOCKLIST\":\n case \"PROHIBITED_CONTENT\":\n case \"SPII\":\n return \"refusal\";\n default:\n return \"end_turn\";\n }\n}\n\nexport function mapUsage(res: GenerateContentResponse): OracleUsage {\n const u = res.usageMetadata;\n const usage: OracleUsage = {\n inputTokens: u?.promptTokenCount ?? 0,\n outputTokens: u?.candidatesTokenCount ?? 0,\n };\n if (u?.cachedContentTokenCount != null) usage.cacheReadTokens = u.cachedContentTokenCount;\n return usage;\n}\n","// Google (Gemini) stream mapping onto the canonical event vocabulary.\nimport type { GenerateContentResponse } from \"@google/genai\";\nimport { emptyUsage, type OracleEvent, type OracleRequest, type OracleStopReason } from \"../../shape/index\";\nimport { mapFinish, mapUsage } from \"./response\";\n\nexport async function* mapStream(iter: AsyncIterable<GenerateContentResponse>, req: OracleRequest): AsyncIterable<OracleEvent> {\n let started = false;\n let textOpen = false;\n let nextBlockIndex = 1;\n let stopReason: OracleStopReason = \"end_turn\";\n const usage = emptyUsage();\n\n for await (const chunk of iter) {\n if (!started) {\n started = true;\n yield {\n type: \"message_start\",\n message: { id: chunk.responseId ?? \"\", model: req.model, provider: \"google\", role: \"assistant\", content: [], usage: emptyUsage() },\n };\n }\n\n const candidate = chunk.candidates?.[0];\n for (const p of candidate?.content?.parts ?? []) {\n if (p.text) {\n if (!textOpen) {\n textOpen = true;\n yield { type: \"content_block_start\", index: 0, contentBlock: { type: \"text\", text: \"\" } };\n }\n yield { type: \"content_block_delta\", index: 0, delta: { type: \"text_delta\", text: p.text } };\n } else if (p.functionCall) {\n const idx = nextBlockIndex++;\n const name = p.functionCall.name ?? \"\";\n yield { type: \"content_block_start\", index: idx, contentBlock: { type: \"tool_use\", id: p.functionCall.id ?? name, name, input: {} } };\n yield { type: \"content_block_delta\", index: idx, delta: { type: \"input_json_delta\", partialJson: JSON.stringify(p.functionCall.args ?? {}) } };\n yield { type: \"content_block_stop\", index: idx };\n stopReason = \"tool_use\";\n }\n }\n\n if (chunk.usageMetadata) {\n const u = mapUsage(chunk);\n usage.inputTokens = u.inputTokens; // Gemini reports cumulative counts\n usage.outputTokens = u.outputTokens;\n if (u.cacheReadTokens != null) usage.cacheReadTokens = u.cacheReadTokens;\n }\n if (candidate?.finishReason && stopReason !== \"tool_use\") stopReason = mapFinish(candidate.finishReason);\n }\n\n if (textOpen) yield { type: \"content_block_stop\", index: 0 };\n yield { type: \"message_delta\", delta: { stopReason }, usage };\n yield { type: \"message_stop\" };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAOA,SAAS,mBAAmB;;;ACN5B,SAAS,iCAAiC;AAMnC,SAAS,YAAY,MAAiB,KAA+C;AAC1F,QAAM,SAAkC,EAAE,iBAAiB,IAAI,UAAU;AAEzE,MAAI,IAAI,WAAW,QAAW;AAC5B,WAAO,oBAAoB,OAAO,IAAI,WAAW,WAAW,IAAI,SAAS,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE;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