@speakableio/core 1.0.61 → 1.0.63

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.
@@ -1690,7 +1690,7 @@ declare function SpeakableProvider({ user, children, queryClient, permissions, f
1690
1690
  }): react_jsx_runtime.JSX.Element | null;
1691
1691
  declare function useSpeakableApi(): FsContext;
1692
1692
 
1693
- declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper', args: {
1693
+ declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper' | 'whisper-3', args: {
1694
1694
  language: string;
1695
1695
  audioUrl: string;
1696
1696
  prompt?: string;
@@ -2967,7 +2967,7 @@ declare const useOrganizationAccess: () => {
2967
2967
 
2968
2968
  declare function useSpeakableTranscript(): {
2969
2969
  mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
2970
- model: "gemini" | "assemblyai" | "whisper";
2970
+ model: "gemini" | "assemblyai" | "whisper" | "whisper-3";
2971
2971
  audioUrl: string;
2972
2972
  language: string;
2973
2973
  prompt?: string;
@@ -1690,7 +1690,7 @@ declare function SpeakableProvider({ user, children, queryClient, permissions, f
1690
1690
  }): react_jsx_runtime.JSX.Element | null;
1691
1691
  declare function useSpeakableApi(): FsContext;
1692
1692
 
1693
- declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper', args: {
1693
+ declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper' | 'whisper-3', args: {
1694
1694
  language: string;
1695
1695
  audioUrl: string;
1696
1696
  prompt?: string;
@@ -2967,7 +2967,7 @@ declare const useOrganizationAccess: () => {
2967
2967
 
2968
2968
  declare function useSpeakableTranscript(): {
2969
2969
  mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
2970
- model: "gemini" | "assemblyai" | "whisper";
2970
+ model: "gemini" | "assemblyai" | "whisper" | "whisper-3";
2971
2971
  audioUrl: string;
2972
2972
  language: string;
2973
2973
  prompt?: string;
@@ -2430,19 +2430,33 @@ function cleanHallucinatedTranscript(transcript) {
2430
2430
 
2431
2431
  // src/utils/ai/get-transcript.ts
2432
2432
  async function getTranscript(model, args, cleanHallucinations = true) {
2433
- var _a, _b, _c, _d, _e, _f, _g;
2433
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2434
2434
  const getGeminiTranscript = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getGeminiTranscript");
2435
2435
  const getAssemblyAITranscript = (_d = (_c = api).httpsCallable) == null ? void 0 : _d.call(_c, "transcribeAssemblyAIAudio");
2436
- const getWhisperTranscript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "generateGroqTranscript");
2436
+ const getWhisper3Transcript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "generateGroqTranscript");
2437
+ const getWhisper1Transcript = (_h = (_g = api).httpsCallable) == null ? void 0 : _h.call(_g, "transcribeAudio");
2438
+ console.log("Getting transcript from", model);
2439
+ if (model === "whisper-3") {
2440
+ try {
2441
+ const { data } = await (getWhisper3Transcript == null ? void 0 : getWhisper3Transcript({
2442
+ audioUrl: args.audioUrl,
2443
+ language: args.language
2444
+ }));
2445
+ return cleanHallucinations ? cleanHallucinatedTranscript(data) : data;
2446
+ } catch (error) {
2447
+ console.error("Error getting transcript from Whisper-3:", error);
2448
+ throw error;
2449
+ }
2450
+ }
2437
2451
  if (model === "whisper") {
2438
2452
  try {
2439
- const { data } = await (getWhisperTranscript == null ? void 0 : getWhisperTranscript({
2453
+ const { data } = await (getWhisper1Transcript == null ? void 0 : getWhisper1Transcript({
2440
2454
  audioUrl: args.audioUrl,
2441
2455
  language: args.language
2442
2456
  }));
2443
2457
  return cleanHallucinations ? cleanHallucinatedTranscript(data) : data;
2444
2458
  } catch (error) {
2445
- console.error("Error getting transcript from Whisper:", error);
2459
+ console.error("Error getting transcript from Whisper-1:", error);
2446
2460
  throw error;
2447
2461
  }
2448
2462
  }
@@ -2451,7 +2465,7 @@ async function getTranscript(model, args, cleanHallucinations = true) {
2451
2465
  const { data } = await (getGeminiTranscript == null ? void 0 : getGeminiTranscript({
2452
2466
  audioUrl: args.audioUrl,
2453
2467
  targetLanguage: args.language,
2454
- prompt: (_g = args.prompt) != null ? _g : ""
2468
+ prompt: (_i = args.prompt) != null ? _i : ""
2455
2469
  }));
2456
2470
  return cleanHallucinations ? cleanHallucinatedTranscript(data.transcript) : data.transcript;
2457
2471
  } catch (error) {
@@ -2474,7 +2488,7 @@ async function getTranscript(model, args, cleanHallucinations = true) {
2474
2488
  return null;
2475
2489
  }
2476
2490
  async function getTranscriptCycle(args) {
2477
- const models = ["whisper", "gemini", "assemblyai"];
2491
+ const models = ["whisper-3", "whisper", "gemini", "assemblyai"];
2478
2492
  let transcript = "";
2479
2493
  let lastError = null;
2480
2494
  for (const model of models) {