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