@omnikit-ai/sdk 2.0.8 → 2.0.10
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/dist/index.d.mts +15 -9
- package/dist/index.d.ts +15 -9
- package/dist/index.js +98 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -229,12 +229,12 @@ interface LLMMessage {
|
|
|
229
229
|
}>;
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Available LLM models
|
|
233
|
-
* - 'gemini-flash'
|
|
234
|
-
* - 'gemini-
|
|
235
|
-
* - 'gemini-pro-3'
|
|
232
|
+
* Available LLM models:
|
|
233
|
+
* - Gemini 2.5: 'gemini-2.5-flash-lite' (fastest), 'gemini-2.5-flash', 'gemini-2.5-pro'
|
|
234
|
+
* - Gemini 3: 'gemini-3-flash' (best multimodal), 'gemini-3-pro' (advanced reasoning)
|
|
235
|
+
* - Legacy aliases: 'gemini-flash', 'gemini-pro', 'gemini-pro-3' (for backward compatibility)
|
|
236
236
|
*/
|
|
237
|
-
type LLMModel = 'gemini-flash' | 'gemini-pro' | 'gemini-pro-3';
|
|
237
|
+
type LLMModel = 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-2.5-pro' | 'gemini-3-flash' | 'gemini-3-pro' | 'gemini-flash' | 'gemini-pro' | 'gemini-pro-3';
|
|
238
238
|
interface LLMParams {
|
|
239
239
|
/** Message-based format for advanced use */
|
|
240
240
|
messages?: LLMMessage[];
|
|
@@ -254,10 +254,11 @@ interface LLMParams {
|
|
|
254
254
|
type: 'json_object';
|
|
255
255
|
} | Record<string, any>;
|
|
256
256
|
/**
|
|
257
|
-
* Model to use for LLM processing
|
|
258
|
-
*
|
|
259
|
-
* - 'gemini-
|
|
260
|
-
* - 'gemini-
|
|
257
|
+
* Model to use for LLM processing.
|
|
258
|
+
* Defaults: 'gemini-2.5-flash-lite' for text, 'gemini-3-flash' for files/images.
|
|
259
|
+
* - 'gemini-2.5-flash-lite': Fastest, best for simple text tasks
|
|
260
|
+
* - 'gemini-3-flash': Best multimodal (images, PDFs, videos)
|
|
261
|
+
* - 'gemini-2.5-pro' / 'gemini-3-pro': Advanced reasoning
|
|
261
262
|
*/
|
|
262
263
|
model?: LLMModel | string;
|
|
263
264
|
/**
|
|
@@ -1186,6 +1187,11 @@ declare class APIClient implements OmnikitClient {
|
|
|
1186
1187
|
private _metadataListeners;
|
|
1187
1188
|
private _userListeners;
|
|
1188
1189
|
constructor(config: OmnikitConfig);
|
|
1190
|
+
/**
|
|
1191
|
+
* Initialize built-in services with their definitions
|
|
1192
|
+
* These services don't require backend schema - they're defined in the SDK
|
|
1193
|
+
*/
|
|
1194
|
+
private initializeBuiltInServices;
|
|
1189
1195
|
/**
|
|
1190
1196
|
* Load metadata from localStorage cache, falling back to initial config
|
|
1191
1197
|
* Guards localStorage access for Deno/Node compatibility
|
package/dist/index.d.ts
CHANGED
|
@@ -229,12 +229,12 @@ interface LLMMessage {
|
|
|
229
229
|
}>;
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Available LLM models
|
|
233
|
-
* - 'gemini-flash'
|
|
234
|
-
* - 'gemini-
|
|
235
|
-
* - 'gemini-pro-3'
|
|
232
|
+
* Available LLM models:
|
|
233
|
+
* - Gemini 2.5: 'gemini-2.5-flash-lite' (fastest), 'gemini-2.5-flash', 'gemini-2.5-pro'
|
|
234
|
+
* - Gemini 3: 'gemini-3-flash' (best multimodal), 'gemini-3-pro' (advanced reasoning)
|
|
235
|
+
* - Legacy aliases: 'gemini-flash', 'gemini-pro', 'gemini-pro-3' (for backward compatibility)
|
|
236
236
|
*/
|
|
237
|
-
type LLMModel = 'gemini-flash' | 'gemini-pro' | 'gemini-pro-3';
|
|
237
|
+
type LLMModel = 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-2.5-pro' | 'gemini-3-flash' | 'gemini-3-pro' | 'gemini-flash' | 'gemini-pro' | 'gemini-pro-3';
|
|
238
238
|
interface LLMParams {
|
|
239
239
|
/** Message-based format for advanced use */
|
|
240
240
|
messages?: LLMMessage[];
|
|
@@ -254,10 +254,11 @@ interface LLMParams {
|
|
|
254
254
|
type: 'json_object';
|
|
255
255
|
} | Record<string, any>;
|
|
256
256
|
/**
|
|
257
|
-
* Model to use for LLM processing
|
|
258
|
-
*
|
|
259
|
-
* - 'gemini-
|
|
260
|
-
* - 'gemini-
|
|
257
|
+
* Model to use for LLM processing.
|
|
258
|
+
* Defaults: 'gemini-2.5-flash-lite' for text, 'gemini-3-flash' for files/images.
|
|
259
|
+
* - 'gemini-2.5-flash-lite': Fastest, best for simple text tasks
|
|
260
|
+
* - 'gemini-3-flash': Best multimodal (images, PDFs, videos)
|
|
261
|
+
* - 'gemini-2.5-pro' / 'gemini-3-pro': Advanced reasoning
|
|
261
262
|
*/
|
|
262
263
|
model?: LLMModel | string;
|
|
263
264
|
/**
|
|
@@ -1186,6 +1187,11 @@ declare class APIClient implements OmnikitClient {
|
|
|
1186
1187
|
private _metadataListeners;
|
|
1187
1188
|
private _userListeners;
|
|
1188
1189
|
constructor(config: OmnikitConfig);
|
|
1190
|
+
/**
|
|
1191
|
+
* Initialize built-in services with their definitions
|
|
1192
|
+
* These services don't require backend schema - they're defined in the SDK
|
|
1193
|
+
*/
|
|
1194
|
+
private initializeBuiltInServices;
|
|
1189
1195
|
/**
|
|
1190
1196
|
* Load metadata from localStorage cache, falling back to initial config
|
|
1191
1197
|
* Guards localStorage access for Deno/Node compatibility
|
package/dist/index.js
CHANGED
|
@@ -437,6 +437,14 @@ var LiveVoiceSessionImpl = class {
|
|
|
437
437
|
|
|
438
438
|
// src/client.ts
|
|
439
439
|
var LLM_MODEL_MAP = {
|
|
440
|
+
// Gemini 2.5 models
|
|
441
|
+
"gemini-2.5-flash-lite": "vertex_ai/gemini-2.5-flash-lite",
|
|
442
|
+
"gemini-2.5-flash": "vertex_ai/gemini-2.5-flash",
|
|
443
|
+
"gemini-2.5-pro": "vertex_ai/gemini-2.5-pro",
|
|
444
|
+
// Gemini 3 models
|
|
445
|
+
"gemini-3-flash": "vertex_ai/gemini-3-flash-preview",
|
|
446
|
+
"gemini-3-pro": "vertex_ai/gemini-3-pro-preview",
|
|
447
|
+
// Legacy aliases (for backward compatibility)
|
|
440
448
|
"gemini-flash": "vertex_ai/gemini-2.5-flash",
|
|
441
449
|
"gemini-pro": "vertex_ai/gemini-2.5-pro",
|
|
442
450
|
"gemini-pro-3": "vertex_ai/gemini-3-pro-preview"
|
|
@@ -521,10 +529,96 @@ var APIClient = class {
|
|
|
521
529
|
this.userToken = detectedToken;
|
|
522
530
|
}
|
|
523
531
|
}
|
|
532
|
+
this.initializeBuiltInServices();
|
|
524
533
|
this.ensureInitialized().catch((err) => {
|
|
525
534
|
console.warn("[Omnikit SDK] Background initialization failed:", err);
|
|
526
535
|
});
|
|
527
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Initialize built-in services with their definitions
|
|
539
|
+
* These services don't require backend schema - they're defined in the SDK
|
|
540
|
+
*/
|
|
541
|
+
initializeBuiltInServices() {
|
|
542
|
+
const builtInServices = [
|
|
543
|
+
{
|
|
544
|
+
name: "SendEmail",
|
|
545
|
+
path: "/services/email",
|
|
546
|
+
description: "Send an email",
|
|
547
|
+
method: "POST",
|
|
548
|
+
params: { to: "string", subject: "string", body: "string" }
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "InvokeLLM",
|
|
552
|
+
path: "/services/llm",
|
|
553
|
+
description: "Invoke a language model",
|
|
554
|
+
method: "POST",
|
|
555
|
+
params: { messages: "array", model: "string" }
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
name: "GenerateImage",
|
|
559
|
+
path: "/services/images",
|
|
560
|
+
description: "Generate an image from a prompt",
|
|
561
|
+
method: "POST",
|
|
562
|
+
async: true,
|
|
563
|
+
params: { prompt: "string" }
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: "GenerateSpeech",
|
|
567
|
+
path: "/services/speech",
|
|
568
|
+
description: "Generate speech from text",
|
|
569
|
+
method: "POST",
|
|
570
|
+
async: true,
|
|
571
|
+
params: { text: "string" }
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: "GenerateVideo",
|
|
575
|
+
path: "/services/video",
|
|
576
|
+
description: "Generate a video from a prompt",
|
|
577
|
+
method: "POST",
|
|
578
|
+
async: true,
|
|
579
|
+
params: { prompt: "string" }
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "ExtractData",
|
|
583
|
+
path: "/services/extract-text",
|
|
584
|
+
description: "Extract structured data from text or files",
|
|
585
|
+
method: "POST",
|
|
586
|
+
async: true,
|
|
587
|
+
params: { file_url: "string" }
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: "SendSMS",
|
|
591
|
+
path: "/services/sms",
|
|
592
|
+
description: "Send an SMS message",
|
|
593
|
+
method: "POST",
|
|
594
|
+
params: { to: "string", body: "string" }
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
name: "UploadFile",
|
|
598
|
+
path: "/services/files",
|
|
599
|
+
description: "Upload a file (public)",
|
|
600
|
+
method: "POST",
|
|
601
|
+
params: { file: "File" }
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: "UploadPrivateFile",
|
|
605
|
+
path: "/services/files/private",
|
|
606
|
+
description: "Upload a private file",
|
|
607
|
+
method: "POST",
|
|
608
|
+
params: { file: "File" }
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: "CreateFileSignedUrl",
|
|
612
|
+
path: "/services/files/signed-url",
|
|
613
|
+
description: "Create a signed URL for a private file",
|
|
614
|
+
method: "POST",
|
|
615
|
+
params: { file_uri: "string" }
|
|
616
|
+
}
|
|
617
|
+
];
|
|
618
|
+
builtInServices.forEach((service) => {
|
|
619
|
+
this._services[service.name] = this.createServiceMethod(service);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
528
622
|
/**
|
|
529
623
|
* Load metadata from localStorage cache, falling back to initial config
|
|
530
624
|
* Guards localStorage access for Deno/Node compatibility
|
|
@@ -1183,51 +1277,11 @@ Example: await ${collectionName}.list({ limit: 100, sort: '-created_at' })`,
|
|
|
1183
1277
|
if (method) {
|
|
1184
1278
|
response = await method(params, useServiceToken);
|
|
1185
1279
|
} else {
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
"
|
|
1190
|
-
"GenerateSpeech": "services/speech",
|
|
1191
|
-
"GenerateVideo": "services/video",
|
|
1192
|
-
"ExtractData": "services/extract-text",
|
|
1193
|
-
"SendSMS": "services/sms",
|
|
1194
|
-
"UploadFile": "services/files",
|
|
1195
|
-
"UploadPrivateFile": "services/files/private/init",
|
|
1196
|
-
"CreateFileSignedUrl": "services/files/signed-url"
|
|
1197
|
-
};
|
|
1198
|
-
const servicePath = servicePathMap[normalizedName];
|
|
1199
|
-
if (!servicePath) {
|
|
1200
|
-
throw new OmnikitError(
|
|
1201
|
-
`Service '${serviceName}' not found. Known services: ${Object.keys(servicePathMap).join(", ")} (camelCase also supported)`,
|
|
1202
|
-
404,
|
|
1203
|
-
"SERVICE_NOT_FOUND"
|
|
1204
|
-
);
|
|
1205
|
-
}
|
|
1206
|
-
const headers = {
|
|
1207
|
-
"Content-Type": "application/json"
|
|
1208
|
-
};
|
|
1209
|
-
if (client._apiKey) {
|
|
1210
|
-
headers["X-API-Key"] = client._apiKey;
|
|
1211
|
-
} else if (client.userToken) {
|
|
1212
|
-
headers["Authorization"] = `Bearer ${client.userToken}`;
|
|
1213
|
-
}
|
|
1214
|
-
const fetchResponse = await fetch(
|
|
1215
|
-
`${client.baseUrl}/apps/${client.appId}/${servicePath}`,
|
|
1216
|
-
{
|
|
1217
|
-
method: "POST",
|
|
1218
|
-
headers,
|
|
1219
|
-
body: JSON.stringify(params || {})
|
|
1220
|
-
}
|
|
1280
|
+
throw new OmnikitError(
|
|
1281
|
+
`Service '${serviceName}' not found. Known services: SendEmail, InvokeLLM, GenerateImage, GenerateSpeech, GenerateVideo, ExtractData, SendSMS, UploadFile, UploadPrivateFile, CreateFileSignedUrl (camelCase also supported)`,
|
|
1282
|
+
404,
|
|
1283
|
+
"SERVICE_NOT_FOUND"
|
|
1221
1284
|
);
|
|
1222
|
-
if (!fetchResponse.ok) {
|
|
1223
|
-
const error = await fetchResponse.json().catch(() => ({}));
|
|
1224
|
-
throw new OmnikitError(
|
|
1225
|
-
error.detail || `Service call failed: ${fetchResponse.statusText}`,
|
|
1226
|
-
fetchResponse.status,
|
|
1227
|
-
"SERVICE_CALL_FAILED"
|
|
1228
|
-
);
|
|
1229
|
-
}
|
|
1230
|
-
response = await fetchResponse.json();
|
|
1231
1285
|
}
|
|
1232
1286
|
if (response && response.async && response.job_id) {
|
|
1233
1287
|
if (asyncOptions?.returnJobId) {
|