@speakableio/core 1.0.65 → 1.0.66
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.native.d.mts +10 -3
- package/dist/index.native.d.ts +10 -3
- package/dist/index.native.js +31 -7
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +31 -7
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.web.d.mts +10 -3
- package/dist/index.web.js +31 -7
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.native.d.mts
CHANGED
|
@@ -1690,7 +1690,8 @@ 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
|
-
|
|
1693
|
+
type TranscriptModel = 'gemini' | 'assemblyai' | 'whisper' | 'whisper-3' | 'gpt-4o';
|
|
1694
|
+
declare function getTranscript(model: TranscriptModel, args: {
|
|
1694
1695
|
language: string;
|
|
1695
1696
|
audioUrl: string;
|
|
1696
1697
|
prompt?: string;
|
|
@@ -1700,6 +1701,9 @@ declare function getTranscriptCycle(args: {
|
|
|
1700
1701
|
language: string;
|
|
1701
1702
|
prompt?: string;
|
|
1702
1703
|
cleanHallucinations?: boolean;
|
|
1704
|
+
options?: {
|
|
1705
|
+
modelOrder?: TranscriptModel[];
|
|
1706
|
+
};
|
|
1703
1707
|
}): Promise<{
|
|
1704
1708
|
transcript: string;
|
|
1705
1709
|
success: boolean;
|
|
@@ -2968,7 +2972,7 @@ declare const useOrganizationAccess: () => {
|
|
|
2968
2972
|
|
|
2969
2973
|
declare function useSpeakableTranscript(): {
|
|
2970
2974
|
mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
|
|
2971
|
-
model:
|
|
2975
|
+
model: TranscriptModel;
|
|
2972
2976
|
audioUrl: string;
|
|
2973
2977
|
language: string;
|
|
2974
2978
|
prompt?: string;
|
|
@@ -2984,6 +2988,9 @@ declare function useSpeakableTranscriptCycle(): {
|
|
|
2984
2988
|
language: string;
|
|
2985
2989
|
prompt: string;
|
|
2986
2990
|
cleanHallucinations?: boolean;
|
|
2991
|
+
options?: {
|
|
2992
|
+
modelOrder?: TranscriptModel[];
|
|
2993
|
+
};
|
|
2987
2994
|
}, unknown>;
|
|
2988
2995
|
};
|
|
2989
2996
|
|
|
@@ -3566,4 +3573,4 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
3566
3573
|
};
|
|
3567
3574
|
};
|
|
3568
3575
|
|
|
3569
|
-
export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, CONVERSATION_PAGE_ACTIVITY_TYPES, ConversationPageMode, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type MediaPageActivity, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, REPEAT_PAGE_ACTIVITY_TYPES, RESPOND_AUDIO_PAGE_ACTIVITY_TYPES, RESPOND_PAGE_ACTIVITY_TYPES, RESPOND_WRITE_PAGE_ACTIVITY_TYPES, type RefsCardsFiresotre, type RefsSetsFirestore, SPEAKABLE_ANALYTICS, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, checkIsConversationPage, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPageMediaData, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getSingleMediaPageData, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
|
|
3576
|
+
export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, CONVERSATION_PAGE_ACTIVITY_TYPES, ConversationPageMode, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type MediaPageActivity, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, REPEAT_PAGE_ACTIVITY_TYPES, RESPOND_AUDIO_PAGE_ACTIVITY_TYPES, RESPOND_PAGE_ACTIVITY_TYPES, RESPOND_WRITE_PAGE_ACTIVITY_TYPES, type RefsCardsFiresotre, type RefsSetsFirestore, SPEAKABLE_ANALYTICS, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, type TranscriptModel, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, checkIsConversationPage, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPageMediaData, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getSingleMediaPageData, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
|
package/dist/index.native.d.ts
CHANGED
|
@@ -1690,7 +1690,8 @@ 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
|
-
|
|
1693
|
+
type TranscriptModel = 'gemini' | 'assemblyai' | 'whisper' | 'whisper-3' | 'gpt-4o';
|
|
1694
|
+
declare function getTranscript(model: TranscriptModel, args: {
|
|
1694
1695
|
language: string;
|
|
1695
1696
|
audioUrl: string;
|
|
1696
1697
|
prompt?: string;
|
|
@@ -1700,6 +1701,9 @@ declare function getTranscriptCycle(args: {
|
|
|
1700
1701
|
language: string;
|
|
1701
1702
|
prompt?: string;
|
|
1702
1703
|
cleanHallucinations?: boolean;
|
|
1704
|
+
options?: {
|
|
1705
|
+
modelOrder?: TranscriptModel[];
|
|
1706
|
+
};
|
|
1703
1707
|
}): Promise<{
|
|
1704
1708
|
transcript: string;
|
|
1705
1709
|
success: boolean;
|
|
@@ -2968,7 +2972,7 @@ declare const useOrganizationAccess: () => {
|
|
|
2968
2972
|
|
|
2969
2973
|
declare function useSpeakableTranscript(): {
|
|
2970
2974
|
mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
|
|
2971
|
-
model:
|
|
2975
|
+
model: TranscriptModel;
|
|
2972
2976
|
audioUrl: string;
|
|
2973
2977
|
language: string;
|
|
2974
2978
|
prompt?: string;
|
|
@@ -2984,6 +2988,9 @@ declare function useSpeakableTranscriptCycle(): {
|
|
|
2984
2988
|
language: string;
|
|
2985
2989
|
prompt: string;
|
|
2986
2990
|
cleanHallucinations?: boolean;
|
|
2991
|
+
options?: {
|
|
2992
|
+
modelOrder?: TranscriptModel[];
|
|
2993
|
+
};
|
|
2987
2994
|
}, unknown>;
|
|
2988
2995
|
};
|
|
2989
2996
|
|
|
@@ -3566,4 +3573,4 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
3566
3573
|
};
|
|
3567
3574
|
};
|
|
3568
3575
|
|
|
3569
|
-
export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, CONVERSATION_PAGE_ACTIVITY_TYPES, ConversationPageMode, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type MediaPageActivity, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, REPEAT_PAGE_ACTIVITY_TYPES, RESPOND_AUDIO_PAGE_ACTIVITY_TYPES, RESPOND_PAGE_ACTIVITY_TYPES, RESPOND_WRITE_PAGE_ACTIVITY_TYPES, type RefsCardsFiresotre, type RefsSetsFirestore, SPEAKABLE_ANALYTICS, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, checkIsConversationPage, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPageMediaData, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getSingleMediaPageData, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
|
|
3576
|
+
export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, CONVERSATION_PAGE_ACTIVITY_TYPES, ConversationPageMode, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type MediaPageActivity, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, REPEAT_PAGE_ACTIVITY_TYPES, RESPOND_AUDIO_PAGE_ACTIVITY_TYPES, RESPOND_PAGE_ACTIVITY_TYPES, RESPOND_WRITE_PAGE_ACTIVITY_TYPES, type RefsCardsFiresotre, type RefsSetsFirestore, SPEAKABLE_ANALYTICS, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, type TranscriptModel, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, checkIsConversationPage, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPageMediaData, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getSingleMediaPageData, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
|
package/dist/index.native.js
CHANGED
|
@@ -2434,12 +2434,26 @@ function cleanHallucinatedTranscript(transcript) {
|
|
|
2434
2434
|
|
|
2435
2435
|
// src/utils/ai/get-transcript.ts
|
|
2436
2436
|
async function getTranscript(model, args, cleanHallucinations = true) {
|
|
2437
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2437
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2438
2438
|
const getGeminiTranscript = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getGeminiTranscript");
|
|
2439
2439
|
const getAssemblyAITranscript = (_d = (_c = api).httpsCallable) == null ? void 0 : _d.call(_c, "transcribeAssemblyAIAudio");
|
|
2440
2440
|
const getWhisper3Transcript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "generateGroqTranscript");
|
|
2441
2441
|
const getWhisper1Transcript = (_h = (_g = api).httpsCallable) == null ? void 0 : _h.call(_g, "transcribeAudio");
|
|
2442
|
+
const getGPT4oTranscript = (_j = (_i = api).httpsCallable) == null ? void 0 : _j.call(_i, "generateGpt4oTranscript");
|
|
2442
2443
|
console.log("Getting transcript from", model, " cleanHallucinations", cleanHallucinations);
|
|
2444
|
+
if (model === "gpt-4o") {
|
|
2445
|
+
try {
|
|
2446
|
+
const { data } = await (getGPT4oTranscript == null ? void 0 : getGPT4oTranscript({
|
|
2447
|
+
audioUrl: args.audioUrl,
|
|
2448
|
+
language: args.language,
|
|
2449
|
+
teacherPrompt: (_k = args.prompt) != null ? _k : ""
|
|
2450
|
+
}));
|
|
2451
|
+
return data;
|
|
2452
|
+
} catch (error) {
|
|
2453
|
+
console.error("Error getting transcript from GPT-4o:", error);
|
|
2454
|
+
throw error;
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2443
2457
|
if (model === "whisper-3") {
|
|
2444
2458
|
try {
|
|
2445
2459
|
const { data } = await (getWhisper3Transcript == null ? void 0 : getWhisper3Transcript({
|
|
@@ -2469,7 +2483,7 @@ async function getTranscript(model, args, cleanHallucinations = true) {
|
|
|
2469
2483
|
const { data } = await (getGeminiTranscript == null ? void 0 : getGeminiTranscript({
|
|
2470
2484
|
audioUrl: args.audioUrl,
|
|
2471
2485
|
targetLanguage: args.language,
|
|
2472
|
-
prompt: (
|
|
2486
|
+
prompt: (_l = args.prompt) != null ? _l : ""
|
|
2473
2487
|
}));
|
|
2474
2488
|
return cleanHallucinations ? cleanHallucinatedTranscript(data.transcript) : data.transcript;
|
|
2475
2489
|
} catch (error) {
|
|
@@ -2492,8 +2506,14 @@ async function getTranscript(model, args, cleanHallucinations = true) {
|
|
|
2492
2506
|
return null;
|
|
2493
2507
|
}
|
|
2494
2508
|
async function getTranscriptCycle(args) {
|
|
2495
|
-
var _a;
|
|
2496
|
-
const models =
|
|
2509
|
+
var _a, _b, _c;
|
|
2510
|
+
const models = (_b = (_a = args.options) == null ? void 0 : _a.modelOrder) != null ? _b : [
|
|
2511
|
+
"gpt-4o",
|
|
2512
|
+
"whisper",
|
|
2513
|
+
"whisper-3",
|
|
2514
|
+
"gemini",
|
|
2515
|
+
"assemblyai"
|
|
2516
|
+
];
|
|
2497
2517
|
let transcript = "";
|
|
2498
2518
|
let lastError = null;
|
|
2499
2519
|
for (const model of models) {
|
|
@@ -2504,9 +2524,9 @@ async function getTranscriptCycle(args) {
|
|
|
2504
2524
|
" cleanHallucinations",
|
|
2505
2525
|
args.cleanHallucinations
|
|
2506
2526
|
);
|
|
2507
|
-
const transcriptResult = await getTranscript(model, args, (
|
|
2527
|
+
const transcriptResult = await getTranscript(model, args, (_c = args.cleanHallucinations) != null ? _c : true);
|
|
2508
2528
|
const rawTranscript = transcriptResult || "";
|
|
2509
|
-
transcript =
|
|
2529
|
+
transcript = rawTranscript;
|
|
2510
2530
|
if (transcript !== "") {
|
|
2511
2531
|
console.log(`Successfully got transcript from ${model}`);
|
|
2512
2532
|
break;
|
|
@@ -3277,7 +3297,11 @@ function useSpeakableTranscript() {
|
|
|
3277
3297
|
function useSpeakableTranscriptCycle() {
|
|
3278
3298
|
const mutation = (0, import_react_query7.useMutation)({
|
|
3279
3299
|
mutationFn: async (args) => {
|
|
3280
|
-
return getTranscriptCycle({
|
|
3300
|
+
return getTranscriptCycle({
|
|
3301
|
+
...args,
|
|
3302
|
+
cleanHallucinations: args.cleanHallucinations,
|
|
3303
|
+
options: args.options
|
|
3304
|
+
});
|
|
3281
3305
|
},
|
|
3282
3306
|
retry: false
|
|
3283
3307
|
});
|