@venturekit-pro/ai 0.0.24 → 0.0.26

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 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/image/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAA4B,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3E;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG,wBAAwB,CAAC;AAElF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,qBAAqB,CAclF"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/image/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAErF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3E;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG,wBAAwB,CAAC;AAElF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,qBAAqB,CAclF"}
@@ -6,7 +6,7 @@
6
6
  * and call `.generate()` against it. The factory switches on `provider`
7
7
  * once, at construction.
8
8
  */
9
- import { generateWithGoogleImagen } from './google.js';
9
+ import { generateWithGoogleImage } from './google.js';
10
10
  /**
11
11
  * Build an image client. Throws synchronously on an unknown provider so
12
12
  * the caller fails fast rather than at the first `.generate()` call.
@@ -19,7 +19,7 @@ export function createImageClient(config) {
19
19
  void _ignored;
20
20
  return {
21
21
  provider: 'google',
22
- generate: (request) => generateWithGoogleImagen(adapterConfig, request),
22
+ generate: (request) => generateWithGoogleImage(adapterConfig, request),
23
23
  };
24
24
  }
25
25
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/image/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAAE,wBAAwB,EAAiC,MAAM,aAAa,CAAC;AAkBtF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAyB;IACzD,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,oCAAoC,MAAM,CACvC,MAA+B,CAAC,QAAQ,CAC1C,EAAE,CACJ,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IACxD,KAAK,QAAQ,CAAC;IACd,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,wBAAwB,CAAC,aAAa,EAAE,OAAO,CAAC;KACxE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/image/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAAE,uBAAuB,EAAiC,MAAM,aAAa,CAAC;AAkBrF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAyB;IACzD,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,oCAAoC,MAAM,CACvC,MAA+B,CAAC,QAAQ,CAC1C,EAAE,CACJ,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IACxD,KAAK,QAAQ,CAAC;IACd,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,uBAAuB,CAAC,aAAa,EAAE,OAAO,CAAC;KACvE,CAAC;AACJ,CAAC"}
@@ -1,14 +1,32 @@
1
1
  /**
2
- * Google Imagen adapter (Generative Language REST API).
2
+ * Google image adapter (Generative Language REST API).
3
3
  *
4
- * Talks to the `:predict` endpoint on
5
- * `generativelanguage.googleapis.com` — the documented Imagen REST
6
- * surface: an `{ instances, parameters }` request that returns
7
- * `predictions[]`. We request one image per call and loop `count`
8
- * times, collecting the bytes.
4
+ * Targets the **Interactions API** — `POST /v1beta/interactions` on
5
+ * `generativelanguage.googleapis.com` — which is the surface the
6
+ * Gemini image models (`gemini-3.1-flash-image` "Nano Banana 2",
7
+ * `gemini-3.1-flash-lite-image`, `gemini-3-pro-image`) are served on.
9
8
  *
10
- * Auth is via the `?key=` query param (the documented REST form for
11
- * Generative Language API keys), escaped through `encodeURIComponent`.
9
+ * # Why this is not the Imagen `:predict` surface any more
10
+ *
11
+ * This adapter previously spoke Imagen's `:predict` protocol
12
+ * (`{ instances, parameters }` in, `predictions[]` out). Google retired
13
+ * the ENTIRE Imagen line: `imagen-4.0-generate-001`,
14
+ * `imagen-4.0-ultra-generate-001` and `imagen-4.0-fast-generate-001`
15
+ * were shut down on 2026-08-17, `imagen-3.0-generate-002` earlier, and
16
+ * there is no Imagen 5 — the published replacement for all of them is
17
+ * `gemini-3.1-flash-image`. Those models do not answer on `:predict`,
18
+ * so this is a protocol change, not a model-id change.
19
+ *
20
+ * Three things differ from the old surface:
21
+ * - the model travels in the request BODY, not the URL path;
22
+ * - auth is the `x-goog-api-key` HEADER, not a `?key=` query param;
23
+ * - framing moves from `parameters.aspectRatio` to
24
+ * `response_format.aspect_ratio`, and the response carries content
25
+ * blocks (`steps[].content[]` with `type: 'image'`) instead of
26
+ * `predictions[]`.
27
+ *
28
+ * As before we request one image per call and loop `count` times,
29
+ * collecting the bytes: a single interaction yields a single image.
12
30
  */
13
31
  import type { ImageGenerationRequest, ImageGenerationResult } from './types.js';
14
32
  export interface GoogleImageAdapterConfig {
@@ -20,5 +38,11 @@ export interface GoogleImageAdapterConfig {
20
38
  /** Request timeout in milliseconds. Default 120s — image gen is slow. */
21
39
  timeoutMs?: number;
22
40
  }
23
- export declare function generateWithGoogleImagen(config: GoogleImageAdapterConfig, request: ImageGenerationRequest): Promise<ImageGenerationResult>;
41
+ export declare function generateWithGoogleImage(config: GoogleImageAdapterConfig, request: ImageGenerationRequest): Promise<ImageGenerationResult>;
42
+ /**
43
+ * @deprecated Renamed to {@link generateWithGoogleImage} now that the
44
+ * adapter no longer targets Imagen. Kept as an alias so existing
45
+ * imports keep resolving; drop it on the next breaking release.
46
+ */
47
+ export declare const generateWithGoogleImagen: typeof generateWithGoogleImage;
24
48
  //# sourceMappingURL=google.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/image/google.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,wBAAwB,EAChC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CA4DhC"}
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/image/google.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkCD,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,wBAAwB,EAChC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAsEhC;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,gCAA0B,CAAC"}
@@ -1,16 +1,49 @@
1
1
  /**
2
- * Google Imagen adapter (Generative Language REST API).
2
+ * Google image adapter (Generative Language REST API).
3
3
  *
4
- * Talks to the `:predict` endpoint on
5
- * `generativelanguage.googleapis.com` — the documented Imagen REST
6
- * surface: an `{ instances, parameters }` request that returns
7
- * `predictions[]`. We request one image per call and loop `count`
8
- * times, collecting the bytes.
4
+ * Targets the **Interactions API** — `POST /v1beta/interactions` on
5
+ * `generativelanguage.googleapis.com` — which is the surface the
6
+ * Gemini image models (`gemini-3.1-flash-image` "Nano Banana 2",
7
+ * `gemini-3.1-flash-lite-image`, `gemini-3-pro-image`) are served on.
9
8
  *
10
- * Auth is via the `?key=` query param (the documented REST form for
11
- * Generative Language API keys), escaped through `encodeURIComponent`.
9
+ * # Why this is not the Imagen `:predict` surface any more
10
+ *
11
+ * This adapter previously spoke Imagen's `:predict` protocol
12
+ * (`{ instances, parameters }` in, `predictions[]` out). Google retired
13
+ * the ENTIRE Imagen line: `imagen-4.0-generate-001`,
14
+ * `imagen-4.0-ultra-generate-001` and `imagen-4.0-fast-generate-001`
15
+ * were shut down on 2026-08-17, `imagen-3.0-generate-002` earlier, and
16
+ * there is no Imagen 5 — the published replacement for all of them is
17
+ * `gemini-3.1-flash-image`. Those models do not answer on `:predict`,
18
+ * so this is a protocol change, not a model-id change.
19
+ *
20
+ * Three things differ from the old surface:
21
+ * - the model travels in the request BODY, not the URL path;
22
+ * - auth is the `x-goog-api-key` HEADER, not a `?key=` query param;
23
+ * - framing moves from `parameters.aspectRatio` to
24
+ * `response_format.aspect_ratio`, and the response carries content
25
+ * blocks (`steps[].content[]` with `type: 'image'`) instead of
26
+ * `predictions[]`.
27
+ *
28
+ * As before we request one image per call and loop `count` times,
29
+ * collecting the bytes: a single interaction yields a single image.
30
+ */
31
+ /**
32
+ * First image block in the response, scanning every step. The image
33
+ * models default to returning conversational text ALONGSIDE the image,
34
+ * so the block of interest is not reliably at a fixed index — we pin on
35
+ * `type === 'image'` rather than position.
12
36
  */
13
- export async function generateWithGoogleImagen(config, request) {
37
+ function findImageBlock(json) {
38
+ for (const step of json.steps ?? []) {
39
+ for (const block of step.content ?? []) {
40
+ if (block.type === 'image' && block.data)
41
+ return block;
42
+ }
43
+ }
44
+ return undefined;
45
+ }
46
+ export async function generateWithGoogleImage(config, request) {
14
47
  const startedAt = Date.now();
15
48
  const baseUrl = (config.baseUrl ?? 'https://generativelanguage.googleapis.com').replace(/\/+$/, '');
16
49
  const apiVersion = config.apiVersion ?? 'v1beta';
@@ -19,7 +52,9 @@ export async function generateWithGoogleImagen(config, request) {
19
52
  // upper cap appropriate to its quota.
20
53
  const count = Math.max(1, request.count ?? 1);
21
54
  const aspectRatio = request.aspectRatio ?? '16:9';
22
- const url = `${baseUrl}/${apiVersion}/models/${encodeURIComponent(request.model)}:predict?key=${encodeURIComponent(config.apiKey)}`;
55
+ const imageSize = request.imageSize;
56
+ // Single fixed endpoint: the model is a body field on this API.
57
+ const url = `${baseUrl}/${apiVersion}/interactions`;
23
58
  const images = [];
24
59
  for (let i = 0; i < count; i++) {
25
60
  const controller = new AbortController();
@@ -28,10 +63,20 @@ export async function generateWithGoogleImagen(config, request) {
28
63
  try {
29
64
  response = await fetch(url, {
30
65
  method: 'POST',
31
- headers: { 'Content-Type': 'application/json' },
66
+ headers: {
67
+ 'Content-Type': 'application/json',
68
+ 'x-goog-api-key': config.apiKey,
69
+ },
32
70
  body: JSON.stringify({
33
- instances: [{ prompt: request.prompt }],
34
- parameters: { sampleCount: 1, aspectRatio },
71
+ model: request.model,
72
+ input: request.prompt,
73
+ // Asking for `image` only suppresses the conversational text
74
+ // the model would otherwise return next to the picture.
75
+ response_format: {
76
+ type: 'image',
77
+ aspect_ratio: aspectRatio,
78
+ ...(imageSize ? { image_size: imageSize } : {}),
79
+ },
35
80
  }),
36
81
  signal: controller.signal,
37
82
  });
@@ -44,13 +89,13 @@ export async function generateWithGoogleImagen(config, request) {
44
89
  throw new Error(`[ai/image/google] ${response.status} ${response.statusText}: ${text}`);
45
90
  }
46
91
  const json = (await response.json());
47
- const im = json.predictions?.[0];
48
- if (!im?.bytesBase64Encoded) {
92
+ const im = findImageBlock(json);
93
+ if (!im?.data) {
49
94
  throw new Error('[ai/image/google] No image bytes returned');
50
95
  }
51
96
  images.push({
52
- bytes: Uint8Array.from(Buffer.from(im.bytesBase64Encoded, 'base64')),
53
- mimeType: im.mimeType ?? 'image/png',
97
+ bytes: Uint8Array.from(Buffer.from(im.data, 'base64')),
98
+ mimeType: im.mime_type ?? 'image/png',
54
99
  });
55
100
  }
56
101
  return {
@@ -60,4 +105,10 @@ export async function generateWithGoogleImagen(config, request) {
60
105
  latencyMs: Date.now() - startedAt,
61
106
  };
62
107
  }
108
+ /**
109
+ * @deprecated Renamed to {@link generateWithGoogleImage} now that the
110
+ * adapter no longer targets Imagen. Kept as an alias so existing
111
+ * imports keep resolving; drop it on the next breaking release.
112
+ */
113
+ export const generateWithGoogleImagen = generateWithGoogleImage;
63
114
  //# sourceMappingURL=google.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/image/google.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAsBH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAgC,EAChC,OAA+B;IAE/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,2CAA2C,CAAC,CAAC,OAAO,CACrF,MAAM,EACN,EAAE,CACH,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC;IACjD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,IAAI,OAAO,CAAC;IACnE,qEAAqE;IACrE,sCAAsC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC;IAElD,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,UAAU,WAAW,kBAAkB,CAC/D,OAAO,CAAC,KAAK,CACd,gBAAgB,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAErD,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CA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,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,qBAAqB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,KAAK,IAAI,EAAE,CACvE,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAwB,CAAC;QAC5D,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACtD,QAAQ,EAAE,EAAE,CAAC,SAAS,IAAI,WAAW;SACtC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KAClC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC"}
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Image generation — provider-neutral text-to-image with raw byte
3
- * output. Currently Google Imagen; mirrors `chat/` in shape (no tool
4
- * use, no editing).
3
+ * output. Currently the Google Gemini image models (Nano Banana) via
4
+ * the Interactions API; mirrors `chat/` in shape (no tool use, no
5
+ * editing).
5
6
  */
6
- export type { ImageProvider, ImageAspectRatio, ImageGenerationRequest, ImageGenerationResult, GeneratedImage, } from './types.js';
7
+ export type { ImageProvider, ImageAspectRatio, ImageOutputSize, ImageGenerationRequest, ImageGenerationResult, GeneratedImage, } from './types.js';
7
8
  export { createImageClient } from './client.js';
8
9
  export type { ImageGenerationClient, ImageClientConfig } from './client.js';
9
- export { generateWithGoogleImagen } from './google.js';
10
+ export { generateWithGoogleImage, generateWithGoogleImagen } from './google.js';
10
11
  export type { GoogleImageAdapterConfig } from './google.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/image/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/image/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAI5E,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Image generation — provider-neutral text-to-image with raw byte
3
- * output. Currently Google Imagen; mirrors `chat/` in shape (no tool
4
- * use, no editing).
3
+ * output. Currently the Google Gemini image models (Nano Banana) via
4
+ * the Interactions API; mirrors `chat/` in shape (no tool use, no
5
+ * editing).
5
6
  */
6
7
  export { createImageClient } from './client.js';
7
8
  // Adapter exported for callers that want to bypass the factory.
8
- export { generateWithGoogleImagen } from './google.js';
9
+ // `generateWithGoogleImagen` is a deprecated alias of the same function.
10
+ export { generateWithGoogleImage, generateWithGoogleImagen } from './google.js';
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/image/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,gEAAgE;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/image/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,gEAAgE;AAChE,yEAAyE;AACzE,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
@@ -22,14 +22,33 @@
22
22
  * `image/<provider>.ts` and a branch in `image/client.ts`.
23
23
  */
24
24
  export type ImageProvider = 'google';
25
- /** Supported output framings. */
25
+ /**
26
+ * Supported output framings.
27
+ *
28
+ * The Gemini image models accept a wider set than this (the Interactions
29
+ * API takes `response_format.aspect_ratio`), but this union is
30
+ * deliberately limited to the four ratios that were verified against the
31
+ * old Imagen surface and are still exercised by callers. Widen it only
32
+ * against the published ratio table — an unsupported value is a vendor
33
+ * 400 at generation time, not a compile error.
34
+ */
26
35
  export type ImageAspectRatio = '1:1' | '4:3' | '16:9' | '9:16';
36
+ /**
37
+ * Output resolution tier, passed through as
38
+ * `response_format.image_size`. Omit to take the vendor default (1K).
39
+ *
40
+ * Pricing scales with this: at the Nano Banana 2 rate a 1K image is
41
+ * ~$0.067 and a 4K image ~$0.151, so it is a cost lever, not just a
42
+ * quality one. Google's pricing table also lists a 0.5K tier whose API
43
+ * token is not documented alongside these, so it is omitted here.
44
+ */
45
+ export type ImageOutputSize = '1K' | '2K' | '4K';
27
46
  /**
28
47
  * A text-to-image request. Provider-neutral on the wire — the adapter
29
48
  * translates these fields into its vendor's request shape.
30
49
  */
31
50
  export interface ImageGenerationRequest {
32
- /** Vendor-specific model id (e.g. `'imagen-4.0-ultra-generate-001'`). */
51
+ /** Vendor-specific model id (e.g. `'gemini-3.1-flash-image'`). */
33
52
  model: string;
34
53
  /**
35
54
  * The full prompt sent to the model. Any brand / style suffix is the
@@ -38,6 +57,8 @@ export interface ImageGenerationRequest {
38
57
  prompt: string;
39
58
  /** Output framing. Defaults to `'16:9'`. */
40
59
  aspectRatio?: ImageAspectRatio;
60
+ /** Output resolution tier. Defaults to the vendor's own default. */
61
+ imageSize?: ImageOutputSize;
41
62
  /** Number of images to generate. Defaults to `1`. */
42
63
  count?: number;
43
64
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/image/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC,iCAAiC;AACjC,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,4DAA4D;AAC5D,MAAM,WA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SAAS,EAAE,MAAM,CAAC;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venturekit-pro/ai",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "AI utilities for VentureKit - embeddings, RAG, agents, chat completion, and image generation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  "rag"
38
38
  ],
39
39
  "dependencies": {
40
- "@venturekit/core": "0.0.24"
40
+ "@venturekit/core": "0.0.26"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@aws-sdk/client-bedrock-runtime": "^3.0.0",