@umituz/react-native-ai-gemini-provider 1.5.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-gemini-provider",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Google Gemini AI provider for React Native applications",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -16,8 +16,8 @@ export const GEMINI_MODELS = {
16
16
 
17
17
  // Image generation models
18
18
  IMAGE: {
19
- FLASH: "gemini-2.5-flash-preview-image-generation",
20
- FLASH_STABLE: "gemini-2.0-flash-preview-image-generation",
19
+ FLASH: "gemini-2.5-flash-preview-image",
20
+ FLASH_STABLE: "gemini-2.0-flash-preview-image",
21
21
  },
22
22
 
23
23
  // Video understanding models
@@ -66,13 +66,26 @@ class GeminiClientService {
66
66
  private initialized = false;
67
67
 
68
68
  initialize(config: GeminiConfig): void {
69
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
70
+ // eslint-disable-next-line no-console
71
+ console.log("[GeminiClient] initialize() called", {
72
+ hasApiKey: !!config.apiKey,
73
+ defaultModel: config.defaultModel,
74
+ imageModel: config.imageModel,
75
+ });
76
+ }
77
+
69
78
  this.client = new GoogleGenerativeAI(config.apiKey);
70
79
  this.config = { ...DEFAULT_CONFIG, ...config };
71
80
  this.initialized = true;
72
81
 
73
82
  if (typeof __DEV__ !== "undefined" && __DEV__) {
74
83
  // eslint-disable-next-line no-console
75
- console.log("[Gemini] Client initialized with official SDK");
84
+ console.log("[GeminiClient] initialized successfully", {
85
+ defaultModel: this.config.defaultModel,
86
+ imageModel: this.config.imageModel,
87
+ maxRetries: this.config.maxRetries,
88
+ });
76
89
  }
77
90
  }
78
91
 
@@ -212,6 +225,16 @@ class GeminiClientService {
212
225
  images: Array<{ base64: string; mimeType: string }>,
213
226
  config?: GeminiGenerationConfig,
214
227
  ): Promise<GeminiResponse> {
228
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
229
+ // eslint-disable-next-line no-console
230
+ console.log("[GeminiClient] generateWithImages() called", {
231
+ model,
232
+ promptLength: prompt.length,
233
+ imagesCount: images.length,
234
+ imageMimeTypes: images.map(i => i.mimeType),
235
+ });
236
+ }
237
+
215
238
  const parts: GeminiContent["parts"] = [{ text: prompt }];
216
239
 
217
240
  for (const image of images) {
@@ -225,6 +248,11 @@ class GeminiClientService {
225
248
 
226
249
  const contents: GeminiContent[] = [{ parts, role: "user" }];
227
250
 
251
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
252
+ // eslint-disable-next-line no-console
253
+ console.log("[GeminiClient] generateWithImages() → calling generateContent()");
254
+ }
255
+
228
256
  return this.generateContent(model, contents, config);
229
257
  }
230
258
 
@@ -241,7 +269,12 @@ class GeminiClientService {
241
269
 
242
270
  if (typeof __DEV__ !== "undefined" && __DEV__) {
243
271
  // eslint-disable-next-line no-console
244
- console.log("[Gemini] Generate image:", { model: imageModel, hasInputImages: !!images?.length });
272
+ console.log("[GeminiClient] generateImage() called", {
273
+ model: imageModel,
274
+ promptLength: prompt.length,
275
+ hasInputImages: !!images?.length,
276
+ inputImagesCount: images?.length ?? 0,
277
+ });
245
278
  }
246
279
 
247
280
  const parts: GeminiContent["parts"] = [{ text: prompt }];
@@ -295,6 +328,16 @@ class GeminiClientService {
295
328
  }
296
329
  }
297
330
 
331
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
332
+ // eslint-disable-next-line no-console
333
+ console.log("[GeminiClient] generateImage() completed", {
334
+ hasText: !!result.text,
335
+ hasImage: !!result.imageBase64,
336
+ mimeType: result.mimeType,
337
+ imageDataLength: result.imageBase64?.length ?? 0,
338
+ });
339
+ }
340
+
298
341
  return result;
299
342
  }
300
343
 
@@ -67,6 +67,14 @@ class GeminiProviderService {
67
67
  private jobCounter = 0;
68
68
 
69
69
  initialize(config: AIProviderConfig): void {
70
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
71
+ // eslint-disable-next-line no-console
72
+ console.log("[GeminiProvider] initialize() called", {
73
+ hasApiKey: !!config.apiKey,
74
+ imageModel: config.imageModel,
75
+ });
76
+ }
77
+
70
78
  const geminiConfig: GeminiConfig = {
71
79
  apiKey: config.apiKey,
72
80
  maxRetries: config.maxRetries,
@@ -77,6 +85,11 @@ class GeminiProviderService {
77
85
  };
78
86
 
79
87
  geminiClientService.initialize(geminiConfig);
88
+
89
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
90
+ // eslint-disable-next-line no-console
91
+ console.log("[GeminiProvider] initialized successfully");
92
+ }
80
93
  }
81
94
 
82
95
  isInitialized(): boolean {
@@ -206,6 +219,15 @@ class GeminiProviderService {
206
219
  prompt: string,
207
220
  images: GeminiImageInput[],
208
221
  ): Promise<{ text: string; response: unknown }> {
222
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
223
+ // eslint-disable-next-line no-console
224
+ console.log("[GeminiProvider] generateWithImages() called", {
225
+ model,
226
+ promptLength: prompt.length,
227
+ imagesCount: images.length,
228
+ });
229
+ }
230
+
209
231
  const response = await geminiClientService.generateWithImages(
210
232
  model,
211
233
  prompt,
@@ -217,6 +239,14 @@ class GeminiProviderService {
217
239
  .map((p) => p.text)
218
240
  .join("") || "";
219
241
 
242
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
243
+ // eslint-disable-next-line no-console
244
+ console.log("[GeminiProvider] generateWithImages() completed", {
245
+ hasText: !!text,
246
+ textLength: text.length,
247
+ });
248
+ }
249
+
220
250
  return { text, response };
221
251
  }
222
252