@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.
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-C7j5LKon.cjs';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-BTTzbb-l.cjs';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-C7j5LKon.js';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-BTTzbb-l.js';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -649,6 +649,32 @@ Guidelines:
649
649
  3. Keep technical terminology and official API symbols intact.
650
650
  4. Format output using clean Markdown, clear sections, bullet points, and code blocks where required.
651
651
  5. Do NOT use emojis in headings, tab titles, or UI navigation labels.`;
652
+ if (options.customInference) {
653
+ try {
654
+ const text = await options.customInference({
655
+ systemInstruction,
656
+ userPrompt: messages.map((m) => m.content).join("\n\n"),
657
+ messages,
658
+ temperature,
659
+ maxTokens,
660
+ onChunk: onChunk ?? (() => {
661
+ })
662
+ });
663
+ if (text && text.trim()) return text;
664
+ throw createAiInferenceError({
665
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
666
+ message: "customInference returned empty output",
667
+ rawError: { customInference: "empty response" }
668
+ });
669
+ } catch (e) {
670
+ if (e?.errorCode || e?.name === "AiInferenceError") throw e;
671
+ throw createAiInferenceError({
672
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
673
+ message: `customInference failed: ${e?.message || e}`,
674
+ rawError: { customInference: String(e?.message || e) }
675
+ });
676
+ }
677
+ }
652
678
  const formattedMessages = [
653
679
  { role: "system", content: systemInstruction },
654
680
  ...messages.map((m) => ({