@thanh01.pmt/curriculum-kit 1.0.8 → 1.0.9

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.
@@ -2,8 +2,8 @@ import { M as ModelResolutionOptions } from '../provider-factory-DH3udYlN.cjs';
2
2
  export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from '../provider-factory-DH3udYlN.cjs';
3
3
  import { MilestoneInput, LessonPlan, ActivityLab, ProjectGraph, CodeLab, Worksheet, Handout, SlideDeck, TeacherGuide, Extension, CurriculumQualityReport, ProjectInstruction, SelfLab, DiagnosticQuiz } from '../schemas/index.cjs';
4
4
  import * as ai from 'ai';
5
- import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-C7j5LKon.cjs';
6
- export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-C7j5LKon.cjs';
5
+ import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-BTTzbb-l.cjs';
6
+ export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-BTTzbb-l.cjs';
7
7
  import { z } from 'zod';
8
8
 
9
9
  interface LessonPromptInput {
@@ -2,8 +2,8 @@ import { M as ModelResolutionOptions } from '../provider-factory-DH3udYlN.js';
2
2
  export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from '../provider-factory-DH3udYlN.js';
3
3
  import { MilestoneInput, LessonPlan, ActivityLab, ProjectGraph, CodeLab, Worksheet, Handout, SlideDeck, TeacherGuide, Extension, CurriculumQualityReport, ProjectInstruction, SelfLab, DiagnosticQuiz } from '../schemas/index.js';
4
4
  import * as ai from 'ai';
5
- import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-C7j5LKon.js';
6
- export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-C7j5LKon.js';
5
+ import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-BTTzbb-l.js';
6
+ export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-BTTzbb-l.js';
7
7
  import { z } from 'zod';
8
8
 
9
9
  interface LessonPromptInput {
package/dist/ai/index.mjs CHANGED
@@ -406,6 +406,32 @@ Guidelines:
406
406
  3. Keep technical terminology and official API symbols intact.
407
407
  4. Format output using clean Markdown, clear sections, bullet points, and code blocks where required.
408
408
  5. Do NOT use emojis in headings, tab titles, or UI navigation labels.`;
409
+ if (options.customInference) {
410
+ try {
411
+ const text = await options.customInference({
412
+ systemInstruction,
413
+ userPrompt: messages.map((m) => m.content).join("\n\n"),
414
+ messages,
415
+ temperature,
416
+ maxTokens,
417
+ onChunk: onChunk ?? (() => {
418
+ })
419
+ });
420
+ if (text && text.trim()) return text;
421
+ throw createAiInferenceError({
422
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
423
+ message: "customInference returned empty output",
424
+ rawError: { customInference: "empty response" }
425
+ });
426
+ } catch (e) {
427
+ if (e?.errorCode || e?.name === "AiInferenceError") throw e;
428
+ throw createAiInferenceError({
429
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
430
+ message: `customInference failed: ${e?.message || e}`,
431
+ rawError: { customInference: String(e?.message || e) }
432
+ });
433
+ }
434
+ }
409
435
  const formattedMessages = [
410
436
  { role: "system", content: systemInstruction },
411
437
  ...messages.map((m) => ({