@speakableio/core 1.0.46 → 1.0.49

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.
@@ -118,6 +118,7 @@ interface PageActivity {
118
118
  target_text?: string;
119
119
  type: ActivityPageType;
120
120
  grading_criteria?: string;
121
+ grading_criteria_title?: string;
121
122
  scoring_type?: string;
122
123
  grading_method?: 'simple' | 'rubric' | 'manual' | 'standards_based';
123
124
  feedback_types?: FeedbackTypesCard[];
@@ -172,7 +173,8 @@ declare const enum ActivityPageType {
172
173
  RESPOND_WRITE = "RESPOND_WRITE",
173
174
  MULTIPLE_CHOICE = "MULTIPLE_CHOICE",
174
175
  MEDIA_PAGE = "MEDIA_PAGE",
175
- SHORT_ANSWER = "SHORT_ANSWER"
176
+ SHORT_ANSWER = "SHORT_ANSWER",
177
+ CONVERSATION = "CONVERSATION"
176
178
  }
177
179
  declare const RESPOND_PAGE_ACTIVITY_TYPES: ActivityPageType[];
178
180
  declare const MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES: ActivityPageType[];
@@ -220,6 +222,7 @@ declare function useCards({ cardIds, enabled, asObject, }: {
220
222
  default_language?: string;
221
223
  target_text?: string;
222
224
  grading_criteria?: string;
225
+ grading_criteria_title?: string;
223
226
  scoring_type?: string;
224
227
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
225
228
  feedback_types?: FeedbackTypesCard[];
@@ -301,6 +304,7 @@ declare function useCreateCards(): {
301
304
  target_text?: string;
302
305
  type: ActivityPageType;
303
306
  grading_criteria?: string;
307
+ grading_criteria_title?: string;
304
308
  scoring_type?: string;
305
309
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
306
310
  feedback_types?: FeedbackTypesCard[];
@@ -388,6 +392,7 @@ declare function useGetCard({ cardId, enabled }: {
388
392
  default_language?: string;
389
393
  target_text?: string;
390
394
  grading_criteria?: string;
395
+ grading_criteria_title?: string;
391
396
  scoring_type?: string;
392
397
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
393
398
  feedback_types?: FeedbackTypesCard[];
@@ -469,6 +474,7 @@ declare const createCardRepo: () => {
469
474
  target_text?: string;
470
475
  type: ActivityPageType;
471
476
  grading_criteria?: string;
477
+ grading_criteria_title?: string;
472
478
  scoring_type?: string;
473
479
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
474
480
  feedback_types?: FeedbackTypesCard[];
@@ -543,6 +549,7 @@ declare const createCardRepo: () => {
543
549
  default_language?: string;
544
550
  target_text?: string;
545
551
  grading_criteria?: string;
552
+ grading_criteria_title?: string;
546
553
  scoring_type?: string;
547
554
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
548
555
  feedback_types?: FeedbackTypesCard[];
@@ -597,6 +604,7 @@ declare function checkIsRespondWrittenPage(cardType: ActivityPageType | undefine
597
604
  declare function checkIsRespondAudioPage(cardType: ActivityPageType | undefined): boolean;
598
605
  declare const checkIsMediaPage: (cardType: ActivityPageType | undefined) => boolean;
599
606
  declare const checkIsShortAnswerPage: (cardType: ActivityPageType | undefined) => boolean;
607
+ declare const checkIsConversationPage: (cardType: ActivityPageType | undefined) => boolean;
600
608
  declare const checkTypePageActivity: (cardType: ActivityPageType | undefined) => {
601
609
  isRespondAudio: boolean;
602
610
  isRespondWritten: boolean;
@@ -606,6 +614,7 @@ declare const checkTypePageActivity: (cardType: ActivityPageType | undefined) =>
606
614
  isMediaPage: boolean;
607
615
  isShortAnswer: boolean;
608
616
  hasSomeType: boolean;
617
+ isConversation: boolean;
609
618
  };
610
619
 
611
620
  declare function getPagePrompt(card: PageActivityWithId | undefined): {
@@ -1400,6 +1409,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1400
1409
  target_text?: string;
1401
1410
  type: ActivityPageType;
1402
1411
  grading_criteria?: string;
1412
+ grading_criteria_title?: string;
1403
1413
  scoring_type?: string;
1404
1414
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1405
1415
  feedback_types?: FeedbackTypesCard[];
@@ -1474,6 +1484,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1474
1484
  default_language?: string;
1475
1485
  target_text?: string;
1476
1486
  grading_criteria?: string;
1487
+ grading_criteria_title?: string;
1477
1488
  scoring_type?: string;
1478
1489
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1479
1490
  feedback_types?: FeedbackTypesCard[];
@@ -1732,6 +1743,7 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1732
1743
  default_language?: string;
1733
1744
  target_text?: string;
1734
1745
  grading_criteria?: string;
1746
+ grading_criteria_title?: string;
1735
1747
  scoring_type?: string;
1736
1748
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1737
1749
  feedback_types?: FeedbackTypesCard[];
@@ -3279,6 +3291,7 @@ declare const createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
3279
3291
  target_text?: string;
3280
3292
  type: ActivityPageType;
3281
3293
  grading_criteria?: string;
3294
+ grading_criteria_title?: string;
3282
3295
  scoring_type?: string;
3283
3296
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
3284
3297
  feedback_types?: FeedbackTypesCard[];
@@ -3353,6 +3366,7 @@ declare const createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
3353
3366
  default_language?: string;
3354
3367
  target_text?: string;
3355
3368
  grading_criteria?: string;
3369
+ grading_criteria_title?: string;
3356
3370
  scoring_type?: string;
3357
3371
  grading_method?: "simple" | "rubric" | "manual" | "standards_based";
3358
3372
  feedback_types?: FeedbackTypesCard[];
@@ -3401,4 +3415,4 @@ declare const createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
3401
3415
  };
3402
3416
  };
3403
3417
 
3404
- export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, 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_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientWeb 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 };
3418
+ export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, 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_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, createFsClientWeb 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.web.js CHANGED
@@ -1604,6 +1604,7 @@ var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
1604
1604
  ActivityPageType2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
1605
1605
  ActivityPageType2["MEDIA_PAGE"] = "MEDIA_PAGE";
1606
1606
  ActivityPageType2["SHORT_ANSWER"] = "SHORT_ANSWER";
1607
+ ActivityPageType2["CONVERSATION"] = "CONVERSATION";
1607
1608
  return ActivityPageType2;
1608
1609
  })(ActivityPageType || {});
1609
1610
  var RESPOND_PAGE_ACTIVITY_TYPES = [
@@ -1951,6 +1952,10 @@ var checkIsShortAnswerPage = (cardType) => {
1951
1952
  if (cardType === void 0) return false;
1952
1953
  return cardType === "SHORT_ANSWER" /* SHORT_ANSWER */;
1953
1954
  };
1955
+ var checkIsConversationPage = (cardType) => {
1956
+ if (cardType === void 0) return false;
1957
+ return cardType === "CONVERSATION" /* CONVERSATION */;
1958
+ };
1954
1959
  var checkTypePageActivity = (cardType) => {
1955
1960
  const isRespondAudio = checkIsRespondAudioPage(cardType);
1956
1961
  const isRespondWritten = checkIsRespondWrittenPage(cardType);
@@ -1959,7 +1964,8 @@ var checkTypePageActivity = (cardType) => {
1959
1964
  const isRepeat = checkIsRepeatPage(cardType);
1960
1965
  const isMediaPage = checkIsMediaPage(cardType);
1961
1966
  const isShortAnswer = checkIsShortAnswerPage(cardType);
1962
- const isNoOneOfThem = !isRespond && !isMC && !isRepeat && !isMediaPage && !isShortAnswer;
1967
+ const isConversation = checkIsConversationPage(cardType);
1968
+ const isNoOneOfThem = !isRespond && !isMC && !isRepeat && !isMediaPage && !isShortAnswer && !isConversation;
1963
1969
  if (isNoOneOfThem) {
1964
1970
  return {
1965
1971
  isRespondAudio: false,
@@ -1969,7 +1975,8 @@ var checkTypePageActivity = (cardType) => {
1969
1975
  isRepeat: true,
1970
1976
  isMediaPage: false,
1971
1977
  isShortAnswer: false,
1972
- hasSomeType: false
1978
+ hasSomeType: false,
1979
+ isConversation: false
1973
1980
  };
1974
1981
  }
1975
1982
  return {
@@ -1980,7 +1987,8 @@ var checkTypePageActivity = (cardType) => {
1980
1987
  isRepeat,
1981
1988
  isMediaPage,
1982
1989
  isShortAnswer,
1983
- hasSomeType: true
1990
+ hasSomeType: true,
1991
+ isConversation
1984
1992
  };
1985
1993
  };
1986
1994
 
@@ -2180,24 +2188,34 @@ var createSetRepo = () => {
2180
2188
  // src/utils/ai/detect-transcript-hallucionation.ts
2181
2189
  var HALLUCINATION_THRESHOLDS = {
2182
2190
  // Short repeats
2183
- MIN_CONSECUTIVE_REPEATS: 3,
2184
- MIN_WORDS_FOR_RATIO_CHECK: 10,
2191
+ MIN_CONSECUTIVE_REPEATS: 5,
2192
+ // Increased from 3 to allow phrases like "pio pio pio" or "no no no no"
2193
+ MIN_WORDS_FOR_RATIO_CHECK: 15,
2194
+ // Increased from 10 to require longer text for ratio check
2185
2195
  MAX_UNIQUE_WORDS_FOR_RATIO: 3,
2186
- MIN_REPETITION_RATIO: 3,
2196
+ MIN_REPETITION_RATIO: 4,
2197
+ // Increased from 3 to be more permissive
2187
2198
  // Phrase repeats
2188
- MIN_SENTENCE_LENGTH: 10,
2189
- MIN_CONSECUTIVE_SIMILAR_SENTENCES: 2,
2190
- MIN_SENTENCES_FOR_DUPLICATE_CHECK: 3,
2199
+ MIN_SENTENCE_LENGTH: 15,
2200
+ // Increased from 10 to avoid flagging short natural sentences
2201
+ MIN_CONSECUTIVE_SIMILAR_SENTENCES: 3,
2202
+ // Increased from 2 to allow some natural repetition
2203
+ MIN_SENTENCES_FOR_DUPLICATE_CHECK: 4,
2204
+ // Increased from 3
2191
2205
  // Cyclic patterns
2192
- MIN_CYCLE_LENGTH: 20,
2206
+ MIN_CYCLE_LENGTH: 30,
2207
+ // Increased from 20 to focus on longer patterns
2193
2208
  MIN_CYCLE_REPEATS: 3,
2194
2209
  // Entropy detection
2195
- MIN_LENGTH_FOR_ENTROPY_CHECK: 50,
2196
- MAX_ENTROPY_THRESHOLD: 2.5,
2197
- // bits per character
2210
+ MIN_LENGTH_FOR_ENTROPY_CHECK: 60,
2211
+ // Increased from 50
2212
+ MAX_ENTROPY_THRESHOLD: 2.2,
2213
+ // Decreased from 2.5 to be more strict on entropy (lower = more repetitive needed)
2198
2214
  // Similarity
2199
- SENTENCE_SIMILARITY_THRESHOLD: 0.8,
2200
- SEGMENT_SIMILARITY_THRESHOLD: 0.85
2215
+ SENTENCE_SIMILARITY_THRESHOLD: 0.85,
2216
+ // Increased from 0.8 to require more similarity
2217
+ SEGMENT_SIMILARITY_THRESHOLD: 0.9
2218
+ // Increased from 0.85
2201
2219
  };
2202
2220
  function detectTranscriptHallucinationWithDetails(transcript) {
2203
2221
  if (!transcript || transcript.trim().length === 0) {
@@ -3773,6 +3791,7 @@ export {
3773
3791
  VerificationCardStatus,
3774
3792
  assignmentQueryKeys,
3775
3793
  cardsQueryKeys,
3794
+ checkIsConversationPage,
3776
3795
  checkIsMCPage,
3777
3796
  checkIsMediaPage,
3778
3797
  checkIsRepeatPage,