@coreviz/sdk 1.0.17 → 1.0.19

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/README.md CHANGED
@@ -144,26 +144,24 @@ const editedImage = await coreviz.edit('https://example.com/photo.jpg', {
144
144
  });
145
145
  ```
146
146
 
147
- ### `coreviz.batchGenerate(prompt, options)`
147
+ ### `coreviz.generate(prompt, options)`
148
148
 
149
- Generates multiple images based on a text prompt, optionally using reference images for style/structure guidance.
149
+ Generates an image based on a text prompt, optionally using reference images for style/structure guidance.
150
150
 
151
151
  **Parameters:**
152
152
  - `prompt` (string): The text description of the image(s) to generate.
153
153
  - `options` (object, optional):
154
154
  - `referenceImages` (string[], optional): Array of reference images (URL/base64) to guide generation.
155
- - `count` (number, optional): Number of images to generate (default: 1).
156
155
  - `aspectRatio` (string, optional): Target aspect ratio (e.g., `'1:1'`, `'16:9'`, `'4:3'`).
157
156
  - `model` (string, optional): The model to use (default: `'google/nano-banana-pro'`).
158
157
 
159
158
  **Returns:**
160
- - `Promise<string[]>`: An array of generated images as URLs.
159
+ - `string`: The generated images as a URL.
161
160
 
162
161
  **Example:**
163
162
 
164
163
  ```typescript
165
- const images = await coreviz.batchGenerate("A futuristic city skyline", {
166
- count: 4,
164
+ const images = await coreviz.generate("A futuristic city skyline", {
167
165
  aspectRatio: "16:9"
168
166
  });
169
167
  ```
package/dist/coreviz.d.ts CHANGED
@@ -27,11 +27,10 @@ export interface EmbedOptions {
27
27
  export interface EmbedResponse {
28
28
  embedding: number[];
29
29
  }
30
- export interface BatchGenerateOptions {
30
+ export interface GenerateOptions {
31
31
  referenceImages?: string[];
32
- count?: number;
33
32
  aspectRatio?: '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9';
34
- model?: 'google/nano-banana' | 'google/nano-banana-pro';
33
+ model?: 'google/nano-banana' | 'google/nano-banana-pro' | 'seedream-4' | 'flux-kontext-max';
35
34
  }
36
35
  export declare class CoreViz {
37
36
  private apiKey?;
@@ -41,7 +40,7 @@ export declare class CoreViz {
41
40
  private handleResponse;
42
41
  describe(image: string, options?: DescribeOptions): Promise<string>;
43
42
  edit(image: string, options: EditOptions): Promise<string>;
44
- batchGenerate(prompt: string, options?: BatchGenerateOptions): Promise<string[]>;
43
+ generate(prompt: string, options?: GenerateOptions): Promise<string>;
45
44
  tag(image: string, options: TagOptions): Promise<TagResponse>;
46
45
  private tagLocal;
47
46
  embed(input: string, options?: EmbedOptions): Promise<EmbedResponse>;
package/dist/coreviz.js CHANGED
@@ -103,26 +103,25 @@ class CoreViz {
103
103
  throw err instanceof Error ? err : new Error("An unexpected error occurred.");
104
104
  }
105
105
  }
106
- async batchGenerate(prompt, options = {}) {
106
+ async generate(prompt, options = {}) {
107
107
  try {
108
108
  const headers = this.getHeaders();
109
109
  let resizedImages = [];
110
110
  if (options.referenceImages && options.referenceImages.length > 0) {
111
111
  resizedImages = await Promise.all(options.referenceImages.map(img => (0, resize_1.resize)(img, 1024, 1024)));
112
112
  }
113
- const response = await fetch(`https://lab.coreviz.io/api/ai/batch-generate`, {
113
+ const response = await fetch(`https://lab.coreviz.io/api/ai/generate`, {
114
114
  method: 'POST',
115
115
  headers,
116
116
  body: JSON.stringify({
117
117
  prompt,
118
118
  image: resizedImages.length > 0 ? resizedImages : undefined,
119
- count: options.count || 1,
120
119
  aspectRatio: options.aspectRatio,
121
120
  model: options.model || 'google/nano-banana-pro',
122
121
  }),
123
122
  });
124
123
  const data = await this.handleResponse(response);
125
- return data.results || [];
124
+ return data.result;
126
125
  }
127
126
  catch (err) {
128
127
  throw err instanceof Error ? err : new Error("An unexpected error occurred.");
@@ -27,11 +27,10 @@ export interface EmbedOptions {
27
27
  export interface EmbedResponse {
28
28
  embedding: number[];
29
29
  }
30
- export interface BatchGenerateOptions {
30
+ export interface GenerateOptions {
31
31
  referenceImages?: string[];
32
- count?: number;
33
32
  aspectRatio?: '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9';
34
- model?: 'google/nano-banana' | 'google/nano-banana-pro';
33
+ model?: 'google/nano-banana' | 'google/nano-banana-pro' | 'seedream-4' | 'flux-kontext-max';
35
34
  }
36
35
  export declare class CoreViz {
37
36
  private apiKey?;
@@ -41,7 +40,7 @@ export declare class CoreViz {
41
40
  private handleResponse;
42
41
  describe(image: string, _options?: DescribeOptions): Promise<string>;
43
42
  edit(image: string, options: EditOptions): Promise<string>;
44
- batchGenerate(prompt: string, options?: BatchGenerateOptions): Promise<string[]>;
43
+ generate(prompt: string, options?: GenerateOptions): Promise<string>;
45
44
  tag(image: string, options: TagOptions): Promise<TagResponse>;
46
45
  embed(input: string, options?: EmbedOptions): Promise<EmbedResponse>;
47
46
  resize(input: string | File, maxWidth?: number, maxHeight?: number): Promise<string>;
@@ -61,25 +61,24 @@ class CoreViz {
61
61
  const data = await this.handleResponse(response);
62
62
  return data.result;
63
63
  }
64
- async batchGenerate(prompt, options = {}) {
64
+ async generate(prompt, options = {}) {
65
65
  const headers = this.getHeaders();
66
66
  let resizedImages = [];
67
67
  if (options.referenceImages && options.referenceImages.length > 0) {
68
68
  resizedImages = await Promise.all(options.referenceImages.map((img) => (0, resize_native_1.resize)(img, 1024, 1024)));
69
69
  }
70
- const response = await fetch(`https://lab.coreviz.io/api/ai/batch-generate`, {
70
+ const response = await fetch(`https://lab.coreviz.io/api/ai/generate`, {
71
71
  method: 'POST',
72
72
  headers,
73
73
  body: JSON.stringify({
74
74
  prompt,
75
75
  image: resizedImages.length > 0 ? resizedImages : undefined,
76
- count: options.count || 1,
77
76
  aspectRatio: options.aspectRatio,
78
77
  model: options.model || 'google/nano-banana-pro',
79
78
  }),
80
79
  });
81
80
  const data = await this.handleResponse(response);
82
- return data.results || [];
81
+ return data.result;
83
82
  }
84
83
  async tag(image, options) {
85
84
  const mode = options?.mode || 'api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreviz/sdk",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "CoreViz SDK",
5
5
  "main": "dist/index.js",
6
6
  "react-native": "dist/index.native.js",