@coreviz/sdk 1.0.10 → 1.0.12

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
@@ -1,6 +1,21 @@
1
1
  # @coreviz/sdk
2
2
 
3
- The official JavaScript/TypeScript SDK for CoreViz's Vision AI APIs. Easily integrate powerful image analysis and manipulation features into your applications.
3
+ Easily integrate powerful image analysis and manipulation features into your applications with CoreViz (https://coreviz.io/) 's Vision SDK.
4
+
5
+ ## Introduction
6
+
7
+ [![CoreViz Demo Screenshot](./demo/demo.gif)](https://coreviz.io/)
8
+
9
+ The CoreViz SDK powers the [coreviz.io](https://coreviz.io/) platform and the [CoreViz CLI](https://github.com/coreviz/cli), providing fast, consistent AI image analysis and manipulation capabilities across environments.
10
+
11
+ You can try out the live demos and tools built with this SDK at [coreviz.io/tools](https://coreviz.io/tools), including:
12
+
13
+ - **Image Description**: Generate detailed captions for any image. [→ Demo](https://coreviz.io/tools/describe)
14
+ - **Tagging / Classification**: Classify images with custom or general prompts. [→ Demo](https://coreviz.io/tools/tag)
15
+ - **Image Editing**: Modify or retouch images using generative AI based on text instructions. [→ Demo](https://coreviz.io/tools/edit)
16
+
17
+ Check out [coreviz.io/tools](https://coreviz.io/tools) to explore these features interactively.
18
+
4
19
 
5
20
  ## Installation
6
21
 
@@ -90,6 +105,43 @@ const editedImage = await coreviz.edit('https://example.com/photo.jpg', {
90
105
  });
91
106
  ```
92
107
 
108
+ ### `coreviz.embed(input, options?)`
109
+
110
+ Generates embeddings for image or text inputs, enabling semantic search and similarity comparison. Use with `coreviz.similarity(embeddingA, embeddingB)` to compare two images or an image and a text.
111
+
112
+ **Parameters:**
113
+ - `input` (string): The text string or image (URL/base64) to embed.
114
+ - `options` (object, optional):
115
+ - `type` ('image' | 'text', optional): Explicitly define the input type.
116
+ - `mode` ('api' | 'local', optional): Execution mode (default: `'api'`). `'local'` runs in-browser/node using transformers.js.
117
+
118
+ **Returns:**
119
+ - `Promise<EmbedResponse>`: An object containing:
120
+ - `embedding` (number[]): The high-dimensional vector representation.
121
+
122
+ **Example:**
123
+
124
+ ```typescript
125
+ const { embedding } = await coreviz.embed('A photo of a sunset');
126
+ ```
127
+
128
+ ### `coreviz.similarity(embeddingA, embeddingB)`
129
+
130
+ Calculates the degree of similarity between two embeddings.
131
+
132
+ **Parameters:**
133
+ - `embeddingA` (number[]): The first image/text embedding.
134
+ - `embeddingB` (number[]): The second image/text embedding.
135
+
136
+ **Returns:**
137
+ - `number`: A similarity score between -1 and 1.
138
+
139
+ **Example:**
140
+
141
+ ```typescript
142
+ const similarity = coreviz.similarity(embeddingA, embeddingB);
143
+ ```
144
+
93
145
  ### `coreviz.resize(input, maxWidth?, maxHeight?)`
94
146
 
95
147
  Utility function to resize images client-side or server-side before processing. Also available as a standalone import.
@@ -107,8 +159,4 @@ Utility function to resize images client-side or server-side before processing.
107
159
  ```typescript
108
160
  const resized = await coreviz.resize(myFileObject, 800, 600);
109
161
  // or import { resize } from '@coreviz/sdk';
110
- ```
111
-
112
- ## License
113
-
114
- MIT
162
+ ```
package/dist/coreviz.js CHANGED
@@ -67,7 +67,7 @@ class CoreViz {
67
67
  }
68
68
  async describe(image, options) {
69
69
  try {
70
- const resizedImage = await (0, resize_1.resize)(image);
70
+ const resizedImage = await (0, resize_1.resize)(image, 512, 512);
71
71
  const headers = this.getHeaders();
72
72
  const response = await fetch(`https://lab.coreviz.io/api/ai/describe`, {
73
73
  method: 'POST',
@@ -83,7 +83,7 @@ class CoreViz {
83
83
  }
84
84
  async edit(image, options) {
85
85
  try {
86
- const resizedImage = await (0, resize_1.resize)(image);
86
+ const resizedImage = await (0, resize_1.resize)(image, 1024, 1024);
87
87
  const headers = this.getHeaders();
88
88
  const response = await fetch(`https://lab.coreviz.io/api/ai/edit`, {
89
89
  method: 'POST',
@@ -109,7 +109,7 @@ class CoreViz {
109
109
  return this.tagLocal(image, options);
110
110
  }
111
111
  try {
112
- const resizedImage = await (0, resize_1.resize)(image);
112
+ const resizedImage = await (0, resize_1.resize)(image, 512, 512);
113
113
  const headers = this.getHeaders();
114
114
  const response = await fetch("https://lab.coreviz.io/api/ai/tag", {
115
115
  method: 'POST',
@@ -259,7 +259,7 @@ Output:
259
259
  isImage = input.startsWith('data:image') || input.startsWith('http://') || input.startsWith('https://');
260
260
  }
261
261
  if (isImage) {
262
- const resizedImage = await (0, resize_1.resize)(input);
262
+ const resizedImage = await (0, resize_1.resize)(input, 512, 512);
263
263
  body.image = resizedImage;
264
264
  }
265
265
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreviz/sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "CoreViz SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",