@teamflojo/floimg-google 0.1.0 → 0.2.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.
- package/LICENSE +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/text.d.ts +122 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +329 -0
- package/dist/text.js.map +1 -0
- package/dist/transforms.d.ts +99 -0
- package/dist/transforms.d.ts.map +1 -0
- package/dist/transforms.js +450 -0
- package/dist/transforms.js.map +1 -0
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Brett Cooke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -62,4 +62,7 @@ export interface GoogleImagenParams extends Record<string, unknown> {
|
|
|
62
62
|
*/
|
|
63
63
|
export default function googleImagen(config?: GoogleImagenConfig): ImageGenerator;
|
|
64
64
|
export { googleImagen };
|
|
65
|
+
export { geminiTransform, geminiEditSchema, type GeminiTransformConfig } from "./transforms.js";
|
|
66
|
+
export { geminiGenerate, geminiGenerateSchema, type GeminiGenerateConfig } from "./transforms.js";
|
|
67
|
+
export { geminiText, geminiTextSchema, geminiVision, geminiVisionSchema, type GeminiTextConfig, type GeminiTextParams, type GeminiVisionConfig, type GeminiVisionParams, } from "./text.js";
|
|
65
68
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpF;;GAEG;AACH,QAAA,MAAM,aAAa,kIAKT,CAAC;AAEX,KAAK,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD;;GAEG;AACH,QAAA,MAAM,aAAa,gDAAiD,CAAC;AAErE,KAAK,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAsChC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAA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K,CAAC,EAAE,WAAW,CAAC;IACpB,yBAAyB;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAsBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAM,GAAE,kBAAuB,GAAG,cAAc,CA+EpF;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGhG,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGlG,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -153,4 +153,10 @@ export default function googleImagen(config = {}) {
|
|
|
153
153
|
}
|
|
154
154
|
// Named export for convenience
|
|
155
155
|
export { googleImagen };
|
|
156
|
+
// Transform provider exports
|
|
157
|
+
export { geminiTransform, geminiEditSchema } from "./transforms.js";
|
|
158
|
+
// Gemini image generator exports
|
|
159
|
+
export { geminiGenerate, geminiGenerateSchema } from "./transforms.js";
|
|
160
|
+
// Text and Vision provider exports
|
|
161
|
+
export { geminiText, geminiTextSchema, geminiVision, geminiVisionSchema, } from "./text.js";
|
|
156
162
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA6B,MAAM,eAAe,CAAC;AAGvE;;GAEG;AACH,MAAM,aAAa,GAAG;IACpB,8BA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AW;iBACZ;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+BAA+B;AAC/B,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,6BAA6B;AAC7B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAA8B,MAAM,iBAAiB,CAAC;AAEhG,iCAAiC;AACjC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAA6B,MAAM,iBAAiB,CAAC;AAElG,mCAAmC;AACnC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,GAKnB,MAAM,WAAW,CAAC"}
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini Text and Vision providers for floimg
|
|
3
|
+
*
|
|
4
|
+
* Uses the Google GenAI SDK for text generation and image analysis.
|
|
5
|
+
* Supports structured JSON outputs.
|
|
6
|
+
*/
|
|
7
|
+
import type { TextProvider, TextProviderSchema, VisionProvider, VisionProviderSchema } from "@teamflojo/floimg";
|
|
8
|
+
/**
|
|
9
|
+
* Supported Gemini models for text generation
|
|
10
|
+
*/
|
|
11
|
+
declare const _GEMINI_TEXT_MODELS: readonly ["gemini-2.5-flash", "gemini-3-flash-preview"];
|
|
12
|
+
type GeminiTextModel = (typeof _GEMINI_TEXT_MODELS)[number];
|
|
13
|
+
export interface GeminiTextConfig {
|
|
14
|
+
/** Google AI API key (defaults to GOOGLE_AI_API_KEY env var) */
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
/** Model to use (default: gemini-2.5-flash) */
|
|
17
|
+
model?: GeminiTextModel;
|
|
18
|
+
/** Maximum tokens in response */
|
|
19
|
+
maxTokens?: number;
|
|
20
|
+
/** Temperature for response creativity (0-2) */
|
|
21
|
+
temperature?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface GeminiTextParams {
|
|
24
|
+
/** The prompt for text generation */
|
|
25
|
+
prompt: string;
|
|
26
|
+
/** Optional system prompt to guide model behavior */
|
|
27
|
+
systemPrompt?: string;
|
|
28
|
+
/** Optional context from previous step (e.g., vision analysis) */
|
|
29
|
+
context?: string;
|
|
30
|
+
/** Output format: text or structured JSON */
|
|
31
|
+
outputFormat?: "text" | "json";
|
|
32
|
+
/** JSON schema for structured output (when outputFormat is "json") */
|
|
33
|
+
jsonSchema?: Record<string, unknown>;
|
|
34
|
+
/** Maximum tokens in response */
|
|
35
|
+
maxTokens?: number;
|
|
36
|
+
/** Temperature (0-2) */
|
|
37
|
+
temperature?: number;
|
|
38
|
+
/** Per-request API key override */
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Schema for the Gemini Text provider
|
|
43
|
+
*/
|
|
44
|
+
export declare const geminiTextSchema: TextProviderSchema;
|
|
45
|
+
/**
|
|
46
|
+
* Create a Gemini Text provider for text generation
|
|
47
|
+
*
|
|
48
|
+
* Uses Google's Gemini API with structured output support.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import createClient from '@teamflojo/floimg';
|
|
53
|
+
* import { geminiText } from '@teamflojo/floimg-google';
|
|
54
|
+
*
|
|
55
|
+
* const floimg = createClient();
|
|
56
|
+
* floimg.registerTextProvider(geminiText({ apiKey: process.env.GOOGLE_AI_API_KEY }));
|
|
57
|
+
*
|
|
58
|
+
* const result = await floimg.text({
|
|
59
|
+
* provider: 'gemini-text',
|
|
60
|
+
* params: {
|
|
61
|
+
* prompt: 'Generate 5 creative image prompts for a fantasy landscape',
|
|
62
|
+
* outputFormat: 'json',
|
|
63
|
+
* }
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function geminiText(config?: GeminiTextConfig): TextProvider;
|
|
68
|
+
/**
|
|
69
|
+
* Supported Gemini models for vision/image analysis
|
|
70
|
+
*/
|
|
71
|
+
declare const _GEMINI_VISION_MODELS: readonly ["gemini-2.5-flash", "gemini-3-flash-preview"];
|
|
72
|
+
type GeminiVisionModel = (typeof _GEMINI_VISION_MODELS)[number];
|
|
73
|
+
export interface GeminiVisionConfig {
|
|
74
|
+
/** Google AI API key (defaults to GOOGLE_AI_API_KEY env var) */
|
|
75
|
+
apiKey?: string;
|
|
76
|
+
/** Model to use (default: gemini-2.5-flash) */
|
|
77
|
+
model?: GeminiVisionModel;
|
|
78
|
+
/** Maximum tokens in response */
|
|
79
|
+
maxTokens?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface GeminiVisionParams {
|
|
82
|
+
/** What to analyze or ask about the image */
|
|
83
|
+
prompt?: string;
|
|
84
|
+
/** Output format: text or structured JSON */
|
|
85
|
+
outputFormat?: "text" | "json";
|
|
86
|
+
/** JSON schema for structured output (when outputFormat is "json") */
|
|
87
|
+
jsonSchema?: Record<string, unknown>;
|
|
88
|
+
/** Maximum tokens in response */
|
|
89
|
+
maxTokens?: number;
|
|
90
|
+
/** Per-request API key override */
|
|
91
|
+
apiKey?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Schema for the Gemini Vision provider
|
|
95
|
+
*/
|
|
96
|
+
export declare const geminiVisionSchema: VisionProviderSchema;
|
|
97
|
+
/**
|
|
98
|
+
* Create a Gemini Vision provider for image analysis
|
|
99
|
+
*
|
|
100
|
+
* Uses Google's Gemini API with structured output support.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* import createClient from '@teamflojo/floimg';
|
|
105
|
+
* import { geminiVision } from '@teamflojo/floimg-google';
|
|
106
|
+
*
|
|
107
|
+
* const floimg = createClient();
|
|
108
|
+
* floimg.registerVisionProvider(geminiVision({ apiKey: process.env.GOOGLE_AI_API_KEY }));
|
|
109
|
+
*
|
|
110
|
+
* const result = await floimg.vision({
|
|
111
|
+
* provider: 'gemini-vision',
|
|
112
|
+
* blob: imageBlob,
|
|
113
|
+
* params: {
|
|
114
|
+
* prompt: 'What objects are in this image?',
|
|
115
|
+
* outputFormat: 'json',
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function geminiVision(config?: GeminiVisionConfig): VisionProvider;
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAGV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAM3B;;GAEG;AACH,QAAA,MAAM,mBAAmB,yDAA0D,CAAC;AAEpF,KAAK,eAAe,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBAkD9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,gBAAqB,GAAG,YAAY,CA0GtE;AAMD;;GAEG;AACH,QAAA,MAAM,qBAAqB,yDAA0D,CAAC;AAEtF,KAAK,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,oBAkChC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAE,kBAAuB,GAAG,cAAc,CAyG5E"}
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini Text and Vision providers for floimg
|
|
3
|
+
*
|
|
4
|
+
* Uses the Google GenAI SDK for text generation and image analysis.
|
|
5
|
+
* Supports structured JSON outputs.
|
|
6
|
+
*/
|
|
7
|
+
import { GoogleGenAI } from "@google/genai";
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Gemini Text Provider
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Supported Gemini models for text generation
|
|
13
|
+
*/
|
|
14
|
+
const _GEMINI_TEXT_MODELS = ["gemini-2.5-flash", "gemini-3-flash-preview"];
|
|
15
|
+
/**
|
|
16
|
+
* Schema for the Gemini Text provider
|
|
17
|
+
*/
|
|
18
|
+
export const geminiTextSchema = {
|
|
19
|
+
name: "gemini-text",
|
|
20
|
+
description: "Generate text using Google's Gemini models with structured output support",
|
|
21
|
+
category: "Cloud",
|
|
22
|
+
parameters: {
|
|
23
|
+
prompt: {
|
|
24
|
+
type: "string",
|
|
25
|
+
title: "Prompt",
|
|
26
|
+
description: "The prompt for text generation",
|
|
27
|
+
},
|
|
28
|
+
systemPrompt: {
|
|
29
|
+
type: "string",
|
|
30
|
+
title: "System Prompt",
|
|
31
|
+
description: "Optional system prompt to guide the model's behavior",
|
|
32
|
+
},
|
|
33
|
+
context: {
|
|
34
|
+
type: "string",
|
|
35
|
+
title: "Context",
|
|
36
|
+
description: "Optional context from a previous step (e.g., vision analysis)",
|
|
37
|
+
},
|
|
38
|
+
outputFormat: {
|
|
39
|
+
type: "string",
|
|
40
|
+
title: "Output Format",
|
|
41
|
+
description: "Response format: plain text or structured JSON",
|
|
42
|
+
enum: ["text", "json"],
|
|
43
|
+
default: "text",
|
|
44
|
+
},
|
|
45
|
+
maxTokens: {
|
|
46
|
+
type: "number",
|
|
47
|
+
title: "Max Tokens",
|
|
48
|
+
description: "Maximum tokens in the response",
|
|
49
|
+
default: 1000,
|
|
50
|
+
},
|
|
51
|
+
temperature: {
|
|
52
|
+
type: "number",
|
|
53
|
+
title: "Temperature",
|
|
54
|
+
description: "Creativity level (0-2)",
|
|
55
|
+
default: 0.7,
|
|
56
|
+
minimum: 0,
|
|
57
|
+
maximum: 2,
|
|
58
|
+
},
|
|
59
|
+
apiKey: {
|
|
60
|
+
type: "string",
|
|
61
|
+
title: "API Key",
|
|
62
|
+
description: "Your Google AI API key (optional - uses server key if not provided)",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
requiredParameters: ["prompt"],
|
|
66
|
+
requiresApiKey: true,
|
|
67
|
+
outputType: "data",
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Create a Gemini Text provider for text generation
|
|
71
|
+
*
|
|
72
|
+
* Uses Google's Gemini API with structured output support.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* import createClient from '@teamflojo/floimg';
|
|
77
|
+
* import { geminiText } from '@teamflojo/floimg-google';
|
|
78
|
+
*
|
|
79
|
+
* const floimg = createClient();
|
|
80
|
+
* floimg.registerTextProvider(geminiText({ apiKey: process.env.GOOGLE_AI_API_KEY }));
|
|
81
|
+
*
|
|
82
|
+
* const result = await floimg.text({
|
|
83
|
+
* provider: 'gemini-text',
|
|
84
|
+
* params: {
|
|
85
|
+
* prompt: 'Generate 5 creative image prompts for a fantasy landscape',
|
|
86
|
+
* outputFormat: 'json',
|
|
87
|
+
* }
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export function geminiText(config = {}) {
|
|
92
|
+
// Config API key is optional - user can provide per-request
|
|
93
|
+
const configApiKey = config.apiKey || process.env.GOOGLE_AI_API_KEY;
|
|
94
|
+
// Cache clients by API key
|
|
95
|
+
const clientCache = new Map();
|
|
96
|
+
function getClient(apiKey) {
|
|
97
|
+
let client = clientCache.get(apiKey);
|
|
98
|
+
if (!client) {
|
|
99
|
+
client = new GoogleGenAI({ apiKey });
|
|
100
|
+
clientCache.set(apiKey, client);
|
|
101
|
+
}
|
|
102
|
+
return client;
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
name: "gemini-text",
|
|
106
|
+
schema: geminiTextSchema,
|
|
107
|
+
async generate(params) {
|
|
108
|
+
const { prompt, systemPrompt, context, outputFormat = "text", jsonSchema, maxTokens = config.maxTokens || 1000, temperature = config.temperature || 0.7, apiKey: paramApiKey, } = params;
|
|
109
|
+
if (!prompt) {
|
|
110
|
+
throw new Error("prompt is required for Gemini text generation");
|
|
111
|
+
}
|
|
112
|
+
// Use per-request API key if provided, otherwise use config key
|
|
113
|
+
const apiKey = paramApiKey || configApiKey;
|
|
114
|
+
if (!apiKey) {
|
|
115
|
+
throw new Error("Google AI API key is required. Set GOOGLE_AI_API_KEY environment variable, pass apiKey in config, or provide it in params.");
|
|
116
|
+
}
|
|
117
|
+
const client = getClient(apiKey);
|
|
118
|
+
const model = config.model || "gemini-2.5-flash";
|
|
119
|
+
// Build the prompt with optional context
|
|
120
|
+
let fullPrompt = prompt;
|
|
121
|
+
if (context) {
|
|
122
|
+
fullPrompt = `Context from previous analysis:\n${context}\n\n${prompt}`;
|
|
123
|
+
}
|
|
124
|
+
if (outputFormat === "json" && !jsonSchema) {
|
|
125
|
+
fullPrompt += "\n\nRespond with valid JSON only.";
|
|
126
|
+
}
|
|
127
|
+
// Build generation config
|
|
128
|
+
const generationConfig = {
|
|
129
|
+
maxOutputTokens: maxTokens,
|
|
130
|
+
temperature,
|
|
131
|
+
};
|
|
132
|
+
// Add structured output if JSON schema is provided
|
|
133
|
+
if (outputFormat === "json" && jsonSchema) {
|
|
134
|
+
generationConfig.responseMimeType = "application/json";
|
|
135
|
+
generationConfig.responseSchema = jsonSchema;
|
|
136
|
+
}
|
|
137
|
+
else if (outputFormat === "json") {
|
|
138
|
+
generationConfig.responseMimeType = "application/json";
|
|
139
|
+
}
|
|
140
|
+
const response = await client.models.generateContent({
|
|
141
|
+
model,
|
|
142
|
+
contents: [
|
|
143
|
+
...(systemPrompt
|
|
144
|
+
? [{ role: "user", parts: [{ text: `System: ${systemPrompt}` }] }]
|
|
145
|
+
: []),
|
|
146
|
+
{ role: "user", parts: [{ text: fullPrompt }] },
|
|
147
|
+
],
|
|
148
|
+
config: generationConfig,
|
|
149
|
+
});
|
|
150
|
+
const content = response.text || "";
|
|
151
|
+
// Try to parse JSON if requested
|
|
152
|
+
let parsed;
|
|
153
|
+
if (outputFormat === "json") {
|
|
154
|
+
try {
|
|
155
|
+
parsed = JSON.parse(content);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// If JSON parsing fails, treat as text
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
type: parsed ? "json" : "text",
|
|
163
|
+
content,
|
|
164
|
+
parsed,
|
|
165
|
+
source: `ai:gemini-text:${model}`,
|
|
166
|
+
metadata: {
|
|
167
|
+
model,
|
|
168
|
+
prompt,
|
|
169
|
+
temperature,
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// ============================================================================
|
|
176
|
+
// Gemini Vision Provider
|
|
177
|
+
// ============================================================================
|
|
178
|
+
/**
|
|
179
|
+
* Supported Gemini models for vision/image analysis
|
|
180
|
+
*/
|
|
181
|
+
const _GEMINI_VISION_MODELS = ["gemini-2.5-flash", "gemini-3-flash-preview"];
|
|
182
|
+
/**
|
|
183
|
+
* Schema for the Gemini Vision provider
|
|
184
|
+
*/
|
|
185
|
+
export const geminiVisionSchema = {
|
|
186
|
+
name: "gemini-vision",
|
|
187
|
+
description: "Analyze images using Google's Gemini models with structured output support",
|
|
188
|
+
category: "Cloud",
|
|
189
|
+
parameters: {
|
|
190
|
+
prompt: {
|
|
191
|
+
type: "string",
|
|
192
|
+
title: "Prompt",
|
|
193
|
+
description: "What to analyze or ask about the image",
|
|
194
|
+
default: "Describe this image in detail.",
|
|
195
|
+
},
|
|
196
|
+
outputFormat: {
|
|
197
|
+
type: "string",
|
|
198
|
+
title: "Output Format",
|
|
199
|
+
description: "Response format: plain text or structured JSON",
|
|
200
|
+
enum: ["text", "json"],
|
|
201
|
+
default: "text",
|
|
202
|
+
},
|
|
203
|
+
maxTokens: {
|
|
204
|
+
type: "number",
|
|
205
|
+
title: "Max Tokens",
|
|
206
|
+
description: "Maximum tokens in the response",
|
|
207
|
+
default: 1000,
|
|
208
|
+
},
|
|
209
|
+
apiKey: {
|
|
210
|
+
type: "string",
|
|
211
|
+
title: "API Key",
|
|
212
|
+
description: "Your Google AI API key (optional - uses server key if not provided)",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
outputFormats: ["text", "json"],
|
|
216
|
+
requiresApiKey: true,
|
|
217
|
+
inputType: "image",
|
|
218
|
+
outputType: "data",
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Create a Gemini Vision provider for image analysis
|
|
222
|
+
*
|
|
223
|
+
* Uses Google's Gemini API with structured output support.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* import createClient from '@teamflojo/floimg';
|
|
228
|
+
* import { geminiVision } from '@teamflojo/floimg-google';
|
|
229
|
+
*
|
|
230
|
+
* const floimg = createClient();
|
|
231
|
+
* floimg.registerVisionProvider(geminiVision({ apiKey: process.env.GOOGLE_AI_API_KEY }));
|
|
232
|
+
*
|
|
233
|
+
* const result = await floimg.vision({
|
|
234
|
+
* provider: 'gemini-vision',
|
|
235
|
+
* blob: imageBlob,
|
|
236
|
+
* params: {
|
|
237
|
+
* prompt: 'What objects are in this image?',
|
|
238
|
+
* outputFormat: 'json',
|
|
239
|
+
* }
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export function geminiVision(config = {}) {
|
|
244
|
+
// Config API key is optional - user can provide per-request
|
|
245
|
+
const configApiKey = config.apiKey || process.env.GOOGLE_AI_API_KEY;
|
|
246
|
+
// Cache clients by API key
|
|
247
|
+
const clientCache = new Map();
|
|
248
|
+
function getClient(apiKey) {
|
|
249
|
+
let client = clientCache.get(apiKey);
|
|
250
|
+
if (!client) {
|
|
251
|
+
client = new GoogleGenAI({ apiKey });
|
|
252
|
+
clientCache.set(apiKey, client);
|
|
253
|
+
}
|
|
254
|
+
return client;
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
name: "gemini-vision",
|
|
258
|
+
schema: geminiVisionSchema,
|
|
259
|
+
async analyze(input, params) {
|
|
260
|
+
const { prompt = "Describe this image in detail.", outputFormat = "text", jsonSchema, maxTokens = config.maxTokens || 1000, apiKey: paramApiKey, } = params;
|
|
261
|
+
// Use per-request API key if provided, otherwise use config key
|
|
262
|
+
const apiKey = paramApiKey || configApiKey;
|
|
263
|
+
if (!apiKey) {
|
|
264
|
+
throw new Error("Google AI API key is required. Set GOOGLE_AI_API_KEY environment variable, pass apiKey in config, or provide it in params.");
|
|
265
|
+
}
|
|
266
|
+
const client = getClient(apiKey);
|
|
267
|
+
const model = config.model || "gemini-2.5-flash";
|
|
268
|
+
// Convert image to base64
|
|
269
|
+
const base64Image = input.bytes.toString("base64");
|
|
270
|
+
// Build the prompt
|
|
271
|
+
let fullPrompt = prompt;
|
|
272
|
+
if (outputFormat === "json" && !jsonSchema) {
|
|
273
|
+
fullPrompt += "\n\nRespond with valid JSON only.";
|
|
274
|
+
}
|
|
275
|
+
// Build generation config
|
|
276
|
+
const generationConfig = {
|
|
277
|
+
maxOutputTokens: maxTokens,
|
|
278
|
+
};
|
|
279
|
+
// Add structured output if JSON schema is provided
|
|
280
|
+
if (outputFormat === "json" && jsonSchema) {
|
|
281
|
+
generationConfig.responseMimeType = "application/json";
|
|
282
|
+
generationConfig.responseSchema = jsonSchema;
|
|
283
|
+
}
|
|
284
|
+
else if (outputFormat === "json") {
|
|
285
|
+
generationConfig.responseMimeType = "application/json";
|
|
286
|
+
}
|
|
287
|
+
const response = await client.models.generateContent({
|
|
288
|
+
model,
|
|
289
|
+
contents: [
|
|
290
|
+
{
|
|
291
|
+
role: "user",
|
|
292
|
+
parts: [
|
|
293
|
+
{ text: fullPrompt },
|
|
294
|
+
{
|
|
295
|
+
inlineData: {
|
|
296
|
+
mimeType: input.mime,
|
|
297
|
+
data: base64Image,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
config: generationConfig,
|
|
304
|
+
});
|
|
305
|
+
const content = response.text || "";
|
|
306
|
+
// Try to parse JSON if requested
|
|
307
|
+
let parsed;
|
|
308
|
+
if (outputFormat === "json") {
|
|
309
|
+
try {
|
|
310
|
+
parsed = JSON.parse(content);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
// If JSON parsing fails, treat as text
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
type: parsed ? "json" : "text",
|
|
318
|
+
content,
|
|
319
|
+
parsed,
|
|
320
|
+
source: `ai:gemini-vision:${model}`,
|
|
321
|
+
metadata: {
|
|
322
|
+
model,
|
|
323
|
+
prompt,
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAA8B,MAAM,eAAe,CAAC;AAUxE,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,kBAAkB,EAAE,wBAAwB,CAAU,CAAC;AAkCpF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAuB;IAClD,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,2EAA2E;IACxF,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,gCAAgC;SAC9C;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,sDAAsD;SACpE;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,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BAAM,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;gBACnC,gBAAgB,CAAC,gBAAgB,GAAG,kBAAkB,CAAC;YACzD,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;gBACnD,KAAK;gBACL,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE;4BACL,EAAE,IAAI,EAAE,UAAU,EAAE;4BACpB;gCACE,UAAU,EAAE;oCACV,QAAQ,EAAE,KAAK,CAAC,IAAI;oCACpB,IAAI,EAAE,WAAW;iCAClB;6BACF;yBACF;qBACF;iBACF;gBACD,MAAM,EAAE,gBAAgB;aACzB,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;YAEpC,iCAAiC;YACjC,IAAI,MAA2C,CAAC;YAChD,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;gBAC5B,IAAI,CAAC;oBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC/B,CAAC;gBAAC,MAAM,CAAC;oBACP,uCAAuC;gBACzC,CAAC;YACH,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;gBAC9B,OAAO;gBACP,MAAM;gBACN,MAAM,EAAE,oBAAoB,KAAK,EAAE;gBACnC,QAAQ,EAAE;oBACR,KAAK;oBACL,MAAM;iBACP;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { TransformProvider, TransformOperationSchema, ImageGenerator, GeneratorSchema } from "@teamflojo/floimg";
|
|
2
|
+
/**
|
|
3
|
+
* Supported Gemini models for image generation/editing (Nano Banana)
|
|
4
|
+
*
|
|
5
|
+
* - gemini-2.5-flash-image: "Nano Banana" - Fast, high-volume, low-latency
|
|
6
|
+
* - gemini-3-pro-image-preview: "Nano Banana Pro" - Professional quality, better text rendering
|
|
7
|
+
*/
|
|
8
|
+
declare const GEMINI_IMAGE_MODELS: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview"];
|
|
9
|
+
type GeminiImageModel = (typeof GEMINI_IMAGE_MODELS)[number];
|
|
10
|
+
/**
|
|
11
|
+
* Schema for the Gemini image edit operation
|
|
12
|
+
*/
|
|
13
|
+
export declare const geminiEditSchema: TransformOperationSchema;
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for the Gemini transform provider
|
|
16
|
+
*/
|
|
17
|
+
export interface GeminiTransformConfig {
|
|
18
|
+
/** Default API key for Google AI / Gemini API */
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
/** Default model to use */
|
|
21
|
+
model?: GeminiImageModel;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a Gemini transform provider instance
|
|
25
|
+
*
|
|
26
|
+
* Provides AI-powered image editing using Gemini's multimodal capabilities.
|
|
27
|
+
* Users can provide their own API key per-request to enable the feature
|
|
28
|
+
* without requiring server-side key management.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import createClient from '@teamflojo/floimg';
|
|
33
|
+
* import { geminiTransform } from '@teamflojo/floimg-google';
|
|
34
|
+
*
|
|
35
|
+
* const floimg = createClient();
|
|
36
|
+
* floimg.registerTransformProvider(geminiTransform());
|
|
37
|
+
*
|
|
38
|
+
* // Edit an image with server API key
|
|
39
|
+
* const result = await floimg.transform({
|
|
40
|
+
* blob: inputImage,
|
|
41
|
+
* op: 'edit',
|
|
42
|
+
* provider: 'gemini-transform',
|
|
43
|
+
* params: {
|
|
44
|
+
* prompt: 'Make the sky more vibrant and add clouds'
|
|
45
|
+
* }
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* // Edit with user-provided API key
|
|
49
|
+
* const result = await floimg.transform({
|
|
50
|
+
* blob: inputImage,
|
|
51
|
+
* op: 'edit',
|
|
52
|
+
* provider: 'gemini-transform',
|
|
53
|
+
* params: {
|
|
54
|
+
* prompt: 'Remove the background',
|
|
55
|
+
* apiKey: userProvidedApiKey // User's own key
|
|
56
|
+
* }
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function geminiTransform(config?: GeminiTransformConfig): TransformProvider;
|
|
61
|
+
/**
|
|
62
|
+
* Schema for the Gemini image generator
|
|
63
|
+
*/
|
|
64
|
+
export declare const geminiGenerateSchema: GeneratorSchema;
|
|
65
|
+
/**
|
|
66
|
+
* Configuration for the Gemini image generator
|
|
67
|
+
*/
|
|
68
|
+
export interface GeminiGenerateConfig {
|
|
69
|
+
/** Default API key for Google AI / Gemini API */
|
|
70
|
+
apiKey?: string;
|
|
71
|
+
/** Default model to use */
|
|
72
|
+
model?: GeminiImageModel;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a Gemini image generator instance
|
|
76
|
+
*
|
|
77
|
+
* Generates images from text prompts using Gemini's native image generation.
|
|
78
|
+
* Uses the same models as Gemini Edit but without requiring an input image.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import createClient from '@teamflojo/floimg';
|
|
83
|
+
* import { geminiGenerate } from '@teamflojo/floimg-google';
|
|
84
|
+
*
|
|
85
|
+
* const floimg = createClient();
|
|
86
|
+
* floimg.registerGenerator(geminiGenerate());
|
|
87
|
+
*
|
|
88
|
+
* const image = await floimg.generate({
|
|
89
|
+
* generator: 'gemini-generate',
|
|
90
|
+
* params: {
|
|
91
|
+
* prompt: 'A steaming espresso cup with dramatic lighting',
|
|
92
|
+
* apiKey: userApiKey
|
|
93
|
+
* }
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function geminiGenerate(config?: GeminiGenerateConfig): ImageGenerator;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EAExB,cAAc,EACd,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,mEAAoE,CAAC;AAE9F,KAAK,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAmD7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,wBAyD9B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,qBAA0B,GAAG,iBAAiB,CAyLrF;AAMD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,eA+ClC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,oBAAyB,GAAG,cAAc,CAgIhF"}
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { GoogleGenAI } from "@google/genai";
|
|
2
|
+
/**
|
|
3
|
+
* Supported Gemini models for image generation/editing (Nano Banana)
|
|
4
|
+
*
|
|
5
|
+
* - gemini-2.5-flash-image: "Nano Banana" - Fast, high-volume, low-latency
|
|
6
|
+
* - gemini-3-pro-image-preview: "Nano Banana Pro" - Professional quality, better text rendering
|
|
7
|
+
*/
|
|
8
|
+
const GEMINI_IMAGE_MODELS = ["gemini-2.5-flash-image", "gemini-3-pro-image-preview"];
|
|
9
|
+
/**
|
|
10
|
+
* Supported aspect ratios for Gemini image generation
|
|
11
|
+
*/
|
|
12
|
+
const GEMINI_ASPECT_RATIOS = [
|
|
13
|
+
"1:1",
|
|
14
|
+
"2:3",
|
|
15
|
+
"3:2",
|
|
16
|
+
"3:4",
|
|
17
|
+
"4:3",
|
|
18
|
+
"4:5",
|
|
19
|
+
"5:4",
|
|
20
|
+
"9:16",
|
|
21
|
+
"16:9",
|
|
22
|
+
"21:9",
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Supported image sizes for Gemini image generation
|
|
26
|
+
* Note: Must use uppercase K (1K, 2K, 4K)
|
|
27
|
+
*/
|
|
28
|
+
const GEMINI_IMAGE_SIZES = ["1K", "2K", "4K"];
|
|
29
|
+
/**
|
|
30
|
+
* Map image size to approximate dimensions
|
|
31
|
+
*/
|
|
32
|
+
function getApproximateDimensionsFromSize(size, aspectRatio = "1:1") {
|
|
33
|
+
// Base size from imageSize
|
|
34
|
+
const baseSize = size === "4K" ? 4096 : size === "2K" ? 2048 : 1024;
|
|
35
|
+
// Calculate dimensions from aspect ratio
|
|
36
|
+
const [w, h] = aspectRatio.split(":").map(Number);
|
|
37
|
+
const ratio = w / h;
|
|
38
|
+
if (ratio >= 1) {
|
|
39
|
+
// Landscape or square
|
|
40
|
+
return { width: baseSize, height: Math.round(baseSize / ratio) };
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Portrait
|
|
44
|
+
return { width: Math.round(baseSize * ratio), height: baseSize };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Schema for the Gemini image edit operation
|
|
49
|
+
*/
|
|
50
|
+
export const geminiEditSchema = {
|
|
51
|
+
name: "edit",
|
|
52
|
+
description: "Edit an image using Gemini's multimodal AI capabilities",
|
|
53
|
+
category: "AI",
|
|
54
|
+
parameters: {
|
|
55
|
+
prompt: {
|
|
56
|
+
type: "string",
|
|
57
|
+
title: "Prompt",
|
|
58
|
+
description: "Describe the edits you want to make to the image",
|
|
59
|
+
},
|
|
60
|
+
prePrompt: {
|
|
61
|
+
type: "string",
|
|
62
|
+
title: "Pre-Prompt",
|
|
63
|
+
description: "Instructions prepended to the prompt (useful when receiving dynamic prompts from text nodes)",
|
|
64
|
+
default: "Edit this image by incorporating the following concept while preserving the original composition and style:",
|
|
65
|
+
},
|
|
66
|
+
model: {
|
|
67
|
+
type: "string",
|
|
68
|
+
title: "Model",
|
|
69
|
+
description: "Gemini model to use: Nano Banana (fast) or Nano Banana Pro (high quality)",
|
|
70
|
+
enum: [...GEMINI_IMAGE_MODELS],
|
|
71
|
+
default: "gemini-2.5-flash-image",
|
|
72
|
+
},
|
|
73
|
+
aspectRatio: {
|
|
74
|
+
type: "string",
|
|
75
|
+
title: "Aspect Ratio",
|
|
76
|
+
description: "Output image aspect ratio",
|
|
77
|
+
enum: [...GEMINI_ASPECT_RATIOS],
|
|
78
|
+
default: "1:1",
|
|
79
|
+
},
|
|
80
|
+
imageSize: {
|
|
81
|
+
type: "string",
|
|
82
|
+
title: "Image Size",
|
|
83
|
+
description: "Output resolution: 1K (1024px), 2K (2048px), or 4K (4096px)",
|
|
84
|
+
enum: [...GEMINI_IMAGE_SIZES],
|
|
85
|
+
default: "1K",
|
|
86
|
+
},
|
|
87
|
+
groundingWithSearch: {
|
|
88
|
+
type: "boolean",
|
|
89
|
+
title: "Ground with Google Search",
|
|
90
|
+
description: "Enable Google Search grounding for real-time data (weather, stocks, events)",
|
|
91
|
+
default: false,
|
|
92
|
+
},
|
|
93
|
+
apiKey: {
|
|
94
|
+
type: "string",
|
|
95
|
+
title: "API Key",
|
|
96
|
+
description: "Google AI API key (optional - uses server key if not provided)",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
requiredParameters: ["prompt"],
|
|
100
|
+
inputType: "image",
|
|
101
|
+
outputType: "image",
|
|
102
|
+
isAI: true,
|
|
103
|
+
requiresApiKey: true,
|
|
104
|
+
apiKeyEnvVar: "GOOGLE_AI_API_KEY",
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Create a Gemini transform provider instance
|
|
108
|
+
*
|
|
109
|
+
* Provides AI-powered image editing using Gemini's multimodal capabilities.
|
|
110
|
+
* Users can provide their own API key per-request to enable the feature
|
|
111
|
+
* without requiring server-side key management.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* import createClient from '@teamflojo/floimg';
|
|
116
|
+
* import { geminiTransform } from '@teamflojo/floimg-google';
|
|
117
|
+
*
|
|
118
|
+
* const floimg = createClient();
|
|
119
|
+
* floimg.registerTransformProvider(geminiTransform());
|
|
120
|
+
*
|
|
121
|
+
* // Edit an image with server API key
|
|
122
|
+
* const result = await floimg.transform({
|
|
123
|
+
* blob: inputImage,
|
|
124
|
+
* op: 'edit',
|
|
125
|
+
* provider: 'gemini-transform',
|
|
126
|
+
* params: {
|
|
127
|
+
* prompt: 'Make the sky more vibrant and add clouds'
|
|
128
|
+
* }
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* // Edit with user-provided API key
|
|
132
|
+
* const result = await floimg.transform({
|
|
133
|
+
* blob: inputImage,
|
|
134
|
+
* op: 'edit',
|
|
135
|
+
* provider: 'gemini-transform',
|
|
136
|
+
* params: {
|
|
137
|
+
* prompt: 'Remove the background',
|
|
138
|
+
* apiKey: userProvidedApiKey // User's own key
|
|
139
|
+
* }
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export function geminiTransform(config = {}) {
|
|
144
|
+
const defaultApiKey = config.apiKey || process.env.GOOGLE_AI_API_KEY;
|
|
145
|
+
const defaultModel = config.model || "gemini-2.5-flash-image";
|
|
146
|
+
// Cache clients by API key to avoid recreating for same key
|
|
147
|
+
const clientCache = new Map();
|
|
148
|
+
function getClient(apiKey) {
|
|
149
|
+
let client = clientCache.get(apiKey);
|
|
150
|
+
if (!client) {
|
|
151
|
+
client = new GoogleGenAI({ apiKey });
|
|
152
|
+
clientCache.set(apiKey, client);
|
|
153
|
+
}
|
|
154
|
+
return client;
|
|
155
|
+
}
|
|
156
|
+
const operationSchemas = {
|
|
157
|
+
edit: geminiEditSchema,
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Edit an image using Gemini's multimodal capabilities
|
|
161
|
+
*/
|
|
162
|
+
async function edit(input, params) {
|
|
163
|
+
const { prompt, prePrompt, model = defaultModel, aspectRatio = "1:1", imageSize = "1K", groundingWithSearch = false, apiKey: requestApiKey, } = params;
|
|
164
|
+
// Use request API key if provided, otherwise fall back to default
|
|
165
|
+
const apiKey = requestApiKey || defaultApiKey;
|
|
166
|
+
if (!apiKey) {
|
|
167
|
+
throw new Error("Google AI API key is required. Provide apiKey in params or set GOOGLE_AI_API_KEY environment variable.");
|
|
168
|
+
}
|
|
169
|
+
if (!prompt) {
|
|
170
|
+
throw new Error("prompt is required for Gemini image editing");
|
|
171
|
+
}
|
|
172
|
+
const client = getClient(apiKey);
|
|
173
|
+
// Convert input image to base64
|
|
174
|
+
const base64Image = input.bytes.toString("base64");
|
|
175
|
+
// Build full prompt: prePrompt (if set) + prompt
|
|
176
|
+
// prePrompt helps guide the model when receiving dynamic prompts from text nodes
|
|
177
|
+
const fullPrompt = prePrompt ? `${prePrompt}\n\n${prompt}` : prompt;
|
|
178
|
+
// Build config with imageConfig for aspect ratio and size
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
180
|
+
const config = {
|
|
181
|
+
responseModalities: ["TEXT", "IMAGE"],
|
|
182
|
+
imageConfig: {
|
|
183
|
+
aspectRatio,
|
|
184
|
+
imageSize,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
// Add Google Search grounding if enabled
|
|
188
|
+
if (groundingWithSearch) {
|
|
189
|
+
config.tools = [{ googleSearch: {} }];
|
|
190
|
+
}
|
|
191
|
+
// Call Gemini with image + text prompt
|
|
192
|
+
const response = await client.models.generateContent({
|
|
193
|
+
model,
|
|
194
|
+
contents: [
|
|
195
|
+
{
|
|
196
|
+
role: "user",
|
|
197
|
+
parts: [
|
|
198
|
+
{ text: fullPrompt },
|
|
199
|
+
{
|
|
200
|
+
inlineData: {
|
|
201
|
+
mimeType: input.mime,
|
|
202
|
+
data: base64Image,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
config,
|
|
209
|
+
});
|
|
210
|
+
// Extract the generated image from the response
|
|
211
|
+
const candidates = response.candidates;
|
|
212
|
+
if (!candidates || candidates.length === 0) {
|
|
213
|
+
throw new Error("No response from Gemini");
|
|
214
|
+
}
|
|
215
|
+
const parts = candidates[0].content?.parts;
|
|
216
|
+
if (!parts) {
|
|
217
|
+
throw new Error("No content in Gemini response");
|
|
218
|
+
}
|
|
219
|
+
// Find the image part in the response
|
|
220
|
+
const imagePart = parts.find((part) => part.inlineData?.mimeType?.startsWith("image/"));
|
|
221
|
+
if (!imagePart?.inlineData?.data) {
|
|
222
|
+
// Check if there's text explaining why no image was generated
|
|
223
|
+
const textPart = parts.find((part) => part.text);
|
|
224
|
+
if (textPart?.text) {
|
|
225
|
+
throw new Error(`Gemini could not edit the image: ${textPart.text}`);
|
|
226
|
+
}
|
|
227
|
+
throw new Error("No image returned from Gemini");
|
|
228
|
+
}
|
|
229
|
+
// Convert base64 response to Buffer
|
|
230
|
+
const bytes = Buffer.from(imagePart.inlineData.data, "base64");
|
|
231
|
+
// Cast mime type - Gemini returns standard image types
|
|
232
|
+
const responseMime = imagePart.inlineData.mimeType || "image/png";
|
|
233
|
+
const mime = responseMime.includes("jpeg")
|
|
234
|
+
? "image/jpeg"
|
|
235
|
+
: responseMime.includes("webp")
|
|
236
|
+
? "image/webp"
|
|
237
|
+
: "image/png";
|
|
238
|
+
// Get dimensions from imageSize and aspectRatio
|
|
239
|
+
const dimensions = getApproximateDimensionsFromSize(imageSize, aspectRatio);
|
|
240
|
+
return {
|
|
241
|
+
bytes,
|
|
242
|
+
mime,
|
|
243
|
+
width: dimensions.width,
|
|
244
|
+
height: dimensions.height,
|
|
245
|
+
source: `ai:gemini:${model}`,
|
|
246
|
+
metadata: {
|
|
247
|
+
operation: "edit",
|
|
248
|
+
prompt: fullPrompt,
|
|
249
|
+
prePrompt,
|
|
250
|
+
model,
|
|
251
|
+
aspectRatio,
|
|
252
|
+
imageSize,
|
|
253
|
+
groundingWithSearch,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
// Operation dispatch map
|
|
258
|
+
const operations = {
|
|
259
|
+
edit: (input, params) => edit(input, params),
|
|
260
|
+
};
|
|
261
|
+
return {
|
|
262
|
+
name: "gemini-transform",
|
|
263
|
+
operationSchemas,
|
|
264
|
+
async transform(input, op, params) {
|
|
265
|
+
const operation = operations[op];
|
|
266
|
+
if (!operation) {
|
|
267
|
+
throw new Error(`Unknown operation: ${op}. Supported: ${Object.keys(operations).join(", ")}`);
|
|
268
|
+
}
|
|
269
|
+
return operation(input, params);
|
|
270
|
+
},
|
|
271
|
+
// Required by interface but we don't support format conversion
|
|
272
|
+
async convert() {
|
|
273
|
+
throw new Error("Gemini transform provider does not support format conversion. Use the sharp provider instead.");
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
// ============================================================================
|
|
278
|
+
// Gemini Image Generator (from text prompt only, no input image)
|
|
279
|
+
// ============================================================================
|
|
280
|
+
/**
|
|
281
|
+
* Schema for the Gemini image generator
|
|
282
|
+
*/
|
|
283
|
+
export const geminiGenerateSchema = {
|
|
284
|
+
name: "gemini-generate",
|
|
285
|
+
description: "Generate images from text using Gemini's native image generation",
|
|
286
|
+
category: "AI",
|
|
287
|
+
parameters: {
|
|
288
|
+
prompt: {
|
|
289
|
+
type: "string",
|
|
290
|
+
title: "Prompt",
|
|
291
|
+
description: "Describe the image you want to generate",
|
|
292
|
+
},
|
|
293
|
+
model: {
|
|
294
|
+
type: "string",
|
|
295
|
+
title: "Model",
|
|
296
|
+
description: "Gemini model to use: Nano Banana (fast) or Nano Banana Pro (high quality)",
|
|
297
|
+
enum: [...GEMINI_IMAGE_MODELS],
|
|
298
|
+
default: "gemini-2.5-flash-image",
|
|
299
|
+
},
|
|
300
|
+
aspectRatio: {
|
|
301
|
+
type: "string",
|
|
302
|
+
title: "Aspect Ratio",
|
|
303
|
+
description: "Output image aspect ratio",
|
|
304
|
+
enum: [...GEMINI_ASPECT_RATIOS],
|
|
305
|
+
default: "1:1",
|
|
306
|
+
},
|
|
307
|
+
imageSize: {
|
|
308
|
+
type: "string",
|
|
309
|
+
title: "Image Size",
|
|
310
|
+
description: "Output resolution: 1K (1024px), 2K (2048px), or 4K (4096px)",
|
|
311
|
+
enum: [...GEMINI_IMAGE_SIZES],
|
|
312
|
+
default: "1K",
|
|
313
|
+
},
|
|
314
|
+
groundingWithSearch: {
|
|
315
|
+
type: "boolean",
|
|
316
|
+
title: "Ground with Google Search",
|
|
317
|
+
description: "Enable Google Search grounding for real-time data (weather, stocks, events)",
|
|
318
|
+
default: false,
|
|
319
|
+
},
|
|
320
|
+
apiKey: {
|
|
321
|
+
type: "string",
|
|
322
|
+
title: "API Key",
|
|
323
|
+
description: "Google AI API key (optional - uses server key if not provided)",
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
requiredParameters: ["prompt"],
|
|
327
|
+
isAI: true,
|
|
328
|
+
requiresApiKey: true,
|
|
329
|
+
apiKeyEnvVar: "GOOGLE_AI_API_KEY",
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Create a Gemini image generator instance
|
|
333
|
+
*
|
|
334
|
+
* Generates images from text prompts using Gemini's native image generation.
|
|
335
|
+
* Uses the same models as Gemini Edit but without requiring an input image.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* import createClient from '@teamflojo/floimg';
|
|
340
|
+
* import { geminiGenerate } from '@teamflojo/floimg-google';
|
|
341
|
+
*
|
|
342
|
+
* const floimg = createClient();
|
|
343
|
+
* floimg.registerGenerator(geminiGenerate());
|
|
344
|
+
*
|
|
345
|
+
* const image = await floimg.generate({
|
|
346
|
+
* generator: 'gemini-generate',
|
|
347
|
+
* params: {
|
|
348
|
+
* prompt: 'A steaming espresso cup with dramatic lighting',
|
|
349
|
+
* apiKey: userApiKey
|
|
350
|
+
* }
|
|
351
|
+
* });
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
export function geminiGenerate(config = {}) {
|
|
355
|
+
const defaultApiKey = config.apiKey || process.env.GOOGLE_AI_API_KEY;
|
|
356
|
+
const defaultModel = config.model || "gemini-2.5-flash-image";
|
|
357
|
+
// Cache clients by API key
|
|
358
|
+
const clientCache = new Map();
|
|
359
|
+
function getClient(apiKey) {
|
|
360
|
+
let client = clientCache.get(apiKey);
|
|
361
|
+
if (!client) {
|
|
362
|
+
client = new GoogleGenAI({ apiKey });
|
|
363
|
+
clientCache.set(apiKey, client);
|
|
364
|
+
}
|
|
365
|
+
return client;
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
name: "gemini-generate",
|
|
369
|
+
schema: geminiGenerateSchema,
|
|
370
|
+
async generate(params) {
|
|
371
|
+
const { prompt, model = defaultModel, aspectRatio = "1:1", imageSize = "1K", groundingWithSearch = false, apiKey: requestApiKey, } = params;
|
|
372
|
+
const apiKey = requestApiKey || defaultApiKey;
|
|
373
|
+
if (!apiKey) {
|
|
374
|
+
throw new Error("Google AI API key is required. Provide apiKey in params or set GOOGLE_AI_API_KEY environment variable.");
|
|
375
|
+
}
|
|
376
|
+
if (!prompt) {
|
|
377
|
+
throw new Error("prompt is required for Gemini image generation");
|
|
378
|
+
}
|
|
379
|
+
const client = getClient(apiKey);
|
|
380
|
+
// Build config with imageConfig for aspect ratio and size
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
382
|
+
const config = {
|
|
383
|
+
responseModalities: ["TEXT", "IMAGE"],
|
|
384
|
+
imageConfig: {
|
|
385
|
+
aspectRatio,
|
|
386
|
+
imageSize,
|
|
387
|
+
},
|
|
388
|
+
};
|
|
389
|
+
// Add Google Search grounding if enabled
|
|
390
|
+
if (groundingWithSearch) {
|
|
391
|
+
config.tools = [{ googleSearch: {} }];
|
|
392
|
+
}
|
|
393
|
+
// Call Gemini with just text prompt (no input image)
|
|
394
|
+
const response = await client.models.generateContent({
|
|
395
|
+
model,
|
|
396
|
+
contents: [
|
|
397
|
+
{
|
|
398
|
+
role: "user",
|
|
399
|
+
parts: [{ text: prompt }],
|
|
400
|
+
},
|
|
401
|
+
],
|
|
402
|
+
config,
|
|
403
|
+
});
|
|
404
|
+
// Extract the generated image from the response
|
|
405
|
+
const candidates = response.candidates;
|
|
406
|
+
if (!candidates || candidates.length === 0) {
|
|
407
|
+
throw new Error("No response from Gemini");
|
|
408
|
+
}
|
|
409
|
+
const parts = candidates[0].content?.parts;
|
|
410
|
+
if (!parts) {
|
|
411
|
+
throw new Error("No content in Gemini response");
|
|
412
|
+
}
|
|
413
|
+
// Find the image part in the response
|
|
414
|
+
const imagePart = parts.find((part) => part.inlineData?.mimeType?.startsWith("image/"));
|
|
415
|
+
if (!imagePart?.inlineData?.data) {
|
|
416
|
+
const textPart = parts.find((part) => part.text);
|
|
417
|
+
if (textPart?.text) {
|
|
418
|
+
throw new Error(`Gemini could not generate the image: ${textPart.text}`);
|
|
419
|
+
}
|
|
420
|
+
throw new Error("No image returned from Gemini");
|
|
421
|
+
}
|
|
422
|
+
// Convert base64 response to Buffer
|
|
423
|
+
const bytes = Buffer.from(imagePart.inlineData.data, "base64");
|
|
424
|
+
const responseMime = imagePart.inlineData.mimeType || "image/png";
|
|
425
|
+
const mime = responseMime.includes("jpeg")
|
|
426
|
+
? "image/jpeg"
|
|
427
|
+
: responseMime.includes("webp")
|
|
428
|
+
? "image/webp"
|
|
429
|
+
: "image/png";
|
|
430
|
+
// Get dimensions from imageSize and aspectRatio
|
|
431
|
+
const dimensions = getApproximateDimensionsFromSize(imageSize, aspectRatio);
|
|
432
|
+
return {
|
|
433
|
+
bytes,
|
|
434
|
+
mime,
|
|
435
|
+
width: dimensions.width,
|
|
436
|
+
height: dimensions.height,
|
|
437
|
+
source: `ai:gemini:${model}`,
|
|
438
|
+
metadata: {
|
|
439
|
+
operation: "generate",
|
|
440
|
+
prompt,
|
|
441
|
+
model,
|
|
442
|
+
aspectRatio,
|
|
443
|
+
imageSize,
|
|
444
|
+
groundingWithSearch,
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
//# sourceMappingURL=transforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAU5C;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,wBAAwB,EAAE,4BAA4B,CAAU,CAAC;AAI9F;;GAEG;AACH,MAAM,oBAAoB,GAAG;IAC3B,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACE,CAAC;AAIX;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAIvD;;GAEG;AACH,SAAS,gCAAgC,CACvC,IAAqB,EACrB,cAAiC,KAAK;IAEtC,2BAA2B;IAC3B,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;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,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjD,IAAI,QAAQ,EAAE,IAAI,EAAE,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,wCAAwC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC3E,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,oCAAoC;YACpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC/D,MAAM,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,QAAQ,IAAI,WAAW,CAAC;YAClE,MAAM,IAAI,GAAa,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAClD,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;oBAC7B,CAAC,CAAC,YAAY;oBACd,CAAC,CAAC,WAAW,CAAC;YAElB,gDAAgD;YAChD,MAAM,UAAU,GAAG,gCAAgC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YAE5E,OAAO;gBACL,KAAK;gBACL,IAAI;gBACJ,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,MAAM,EAAE,aAAa,KAAK,EAAE;gBAC5B,QAAQ,EAAE;oBACR,SAAS,EAAE,UAAU;oBACrB,MAAM;oBACN,KAAK;oBACL,WAAW;oBACX,SAAS;oBACT,mBAAmB;iBACpB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamflojo/floimg-google",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Google Imagen image generation plugin for floimg",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,14 +16,6 @@
|
|
|
16
16
|
"README.md",
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"dev": "tsc --watch",
|
|
22
|
-
"typecheck": "tsc --noEmit",
|
|
23
|
-
"clean": "rm -rf dist",
|
|
24
|
-
"prepublishOnly": "npm run build",
|
|
25
|
-
"test": "vitest --run"
|
|
26
|
-
},
|
|
27
19
|
"keywords": [
|
|
28
20
|
"floimg",
|
|
29
21
|
"google",
|
|
@@ -47,11 +39,18 @@
|
|
|
47
39
|
},
|
|
48
40
|
"devDependencies": {
|
|
49
41
|
"@types/node": "^22.10.2",
|
|
50
|
-
"@teamflojo/floimg": "workspace:*",
|
|
51
42
|
"typescript": "^5.7.2",
|
|
52
|
-
"vitest": "^2.1.8"
|
|
43
|
+
"vitest": "^2.1.8",
|
|
44
|
+
"@teamflojo/floimg": "0.6.2"
|
|
53
45
|
},
|
|
54
46
|
"engines": {
|
|
55
47
|
"node": ">=18.0.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc",
|
|
51
|
+
"dev": "tsc --watch",
|
|
52
|
+
"typecheck": "tsc --noEmit",
|
|
53
|
+
"clean": "rm -rf dist",
|
|
54
|
+
"test": "vitest --run"
|
|
56
55
|
}
|
|
57
|
-
}
|
|
56
|
+
}
|