@umituz/react-native-ai-gemini-provider 1.14.8 → 1.14.9

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.14.8",
3
+ "version": "1.14.9",
4
4
  "description": "Google Gemini AI provider for React Native applications",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -10,6 +10,7 @@ import type {
10
10
  JobSubmission,
11
11
  JobStatus,
12
12
  SubscribeOptions,
13
+ RunOptions,
13
14
  ImageFeatureType,
14
15
  VideoFeatureType,
15
16
  ImageFeatureInputData,
@@ -72,9 +73,10 @@ export class GeminiProvider implements IAIProvider {
72
73
  options?: SubscribeOptions<T>,
73
74
  ): Promise<T> {
74
75
  options?.onQueueUpdate?.({ status: "IN_QUEUE" });
75
- options?.onProgress?.(10);
76
76
 
77
- const result = await generationExecutor.executeGeneration<T>(model, input);
77
+ const result = await generationExecutor.executeGeneration<T>(model, input, {
78
+ onProgress: options?.onProgress,
79
+ });
78
80
 
79
81
  options?.onProgress?.(100);
80
82
  options?.onQueueUpdate?.({ status: "COMPLETED" });
@@ -86,8 +88,11 @@ export class GeminiProvider implements IAIProvider {
86
88
  async run<T = unknown>(
87
89
  model: string,
88
90
  input: Record<string, unknown>,
91
+ options?: RunOptions,
89
92
  ): Promise<T> {
90
- return generationExecutor.executeGeneration<T>(model, input);
93
+ return generationExecutor.executeGeneration<T>(model, input, {
94
+ onProgress: options?.onProgress,
95
+ });
91
96
  }
92
97
 
93
98
  async generateImage(prompt: string): Promise<GeminiImageGenerationResult> {
@@ -6,6 +6,7 @@
6
6
  import type {
7
7
  GeminiImageInput,
8
8
  VideoGenerationInput,
9
+ VideoGenerationProgress,
9
10
  } from "../../domain/entities";
10
11
  import { geminiTextGenerationService } from "./gemini-text-generation.service";
11
12
  import { geminiImageGenerationService } from "./gemini-image-generation.service";
@@ -13,6 +14,10 @@ import { geminiVideoGenerationService } from "./gemini-video-generation.service"
13
14
  import { ContentBuilder } from "../content/ContentBuilder";
14
15
  import { ResponseFormatter } from "../response/ResponseFormatter";
15
16
 
17
+ export interface ExecutionOptions {
18
+ onProgress?: (progress: number) => void;
19
+ }
20
+
16
21
  export class GenerationExecutor {
17
22
  private contentBuilder = new ContentBuilder();
18
23
  private responseFormatter = new ResponseFormatter();
@@ -20,12 +25,13 @@ export class GenerationExecutor {
20
25
  async executeGeneration<T>(
21
26
  model: string,
22
27
  input: Record<string, unknown>,
28
+ options?: ExecutionOptions,
23
29
  ): Promise<T> {
24
30
  const isImageGeneration = input.generateImage === true || input.type === "image";
25
31
  const isVideoGeneration = this.isVideoModel(model) || input.type === "video";
26
32
 
27
33
  if (isVideoGeneration) {
28
- return this.executeVideoGeneration<T>(input);
34
+ return this.executeVideoGeneration<T>(input, options);
29
35
  }
30
36
 
31
37
  if (isImageGeneration) {
@@ -55,7 +61,10 @@ export class GenerationExecutor {
55
61
  /**
56
62
  * Execute video generation using Veo API
57
63
  */
58
- private async executeVideoGeneration<T>(input: Record<string, unknown>): Promise<T> {
64
+ private async executeVideoGeneration<T>(
65
+ input: Record<string, unknown>,
66
+ options?: ExecutionOptions,
67
+ ): Promise<T> {
59
68
  const videoInput: VideoGenerationInput = {
60
69
  prompt: String(input.prompt || ""),
61
70
  image: input.image as string | undefined,
@@ -65,7 +74,11 @@ export class GenerationExecutor {
65
74
  },
66
75
  };
67
76
 
68
- const result = await geminiVideoGenerationService.generateVideo(videoInput);
77
+ const onProgress = options?.onProgress
78
+ ? (p: VideoGenerationProgress) => options.onProgress?.(p.progress)
79
+ : undefined;
80
+
81
+ const result = await geminiVideoGenerationService.generateVideo(videoInput, onProgress);
69
82
 
70
83
  return {
71
84
  video: { url: result.videoUrl },