@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
@@ -427,7 +427,7 @@ function isModelAllowed(model) {
427
427
  }
428
428
  function getDesignatedFallbackChain() {
429
429
  const rawProviders = resolveApiKey2("FALLBACK_AI_PROVIDER") || resolveApiKey2("FALLBACK_AI_PROVIDERS") || resolveApiKey2("DEFAULT_AI_PROVIDER") || "nvidia,openrouter";
430
- 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";
430
+ 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";
431
431
  const providerList = rawProviders.split(",").map((p) => p.trim().toLowerCase()).filter((p) => p.length > 0 && isProviderEnabled(p));
432
432
  const modelList = rawModels.split(",").map((m) => m.trim()).filter((m) => m.length > 0 && isModelAllowed(m));
433
433
  const chain = [];
@@ -436,7 +436,7 @@ function getDesignatedFallbackChain() {
436
436
  if (provider === "nvidia") {
437
437
  providerModels = modelList.filter((m) => m.startsWith("nvidia/") || m.startsWith("meta/") || m.startsWith("mistralai/"));
438
438
  if (providerModels.length === 0) {
439
- providerModels = ["nvidia/nemotron-3-ultra-550b-a55b", "nvidia/nemotron-3.5-lightning-30b-a3b"];
439
+ providerModels = ["nvidia/nemotron-3-ultra-550b-a55b:free", "nvidia/nemotron-3.5-lightning-30b-a3b"];
440
440
  }
441
441
  } else if (provider === "openrouter") {
442
442
  providerModels = modelList.filter((m) => m.startsWith("@") || m.includes("/") || m.includes(":"));
@@ -656,6 +656,32 @@ Guidelines:
656
656
  3. Keep technical terminology and official API symbols intact.
657
657
  4. Format output using clean Markdown, clear sections, bullet points, and code blocks where required.
658
658
  5. Do NOT use emojis in headings, tab titles, or UI navigation labels.`;
659
+ if (options.customInference) {
660
+ try {
661
+ const text = await options.customInference({
662
+ systemInstruction,
663
+ userPrompt: messages.map((m) => m.content).join("\n\n"),
664
+ messages,
665
+ temperature,
666
+ maxTokens,
667
+ onChunk: onChunk ?? (() => {
668
+ })
669
+ });
670
+ if (text && text.trim()) return text;
671
+ throw createAiInferenceError({
672
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
673
+ message: "customInference returned empty output",
674
+ rawError: { customInference: "empty response" }
675
+ });
676
+ } catch (e) {
677
+ if (e?.errorCode || e?.name === "AiInferenceError") throw e;
678
+ throw createAiInferenceError({
679
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
680
+ message: `customInference failed: ${e?.message || e}`,
681
+ rawError: { customInference: String(e?.message || e) }
682
+ });
683
+ }
684
+ }
659
685
  const formattedMessages = [
660
686
  { role: "system", content: systemInstruction },
661
687
  ...messages.map((m) => ({
@@ -668,8 +694,8 @@ Guidelines:
668
694
  const isNvidiaPreferred = requestedModel.startsWith("nvidia/") || Boolean(nvidiaKey && !openrouterKey) && isProviderEnabled("nvidia");
669
695
  if (nvidiaKey && isProviderEnabled("nvidia")) {
670
696
  const candidateNemotronModels = [
671
- requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b",
672
- "nvidia/nemotron-3-ultra-550b-a55b",
697
+ requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b:free",
698
+ "nvidia/nemotron-3-ultra-550b-a55b:free",
673
699
  "nvidia/nemotron-3.5-lightning-30b-a3b",
674
700
  "nvidia/nemotron-3-super-120b-a12b",
675
701
  "nvidia/llama-3.1-nemotron-70b-instruct"