@thanh01.pmt/curriculum-kit 1.0.8 → 1.0.10

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.
Files changed (42) hide show
  1. package/dist/ai/index.cjs +36 -10
  2. package/dist/ai/index.cjs.map +1 -1
  3. package/dist/ai/index.d.cts +5 -5
  4. package/dist/ai/index.d.ts +5 -5
  5. package/dist/ai/index.mjs +36 -10
  6. package/dist/ai/index.mjs.map +1 -1
  7. package/dist/{index-BfDHBO7f.d.ts → index-B8lOdFuz.d.ts} +1 -1
  8. package/dist/{index-BEicVaQ9.d.cts → index-DhxvfPoW.d.cts} +1 -1
  9. package/dist/index.cjs +43 -16
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +6 -6
  12. package/dist/index.d.ts +6 -6
  13. package/dist/index.mjs +43 -16
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/media/index.cjs +30 -4
  16. package/dist/media/index.cjs.map +1 -1
  17. package/dist/media/index.d.cts +1 -1
  18. package/dist/media/index.d.ts +1 -1
  19. package/dist/media/index.mjs +30 -4
  20. package/dist/media/index.mjs.map +1 -1
  21. package/dist/{milestoneBundleGenerator-CbXhs1CP.d.ts → milestoneBundleGenerator-Bkba8OPG.d.ts} +1 -1
  22. package/dist/{milestoneBundleGenerator-DrBtHzBO.d.cts → milestoneBundleGenerator-CzSOeAzU.d.cts} +1 -1
  23. package/dist/pipeline/index.cjs +5 -5
  24. package/dist/pipeline/index.cjs.map +1 -1
  25. package/dist/pipeline/index.d.cts +3 -3
  26. package/dist/pipeline/index.d.ts +3 -3
  27. package/dist/pipeline/index.mjs +5 -5
  28. package/dist/pipeline/index.mjs.map +1 -1
  29. package/dist/{provider-factory-DH3udYlN.d.ts → provider-factory-DxzOVEmh.d.cts} +1 -1
  30. package/dist/{provider-factory-DH3udYlN.d.cts → provider-factory-DxzOVEmh.d.ts} +1 -1
  31. package/dist/storage/index.d.cts +2 -2
  32. package/dist/storage/index.d.ts +2 -2
  33. package/dist/{streamRunner-C7j5LKon.d.cts → streamRunner-CcpmxOf1.d.cts} +20 -1
  34. package/dist/{streamRunner-C7j5LKon.d.ts → streamRunner-CcpmxOf1.d.ts} +20 -1
  35. package/dist/workflow/index.cjs +33 -7
  36. package/dist/workflow/index.cjs.map +1 -1
  37. package/dist/workflow/index.d.cts +2 -2
  38. package/dist/workflow/index.d.ts +2 -2
  39. package/dist/workflow/index.mjs +33 -7
  40. package/dist/workflow/index.mjs.map +1 -1
  41. package/package.json +22 -21
  42. package/LICENSE +0 -21
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-C7j5LKon.cjs';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-CcpmxOf1.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-CcpmxOf1.js';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -420,7 +420,7 @@ function isModelAllowed(model) {
420
420
  }
421
421
  function getDesignatedFallbackChain() {
422
422
  const rawProviders = resolveApiKey2("FALLBACK_AI_PROVIDER") || resolveApiKey2("FALLBACK_AI_PROVIDERS") || resolveApiKey2("DEFAULT_AI_PROVIDER") || "nvidia,openrouter";
423
- const rawModels = resolveApiKey2("FALLBACK_AI_MODEL") || resolveApiKey2("FALLBACK_AI_MODELS") || resolveApiKey2("DEFAULT_AI_MODEL") || "nvidia/nemotron-3-ultra-550b-a55b,@preset/coding-free,deepseek/deepseek-chat:free";
423
+ const rawModels = resolveApiKey2("FALLBACK_AI_MODEL") || resolveApiKey2("FALLBACK_AI_MODELS") || resolveApiKey2("DEFAULT_AI_MODEL") || "nvidia/nemotron-3-ultra-550b-a55b:free,@preset/coding-free,deepseek/deepseek-chat:free";
424
424
  const providerList = rawProviders.split(",").map((p) => p.trim().toLowerCase()).filter((p) => p.length > 0 && isProviderEnabled(p));
425
425
  const modelList = rawModels.split(",").map((m) => m.trim()).filter((m) => m.length > 0 && isModelAllowed(m));
426
426
  const chain = [];
@@ -429,7 +429,7 @@ function getDesignatedFallbackChain() {
429
429
  if (provider === "nvidia") {
430
430
  providerModels = modelList.filter((m) => m.startsWith("nvidia/") || m.startsWith("meta/") || m.startsWith("mistralai/"));
431
431
  if (providerModels.length === 0) {
432
- providerModels = ["nvidia/nemotron-3-ultra-550b-a55b", "nvidia/nemotron-3.5-lightning-30b-a3b"];
432
+ providerModels = ["nvidia/nemotron-3-ultra-550b-a55b:free", "nvidia/nemotron-3.5-lightning-30b-a3b"];
433
433
  }
434
434
  } else if (provider === "openrouter") {
435
435
  providerModels = modelList.filter((m) => m.startsWith("@") || m.includes("/") || m.includes(":"));
@@ -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) => ({
@@ -661,8 +687,8 @@ Guidelines:
661
687
  const isNvidiaPreferred = requestedModel.startsWith("nvidia/") || Boolean(nvidiaKey && !openrouterKey) && isProviderEnabled("nvidia");
662
688
  if (nvidiaKey && isProviderEnabled("nvidia")) {
663
689
  const candidateNemotronModels = [
664
- requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b",
665
- "nvidia/nemotron-3-ultra-550b-a55b",
690
+ requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b:free",
691
+ "nvidia/nemotron-3-ultra-550b-a55b:free",
666
692
  "nvidia/nemotron-3.5-lightning-30b-a3b",
667
693
  "nvidia/nemotron-3-super-120b-a12b",
668
694
  "nvidia/llama-3.1-nemotron-70b-instruct"