@m5kdev/commons 0.26.6 → 0.27.1

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 (31) hide show
  1. package/dist/src/modules/ai/ai.constants.cjs +10 -322
  2. package/dist/src/modules/ai/ai.constants.cjs.map +1 -1
  3. package/dist/src/modules/ai/ai.constants.d.cts +5 -53
  4. package/dist/src/modules/ai/ai.constants.d.mts +5 -53
  5. package/dist/src/modules/ai/ai.constants.mjs +9 -279
  6. package/dist/src/modules/ai/ai.constants.mjs.map +1 -1
  7. package/dist/src/modules/ai/ai.models.contsants.cjs +758 -0
  8. package/dist/src/modules/ai/ai.models.contsants.cjs.map +1 -0
  9. package/dist/src/modules/ai/ai.models.contsants.d.cts +7 -0
  10. package/dist/src/modules/ai/ai.models.contsants.d.mts +7 -0
  11. package/dist/src/modules/ai/ai.models.contsants.mjs +757 -0
  12. package/dist/src/modules/ai/ai.models.contsants.mjs.map +1 -0
  13. package/dist/src/modules/ai/ai.types.cjs +0 -0
  14. package/dist/src/modules/ai/ai.types.d.cts +18 -0
  15. package/dist/src/modules/ai/ai.types.d.mts +18 -0
  16. package/dist/src/modules/ai/ai.types.mjs +1 -0
  17. package/dist/src/modules/ai/ai.utils.cjs +164 -0
  18. package/dist/src/modules/ai/ai.utils.cjs.map +1 -1
  19. package/dist/src/modules/ai/ai.utils.d.cts +23 -1
  20. package/dist/src/modules/ai/ai.utils.d.mts +23 -1
  21. package/dist/src/modules/ai/ai.utils.mjs +157 -1
  22. package/dist/src/modules/ai/ai.utils.mjs.map +1 -1
  23. package/dist/src/modules/notification/notification.schema.d.cts +3 -3
  24. package/dist/src/modules/notification/notification.schema.d.mts +3 -3
  25. package/dist/src/modules/schemas/query.schema.d.cts +6 -6
  26. package/dist/src/modules/schemas/query.schema.d.mts +6 -6
  27. package/dist/src/modules/tag/tag.schema.d.cts +2 -2
  28. package/dist/src/modules/tag/tag.schema.d.mts +2 -2
  29. package/dist/src/modules/workflow/workflow.schema.d.cts +4 -4
  30. package/dist/src/modules/workflow/workflow.schema.d.mts +4 -4
  31. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.models.contsants.mjs","names":[],"sources":["../../../../src/modules/ai/ai.models.contsants.ts"],"sourcesContent":["import type { RankedModel } from \"./ai.types\";\r\n\r\nexport const RANKED_MODELS: RankedModel[] = [\r\n {\r\n id: \"openai/gpt-5.6-sol-pro\",\r\n inputCost: 5,\r\n outputCost: 30,\r\n speed: 3.35,\r\n quality: {\r\n structured_output: 9.72,\r\n creative: 8.85,\r\n research: 9.92,\r\n chat: 9.62,\r\n tool_use: 9.82,\r\n planning: 9.95,\r\n classification: 9.42,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.6-sol\",\r\n inputCost: 5,\r\n outputCost: 30,\r\n speed: 3.85,\r\n quality: {\r\n structured_output: 9.66,\r\n creative: 8.78,\r\n research: 9.88,\r\n chat: 9.58,\r\n tool_use: 9.74,\r\n planning: 9.9,\r\n classification: 9.38,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-fable-5\",\r\n inputCost: 10,\r\n outputCost: 50,\r\n speed: 3.15,\r\n quality: {\r\n structured_output: 8.82,\r\n creative: 9.95,\r\n research: 9.98,\r\n chat: 9.95,\r\n tool_use: 9.9,\r\n planning: 9.96,\r\n classification: 9.35,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-opus-4.8\",\r\n inputCost: 5,\r\n outputCost: 25,\r\n speed: 3.25,\r\n quality: {\r\n structured_output: 9.18,\r\n creative: 9.72,\r\n research: 9.72,\r\n chat: 9.68,\r\n tool_use: 9.42,\r\n planning: 9.58,\r\n classification: 9.28,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-opus-4.7\",\r\n inputCost: 5,\r\n outputCost: 25,\r\n speed: 3.15,\r\n quality: {\r\n structured_output: 9.92,\r\n creative: 9.55,\r\n research: 9.32,\r\n chat: 9.55,\r\n tool_use: 9.28,\r\n planning: 9.32,\r\n classification: 9.2,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-opus-4.6\",\r\n inputCost: 5,\r\n outputCost: 25,\r\n speed: 3.05,\r\n quality: {\r\n structured_output: 9.58,\r\n creative: 9.42,\r\n research: 9.18,\r\n chat: 9.52,\r\n tool_use: 9.16,\r\n planning: 9.22,\r\n classification: 9.08,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-sonnet-5\",\r\n inputCost: 2,\r\n outputCost: 10,\r\n speed: 6.85,\r\n quality: {\r\n structured_output: 9.86,\r\n creative: 9.82,\r\n research: 9.48,\r\n chat: 9.86,\r\n tool_use: 9.76,\r\n planning: 9.82,\r\n classification: 9.32,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-sonnet-4.6\",\r\n inputCost: 3,\r\n outputCost: 15,\r\n speed: 5.85,\r\n quality: {\r\n structured_output: 9.62,\r\n creative: 9.15,\r\n research: 9.08,\r\n chat: 9.2,\r\n tool_use: 9.05,\r\n planning: 9.12,\r\n classification: 8.92,\r\n },\r\n },\r\n {\r\n id: \"anthropic/claude-haiku-4.5\",\r\n inputCost: 1,\r\n outputCost: 5,\r\n speed: 9.05,\r\n quality: {\r\n structured_output: 8.35,\r\n creative: 8.15,\r\n research: 7.75,\r\n chat: 8.25,\r\n tool_use: 8.42,\r\n planning: 7.8,\r\n classification: 8.62,\r\n },\r\n },\r\n {\r\n id: \"google/gemini-3.1-pro-preview\",\r\n inputCost: 2,\r\n outputCost: 12,\r\n speed: 6.05,\r\n quality: {\r\n structured_output: 9.99,\r\n creative: 9.35,\r\n research: 9.66,\r\n chat: 9.48,\r\n tool_use: 9.45,\r\n planning: 9.34,\r\n classification: 9.76,\r\n },\r\n },\r\n {\r\n id: \"google/gemini-3.5-flash\",\r\n inputCost: 1.5,\r\n outputCost: 9,\r\n speed: 8.72,\r\n quality: {\r\n structured_output: 9.77,\r\n creative: 8.1,\r\n research: 8.42,\r\n chat: 8.18,\r\n tool_use: 8.72,\r\n planning: 8.35,\r\n classification: 9.18,\r\n },\r\n },\r\n {\r\n id: \"google/gemini-3-flash-preview\",\r\n inputCost: 0.5,\r\n outputCost: 3,\r\n speed: 8.9,\r\n quality: {\r\n structured_output: 9.32,\r\n creative: 8.2,\r\n research: 8.48,\r\n chat: 8.22,\r\n tool_use: 9.12,\r\n planning: 8.48,\r\n classification: 9.16,\r\n },\r\n },\r\n {\r\n id: \"google/gemini-3.1-flash-lite-preview\",\r\n inputCost: 0.25,\r\n outputCost: 1.5,\r\n speed: 9.72,\r\n quality: {\r\n structured_output: 8.55,\r\n creative: 7.35,\r\n research: 7.72,\r\n chat: 7.55,\r\n tool_use: 8.36,\r\n planning: 7.58,\r\n classification: 8.92,\r\n },\r\n },\r\n {\r\n id: \"google/gemini-2.5-pro\",\r\n inputCost: 1.25,\r\n outputCost: 10,\r\n speed: 5.9,\r\n quality: {\r\n structured_output: 9.72,\r\n creative: 9.18,\r\n research: 9.12,\r\n chat: 9.05,\r\n tool_use: 8.82,\r\n planning: 8.78,\r\n classification: 9.18,\r\n },\r\n },\r\n {\r\n id: \"google/gemini-2.5-flash\",\r\n inputCost: 0.3,\r\n outputCost: 2.5,\r\n speed: 9.55,\r\n quality: {\r\n structured_output: 9.84,\r\n creative: 7.92,\r\n research: 8.35,\r\n chat: 7.95,\r\n tool_use: 8.46,\r\n planning: 8.22,\r\n classification: 9.28,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.6-terra-pro\",\r\n inputCost: 2.5,\r\n outputCost: 15,\r\n speed: 5.25,\r\n quality: {\r\n structured_output: 9.55,\r\n creative: 8.68,\r\n research: 9.36,\r\n chat: 9.22,\r\n tool_use: 9.18,\r\n planning: 9.18,\r\n classification: 9.35,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.6-terra\",\r\n inputCost: 2.5,\r\n outputCost: 15,\r\n speed: 5.95,\r\n quality: {\r\n structured_output: 9.38,\r\n creative: 8.52,\r\n research: 9.18,\r\n chat: 9.08,\r\n tool_use: 8.86,\r\n planning: 9.05,\r\n classification: 9.28,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.6-luna-pro\",\r\n inputCost: 1,\r\n outputCost: 6,\r\n speed: 7.95,\r\n quality: {\r\n structured_output: 9.25,\r\n creative: 7.92,\r\n research: 8.78,\r\n chat: 8.55,\r\n tool_use: 8.62,\r\n planning: 8.42,\r\n classification: 9.18,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.6-luna\",\r\n inputCost: 1,\r\n outputCost: 6,\r\n speed: 8.7,\r\n quality: {\r\n structured_output: 9.18,\r\n creative: 7.82,\r\n research: 8.68,\r\n chat: 8.48,\r\n tool_use: 8.48,\r\n planning: 8.32,\r\n classification: 9.12,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.5\",\r\n inputCost: 5,\r\n outputCost: 30,\r\n speed: 4.8,\r\n quality: {\r\n structured_output: 9.82,\r\n creative: 9.42,\r\n research: 9.76,\r\n chat: 9.78,\r\n tool_use: 8.86,\r\n planning: 9.48,\r\n classification: 9.42,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.4\",\r\n inputCost: 2.5,\r\n outputCost: 15,\r\n speed: 5.9,\r\n quality: {\r\n structured_output: 10,\r\n creative: 9.25,\r\n research: 9.18,\r\n chat: 9.35,\r\n tool_use: 8.72,\r\n planning: 8.88,\r\n classification: 9.86,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5.4-mini\",\r\n inputCost: 0.75,\r\n outputCost: 4.5,\r\n speed: 8.85,\r\n quality: {\r\n structured_output: 9.5,\r\n creative: 8.22,\r\n research: 7.9,\r\n chat: 8.28,\r\n tool_use: 8.35,\r\n planning: 8.12,\r\n classification: 9.18,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5\",\r\n inputCost: 2.5,\r\n outputCost: 15,\r\n speed: 4.95,\r\n quality: {\r\n structured_output: 9.56,\r\n creative: 8.55,\r\n research: 9.05,\r\n chat: 9.02,\r\n tool_use: 8.55,\r\n planning: 8.62,\r\n classification: 9.28,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-5-mini\",\r\n inputCost: 0.75,\r\n outputCost: 4.5,\r\n speed: 8.7,\r\n quality: {\r\n structured_output: 9.12,\r\n creative: 7.65,\r\n research: 7.72,\r\n chat: 8.05,\r\n tool_use: 8.22,\r\n planning: 7.88,\r\n classification: 9.08,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-4.1\",\r\n inputCost: 2,\r\n outputCost: 8,\r\n speed: 6.85,\r\n quality: {\r\n structured_output: 9.62,\r\n creative: 8.45,\r\n research: 8.65,\r\n chat: 8.72,\r\n tool_use: 8.42,\r\n planning: 8.38,\r\n classification: 9.16,\r\n },\r\n },\r\n {\r\n id: \"z-ai/glm-5.2\",\r\n inputCost: 0.8694,\r\n outputCost: 2.7324,\r\n speed: 6.45,\r\n quality: {\r\n structured_output: 9.8,\r\n creative: 8.78,\r\n research: 9.28,\r\n chat: 8.62,\r\n tool_use: 9.22,\r\n planning: 9.25,\r\n classification: 9.38,\r\n },\r\n },\r\n {\r\n id: \"z-ai/glm-5.1\",\r\n inputCost: 0.966,\r\n outputCost: 3.036,\r\n speed: 6.85,\r\n quality: {\r\n structured_output: 9.96,\r\n creative: 8.72,\r\n research: 9.22,\r\n chat: 8.75,\r\n tool_use: 8.62,\r\n planning: 9.12,\r\n classification: 9.42,\r\n },\r\n },\r\n {\r\n id: \"z-ai/glm-5v-turbo\",\r\n inputCost: 1.2,\r\n outputCost: 4,\r\n speed: 6.05,\r\n quality: {\r\n structured_output: 8.35,\r\n creative: 7.05,\r\n research: 8.18,\r\n chat: 7.25,\r\n tool_use: 8.35,\r\n planning: 8.18,\r\n classification: 7.85,\r\n },\r\n },\r\n {\r\n id: \"z-ai/glm-4.7\",\r\n inputCost: 0.4,\r\n outputCost: 1.75,\r\n speed: 7.85,\r\n quality: {\r\n structured_output: 9.88,\r\n creative: 7.68,\r\n research: 8.25,\r\n chat: 7.82,\r\n tool_use: 7.88,\r\n planning: 8.08,\r\n classification: 9.32,\r\n },\r\n },\r\n {\r\n id: \"moonshotai/kimi-k2.6\",\r\n inputCost: 0.66,\r\n outputCost: 3.41,\r\n speed: 6.95,\r\n quality: {\r\n structured_output: 9.58,\r\n creative: 8.45,\r\n research: 8.55,\r\n chat: 8.42,\r\n tool_use: 8.55,\r\n planning: 8.58,\r\n classification: 8.62,\r\n },\r\n },\r\n {\r\n id: \"deepseek/deepseek-v4-pro\",\r\n inputCost: 0.435,\r\n outputCost: 0.87,\r\n speed: 7.05,\r\n quality: {\r\n structured_output: 9.58,\r\n creative: 7.62,\r\n research: 8.78,\r\n chat: 8.55,\r\n tool_use: 8.02,\r\n planning: 8.72,\r\n classification: 9.1,\r\n },\r\n },\r\n {\r\n id: \"deepseek/deepseek-v4-flash\",\r\n inputCost: 0.15,\r\n outputCost: 0.45,\r\n speed: 9.25,\r\n quality: {\r\n structured_output: 8.9,\r\n creative: 6.92,\r\n research: 8.25,\r\n chat: 7.45,\r\n tool_use: 7.82,\r\n planning: 8.05,\r\n classification: 8.62,\r\n },\r\n },\r\n {\r\n id: \"deepseek/deepseek-r1-distill-qwen-32b\",\r\n inputCost: 0.2,\r\n outputCost: 0.8,\r\n speed: 6.9,\r\n quality: {\r\n structured_output: 8.65,\r\n creative: 6.55,\r\n research: 7.55,\r\n chat: 7.25,\r\n tool_use: 6.85,\r\n planning: 7.42,\r\n classification: 7.92,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3.6-plus\",\r\n inputCost: 0.325,\r\n outputCost: 1.95,\r\n speed: 7.95,\r\n quality: {\r\n structured_output: 8.72,\r\n creative: 7.42,\r\n research: 7.95,\r\n chat: 7.72,\r\n tool_use: 8.38,\r\n planning: 8.05,\r\n classification: 8.58,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3.5-35b-a3b\",\r\n inputCost: 0.14,\r\n outputCost: 1,\r\n speed: 8.95,\r\n quality: {\r\n structured_output: 9.88,\r\n creative: 7.28,\r\n research: 7.92,\r\n chat: 7.75,\r\n tool_use: 7.78,\r\n planning: 7.88,\r\n classification: 8.78,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3.5-27b\",\r\n inputCost: 0.195,\r\n outputCost: 1.56,\r\n speed: 8.15,\r\n quality: {\r\n structured_output: 9.54,\r\n creative: 7.18,\r\n research: 7.65,\r\n chat: 7.52,\r\n tool_use: 7.62,\r\n planning: 7.58,\r\n classification: 8.48,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3.5-122b-a10b\",\r\n inputCost: 0.4,\r\n outputCost: 2.4,\r\n speed: 6.25,\r\n quality: {\r\n structured_output: 9.32,\r\n creative: 7.35,\r\n research: 8.42,\r\n chat: 8.25,\r\n tool_use: 8.18,\r\n planning: 8.28,\r\n classification: 8.65,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3-235b-a22b\",\r\n inputCost: 0.455,\r\n outputCost: 1.82,\r\n speed: 5.15,\r\n quality: {\r\n structured_output: 9.74,\r\n creative: 7.42,\r\n research: 8.58,\r\n chat: 8.35,\r\n tool_use: 7.88,\r\n planning: 8.42,\r\n classification: 8.7,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3-235b-a22b-thinking-2507\",\r\n inputCost: 0.1495,\r\n outputCost: 1.495,\r\n speed: 5.35,\r\n quality: {\r\n structured_output: 9.76,\r\n creative: 7.45,\r\n research: 8.62,\r\n chat: 8.38,\r\n tool_use: 7.92,\r\n planning: 8.48,\r\n classification: 8.72,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3-30b-a3b-instruct-2507\",\r\n inputCost: 0.1,\r\n outputCost: 0.3,\r\n speed: 9.1,\r\n quality: {\r\n structured_output: 8.82,\r\n creative: 6.35,\r\n research: 6.88,\r\n chat: 6.72,\r\n tool_use: 6.85,\r\n planning: 6.82,\r\n classification: 8.18,\r\n },\r\n },\r\n {\r\n id: \"qwen/qwen3-coder\",\r\n inputCost: 0.08,\r\n outputCost: 0.28,\r\n speed: 8.15,\r\n quality: {\r\n structured_output: 8.55,\r\n creative: 5.65,\r\n research: 6.85,\r\n chat: 6.55,\r\n tool_use: 8.62,\r\n planning: 7.75,\r\n classification: 7.82,\r\n },\r\n },\r\n {\r\n id: \"x-ai/grok-4.3\",\r\n inputCost: 1.25,\r\n outputCost: 2.5,\r\n speed: 7.75,\r\n quality: {\r\n structured_output: 8.3,\r\n creative: 7.72,\r\n research: 8.18,\r\n chat: 8.72,\r\n tool_use: 7.72,\r\n planning: 7.9,\r\n classification: 8.15,\r\n },\r\n },\r\n {\r\n id: \"inception/mercury-2\",\r\n inputCost: 0.25,\r\n outputCost: 0.75,\r\n speed: 10,\r\n quality: {\r\n structured_output: 8.05,\r\n creative: 5.35,\r\n research: 6.75,\r\n chat: 6.45,\r\n tool_use: 8.35,\r\n planning: 6.92,\r\n classification: 8.22,\r\n },\r\n },\r\n {\r\n id: \"nvidia/nemotron-3-nano-30b-a3b\",\r\n inputCost: 0.1,\r\n outputCost: 0.3,\r\n speed: 9.05,\r\n quality: {\r\n structured_output: 8.88,\r\n creative: 6.45,\r\n research: 6.82,\r\n chat: 6.75,\r\n tool_use: 7.28,\r\n planning: 6.85,\r\n classification: 8.28,\r\n },\r\n },\r\n {\r\n id: \"google/gemma-3-27b-it\",\r\n inputCost: 0.1,\r\n outputCost: 0.3,\r\n speed: 8.2,\r\n quality: {\r\n structured_output: 9.48,\r\n creative: 7.22,\r\n research: 6.82,\r\n chat: 7.35,\r\n tool_use: 6.72,\r\n planning: 6.82,\r\n classification: 7.98,\r\n },\r\n },\r\n {\r\n id: \"google/gemma-4-26b-a4b-it\",\r\n inputCost: 0.12,\r\n outputCost: 0.35,\r\n speed: 8.25,\r\n quality: {\r\n structured_output: 9.1,\r\n creative: 7.35,\r\n research: 7.05,\r\n chat: 7.42,\r\n tool_use: 6.88,\r\n planning: 6.95,\r\n classification: 8.05,\r\n },\r\n },\r\n {\r\n id: \"ibm/granite-4.0\",\r\n inputCost: 0.1,\r\n outputCost: 0.3,\r\n speed: 8.05,\r\n quality: {\r\n structured_output: 9.08,\r\n creative: 5.82,\r\n research: 6.55,\r\n chat: 6.42,\r\n tool_use: 6.58,\r\n planning: 6.48,\r\n classification: 8.18,\r\n },\r\n },\r\n {\r\n id: \"microsoft/phi-4\",\r\n inputCost: 0.15,\r\n outputCost: 0.6,\r\n speed: 8.05,\r\n quality: {\r\n structured_output: 9.06,\r\n creative: 6.62,\r\n research: 6.75,\r\n chat: 7.12,\r\n tool_use: 5.95,\r\n planning: 6.58,\r\n classification: 8.18,\r\n },\r\n },\r\n {\r\n id: \"mistralai/ministral-3-14b\",\r\n inputCost: 0.2,\r\n outputCost: 0.8,\r\n speed: 7.95,\r\n quality: {\r\n structured_output: 7.78,\r\n creative: 6.35,\r\n research: 6.45,\r\n chat: 6.55,\r\n tool_use: 6.35,\r\n planning: 6.32,\r\n classification: 7.55,\r\n },\r\n },\r\n {\r\n id: \"openai/gpt-oss-20b\",\r\n inputCost: 0.1,\r\n outputCost: 0.4,\r\n speed: 8.1,\r\n quality: {\r\n structured_output: 7.32,\r\n creative: 6.25,\r\n research: 6.38,\r\n chat: 6.48,\r\n tool_use: 6.28,\r\n planning: 6.25,\r\n classification: 7.45,\r\n },\r\n },\r\n] as const;\r\n"],"mappings":";AAEA,MAAa,gBAA+B;CAC1C;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACD;EACE,IAAI;EACJ,WAAW;EACX,YAAY;EACZ,OAAO;EACP,SAAS;GACP,mBAAmB;GACnB,UAAU;GACV,UAAU;GACV,MAAM;GACN,UAAU;GACV,UAAU;GACV,gBAAgB;GACjB;EACF;CACF"}
File without changes
@@ -0,0 +1,18 @@
1
+ //#region src/modules/ai/ai.types.d.ts
2
+ interface RankedModel {
3
+ id: string;
4
+ inputCost: number;
5
+ outputCost: number;
6
+ quality: Record<Category, number>;
7
+ speed: number;
8
+ }
9
+ type Category = "structured_output" | "creative" | "research" | "chat" | "tool_use" | "planning" | "classification";
10
+ type SortType = "quality" | "price" | "speed";
11
+ type TokenProfile = {
12
+ inputTokens: number;
13
+ outputTokens: number;
14
+ };
15
+ type TokenSize = "xs" | "sm" | "md" | "lg" | "xl";
16
+ //#endregion
17
+ export { Category, RankedModel, SortType, TokenProfile, TokenSize };
18
+ //# sourceMappingURL=ai.types.d.cts.map
@@ -0,0 +1,18 @@
1
+ //#region src/modules/ai/ai.types.d.ts
2
+ interface RankedModel {
3
+ id: string;
4
+ inputCost: number;
5
+ outputCost: number;
6
+ quality: Record<Category, number>;
7
+ speed: number;
8
+ }
9
+ type Category = "structured_output" | "creative" | "research" | "chat" | "tool_use" | "planning" | "classification";
10
+ type SortType = "quality" | "price" | "speed";
11
+ type TokenProfile = {
12
+ inputTokens: number;
13
+ outputTokens: number;
14
+ };
15
+ type TokenSize = "xs" | "sm" | "md" | "lg" | "xl";
16
+ //#endregion
17
+ export { Category, RankedModel, SortType, TokenProfile, TokenSize };
18
+ //# sourceMappingURL=ai.types.d.mts.map
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,173 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_src_modules_ai_ai_models_contsants = require("./ai.models.contsants.cjs");
3
+ const require_src_modules_ai_ai_constants = require("./ai.constants.cjs");
2
4
  //#region src/modules/ai/ai.utils.ts
5
+ function getDefaultTokenProfile(category) {
6
+ switch (category) {
7
+ case "structured_output": return {
8
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.lg,
9
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.md
10
+ };
11
+ case "creative": return {
12
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.md,
13
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.lg
14
+ };
15
+ case "research": return {
16
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.xl,
17
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.xl
18
+ };
19
+ case "chat": return {
20
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.sm,
21
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.md
22
+ };
23
+ case "tool_use": return {
24
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.md,
25
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.sm
26
+ };
27
+ case "planning": return {
28
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.lg,
29
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.lg
30
+ };
31
+ case "classification": return {
32
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.sm,
33
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.xs
34
+ };
35
+ default: return {
36
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.md,
37
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS.md
38
+ };
39
+ }
40
+ }
41
+ function getDefaultWeights(weights) {
42
+ if (Array.isArray(weights)) return weights.every((weight) => typeof weight === "number") ? weights : weights.reduce((acc, weight, index) => {
43
+ switch (weight) {
44
+ case "quality":
45
+ acc[0] = index === 0 ? 50 : index === 1 ? 30 : 20;
46
+ break;
47
+ case "price":
48
+ acc[1] = index === 0 ? 50 : index === 1 ? 30 : 20;
49
+ break;
50
+ case "speed":
51
+ acc[2] = index === 0 ? 50 : index === 1 ? 30 : 20;
52
+ break;
53
+ }
54
+ return acc;
55
+ }, [
56
+ 20,
57
+ 50,
58
+ 30
59
+ ]);
60
+ switch (weights) {
61
+ case "quality": return [
62
+ 50,
63
+ 30,
64
+ 20
65
+ ];
66
+ case "price": return [
67
+ 20,
68
+ 50,
69
+ 30
70
+ ];
71
+ case "speed": return [
72
+ 20,
73
+ 30,
74
+ 50
75
+ ];
76
+ default: return [
77
+ 50,
78
+ 25,
79
+ 25
80
+ ];
81
+ }
82
+ }
83
+ function weightsToPriceSensitivity(weights) {
84
+ const [qualityWeight, priceWeight, speedWeight] = weights;
85
+ const total = qualityWeight + priceWeight + speedWeight;
86
+ if (total <= 0) return 1;
87
+ const normalizedPriceWeight = priceWeight / total;
88
+ const min = .55;
89
+ const max = 1.75;
90
+ const sensitivity = max - normalizedPriceWeight * (max - min);
91
+ return Number(sensitivity.toFixed(3));
92
+ }
93
+ function addPriceScores(models, profile, priceSensitivity = 1) {
94
+ const costs = models.map((model) => {
95
+ return profile.inputTokens / 1e6 * model.inputCost + profile.outputTokens / 1e6 * model.outputCost;
96
+ });
97
+ const cheapest = Math.min(...costs);
98
+ const mostExpensive = Math.max(...costs);
99
+ return models.map((model, index) => {
100
+ const cost = costs[index];
101
+ if (mostExpensive === cheapest) return {
102
+ ...model,
103
+ estimatedCost: cost,
104
+ price: 10
105
+ };
106
+ const safeCheapest = Math.max(cheapest, Number.EPSILON);
107
+ const safeCost = Math.max(cost, Number.EPSILON);
108
+ const safeMostExpensive = Math.max(mostExpensive, Number.EPSILON);
109
+ const logMin = Math.log(safeCheapest);
110
+ const logMax = Math.log(safeMostExpensive);
111
+ const normalized = ((Math.log(safeCost) - logMin) / (logMax - logMin)) ** priceSensitivity;
112
+ return {
113
+ ...model,
114
+ estimatedCost: cost,
115
+ price: Math.round(10 - normalized * 9)
116
+ };
117
+ });
118
+ }
119
+ function clampScore(value) {
120
+ return Math.max(1, Math.min(10, value));
121
+ }
122
+ function shapeScoreByWeight(value, weight, maxWeight) {
123
+ const normalized = clampScore(value) / 10;
124
+ if (maxWeight <= 0 || weight <= 0) return 0;
125
+ const importance = (weight / maxWeight) ** 2;
126
+ const expanded = normalized ** 2 * 10;
127
+ const compressed = 8 + normalized * 2;
128
+ return compressed + (expanded - compressed) * importance;
129
+ }
130
+ function rankModels(models, profile, category, weights) {
131
+ const scoredModels = addPriceScores(models, profile, weightsToPriceSensitivity(weights));
132
+ const [qualityWeight, priceWeight, speedWeight] = weights;
133
+ const maxWeight = Math.max(qualityWeight, priceWeight, speedWeight);
134
+ return scoredModels.map((model) => {
135
+ const qualityScore = shapeScoreByWeight(model.quality[category], qualityWeight, maxWeight);
136
+ const priceScore = shapeScoreByWeight(model.price, priceWeight, maxWeight);
137
+ const speedScore = shapeScoreByWeight(model.speed, speedWeight, maxWeight);
138
+ return {
139
+ ...model,
140
+ score: qualityScore * qualityWeight + priceScore * priceWeight + speedScore * speedWeight
141
+ };
142
+ }).sort((a, b) => b.score - a.score);
143
+ }
144
+ function getSortedRankedModel(models, category = "chat", weights, tokenProfile) {
145
+ return rankModels(models, typeof tokenProfile === "string" ? {
146
+ inputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS[tokenProfile],
147
+ outputTokens: require_src_modules_ai_ai_constants.TOKEN_PRESETS[tokenProfile]
148
+ } : typeof tokenProfile === "number" ? {
149
+ inputTokens: tokenProfile,
150
+ outputTokens: tokenProfile
151
+ } : tokenProfile ? tokenProfile : getDefaultTokenProfile(category), category, getDefaultWeights(weights));
152
+ }
153
+ function getSortedRecommendedModels(category = "chat", weights, tokenProfile) {
154
+ return getSortedRankedModel(require_src_modules_ai_ai_models_contsants.RANKED_MODELS, category, weights, tokenProfile);
155
+ }
156
+ function getSortedRecommendedModelIds(category = "chat", weights, tokenProfile) {
157
+ return getSortedRankedModel(require_src_modules_ai_ai_models_contsants.RANKED_MODELS, category, weights, tokenProfile).map((model) => model.id);
158
+ }
3
159
  function arrayToPseudoXML(array, keys, name = "item") {
4
160
  return array.map((item) => `<${name}>${keys.map((key) => `<${String(key)}>${String(item[key])}</${String(key)}>`).join("\n")}</${name}>`).join("\n");
5
161
  }
6
162
  //#endregion
163
+ exports.addPriceScores = addPriceScores;
7
164
  exports.arrayToPseudoXML = arrayToPseudoXML;
165
+ exports.getDefaultTokenProfile = getDefaultTokenProfile;
166
+ exports.getDefaultWeights = getDefaultWeights;
167
+ exports.getSortedRankedModel = getSortedRankedModel;
168
+ exports.getSortedRecommendedModelIds = getSortedRecommendedModelIds;
169
+ exports.getSortedRecommendedModels = getSortedRecommendedModels;
170
+ exports.rankModels = rankModels;
171
+ exports.weightsToPriceSensitivity = weightsToPriceSensitivity;
8
172
 
9
173
  //# sourceMappingURL=ai.utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai.utils.cjs","names":[],"sources":["../../../../src/modules/ai/ai.utils.ts"],"sourcesContent":["export function arrayToPseudoXML<T extends Record<string, unknown>>(\r\n array: readonly T[],\r\n keys: readonly (keyof T)[],\r\n name = \"item\"\r\n): string {\r\n return array\r\n .map(\r\n (item) =>\r\n `<${name}>${keys\r\n .map((key) => `<${String(key)}>${String(item[key])}</${String(key)}>`)\r\n .join(\"\\n\")}</${name}>`\r\n )\r\n .join(\"\\n\");\r\n}\r\n"],"mappings":";;AAAA,SAAgB,iBACd,OACA,MACA,OAAO,QACC;AACR,QAAO,MACJ,KACE,SACC,IAAI,KAAK,GAAG,KACT,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CACrE,KAAK,KAAK,CAAC,IAAI,KAAK,GAC1B,CACA,KAAK,KAAK"}
1
+ {"version":3,"file":"ai.utils.cjs","names":["TOKEN_PRESETS","RANKED_MODELS"],"sources":["../../../../src/modules/ai/ai.utils.ts"],"sourcesContent":["import { RANKED_MODELS, TOKEN_PRESETS } from \"./ai.constants\";\r\nimport type { Category, RankedModel, SortType, TokenProfile, TokenSize } from \"./ai.types\";\r\n\r\nexport function getDefaultTokenProfile(category: Category): TokenProfile {\r\n switch (category) {\r\n case \"structured_output\":\r\n return { inputTokens: TOKEN_PRESETS.lg, outputTokens: TOKEN_PRESETS.md };\r\n case \"creative\":\r\n return { inputTokens: TOKEN_PRESETS.md, outputTokens: TOKEN_PRESETS.lg };\r\n case \"research\":\r\n return { inputTokens: TOKEN_PRESETS.xl, outputTokens: TOKEN_PRESETS.xl };\r\n case \"chat\":\r\n return { inputTokens: TOKEN_PRESETS.sm, outputTokens: TOKEN_PRESETS.md };\r\n case \"tool_use\":\r\n return { inputTokens: TOKEN_PRESETS.md, outputTokens: TOKEN_PRESETS.sm };\r\n case \"planning\":\r\n return { inputTokens: TOKEN_PRESETS.lg, outputTokens: TOKEN_PRESETS.lg };\r\n case \"classification\":\r\n return { inputTokens: TOKEN_PRESETS.sm, outputTokens: TOKEN_PRESETS.xs };\r\n default:\r\n return { inputTokens: TOKEN_PRESETS.md, outputTokens: TOKEN_PRESETS.md };\r\n }\r\n}\r\n\r\nexport function getDefaultWeights(\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number]\r\n): [number, number, number] {\r\n if (Array.isArray(weights)) {\r\n return weights.every((weight) => typeof weight === \"number\")\r\n ? weights\r\n : weights.reduce<[number, number, number]>(\r\n (acc, weight, index) => {\r\n switch (weight) {\r\n case \"quality\":\r\n acc[0] = index === 0 ? 50 : index === 1 ? 30 : 20;\r\n break;\r\n case \"price\":\r\n acc[1] = index === 0 ? 50 : index === 1 ? 30 : 20;\r\n break;\r\n case \"speed\":\r\n acc[2] = index === 0 ? 50 : index === 1 ? 30 : 20;\r\n break;\r\n }\r\n return acc;\r\n },\r\n [20, 50, 30]\r\n );\r\n }\r\n switch (weights) {\r\n case \"quality\":\r\n return [50, 30, 20];\r\n case \"price\":\r\n return [20, 50, 30];\r\n case \"speed\":\r\n return [20, 30, 50];\r\n default:\r\n return [50, 25, 25];\r\n }\r\n}\r\n\r\nexport function weightsToPriceSensitivity(weights: [number, number, number]): number {\r\n const [qualityWeight, priceWeight, speedWeight] = weights;\r\n\r\n const total = qualityWeight + priceWeight + speedWeight;\r\n\r\n if (total <= 0) {\r\n return 1;\r\n }\r\n\r\n const normalizedPriceWeight = priceWeight / total;\r\n\r\n const min = 0.55; // very price-sensitive\r\n const max = 1.75; // price is soft / secondary\r\n\r\n // Higher price weight -> lower exponent -> stronger price penalty.\r\n const sensitivity = max - normalizedPriceWeight * (max - min);\r\n\r\n return Number(sensitivity.toFixed(3));\r\n}\r\n\r\nexport function addPriceScores(\r\n models: RankedModel[],\r\n profile: TokenProfile,\r\n priceSensitivity = 1\r\n): Array<RankedModel & { price: number; estimatedCost: number }> {\r\n const costs = models.map((model) => {\r\n return (\r\n (profile.inputTokens / 1_000_000) * model.inputCost +\r\n (profile.outputTokens / 1_000_000) * model.outputCost\r\n );\r\n });\r\n\r\n const cheapest = Math.min(...costs);\r\n const mostExpensive = Math.max(...costs);\r\n\r\n return models.map((model, index) => {\r\n const cost = costs[index];\r\n\r\n if (mostExpensive === cheapest) {\r\n return {\r\n ...model,\r\n estimatedCost: cost,\r\n price: 10,\r\n };\r\n }\r\n\r\n const safeCheapest = Math.max(cheapest, Number.EPSILON);\r\n const safeCost = Math.max(cost, Number.EPSILON);\r\n const safeMostExpensive = Math.max(mostExpensive, Number.EPSILON);\r\n\r\n const logMin = Math.log(safeCheapest);\r\n const logMax = Math.log(safeMostExpensive);\r\n const logCost = Math.log(safeCost);\r\n\r\n const normalizedRaw = (logCost - logMin) / (logMax - logMin);\r\n\r\n // < 1 makes price matter less.\r\n // > 1 makes price matter more.\r\n const normalized = normalizedRaw ** priceSensitivity;\r\n\r\n return {\r\n ...model,\r\n estimatedCost: cost,\r\n price: Math.round(10 - normalized * 9),\r\n };\r\n });\r\n}\r\n\r\nfunction clampScore(value: number): number {\r\n return Math.max(1, Math.min(10, value));\r\n}\r\n\r\nfunction shapeScoreByWeight(value: number, weight: number, maxWeight: number): number {\r\n const score = clampScore(value);\r\n const normalized = score / 10;\r\n\r\n if (maxWeight <= 0 || weight <= 0) {\r\n return 0;\r\n }\r\n\r\n const importance = (weight / maxWeight) ** 2;\r\n const expanded = normalized ** 2 * 10;\r\n const compressed = 8 + normalized * 2;\r\n return compressed + (expanded - compressed) * importance;\r\n}\r\n\r\nexport function rankModels(\r\n models: RankedModel[],\r\n profile: TokenProfile,\r\n category: Category,\r\n weights: [number, number, number]\r\n) {\r\n const scoredModels = addPriceScores(models, profile, weightsToPriceSensitivity(weights));\r\n\r\n const [qualityWeight, priceWeight, speedWeight] = weights;\r\n const maxWeight = Math.max(qualityWeight, priceWeight, speedWeight);\r\n\r\n return scoredModels\r\n .map((model) => {\r\n const qualityScore = shapeScoreByWeight(model.quality[category], qualityWeight, maxWeight);\r\n\r\n const priceScore = shapeScoreByWeight(model.price, priceWeight, maxWeight);\r\n\r\n const speedScore = shapeScoreByWeight(model.speed, speedWeight, maxWeight);\r\n\r\n return {\r\n ...model,\r\n score: qualityScore * qualityWeight + priceScore * priceWeight + speedScore * speedWeight,\r\n };\r\n })\r\n .sort((a, b) => b.score - a.score);\r\n}\r\n\r\nexport function getSortedRankedModel(\r\n models: RankedModel[],\r\n category: Category = \"chat\",\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number],\r\n tokenProfile?: TokenProfile | number | TokenSize\r\n): RankedModel[] {\r\n const profile =\r\n typeof tokenProfile === \"string\"\r\n ? {\r\n inputTokens: TOKEN_PRESETS[tokenProfile as TokenSize],\r\n outputTokens: TOKEN_PRESETS[tokenProfile as TokenSize],\r\n }\r\n : typeof tokenProfile === \"number\"\r\n ? { inputTokens: tokenProfile, outputTokens: tokenProfile }\r\n : tokenProfile\r\n ? (tokenProfile as TokenProfile)\r\n : getDefaultTokenProfile(category);\r\n return rankModels(models, profile, category, getDefaultWeights(weights));\r\n}\r\n\r\nexport function getSortedRecommendedModels(\r\n category: Category = \"chat\",\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number],\r\n tokenProfile?: TokenProfile | number | TokenSize\r\n): RankedModel[] {\r\n return getSortedRankedModel(RANKED_MODELS, category, weights, tokenProfile);\r\n}\r\n\r\nexport function getSortedRecommendedModelIds(\r\n category: Category = \"chat\",\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number],\r\n tokenProfile?: TokenProfile | number | TokenSize\r\n): string[] {\r\n return getSortedRankedModel(RANKED_MODELS, category, weights, tokenProfile).map(\r\n (model) => model.id\r\n );\r\n}\r\n\r\nexport function arrayToPseudoXML<T extends Record<string, unknown>>(\r\n array: readonly T[],\r\n keys: readonly (keyof T)[],\r\n name = \"item\"\r\n): string {\r\n return array\r\n .map(\r\n (item) =>\r\n `<${name}>${keys\r\n .map((key) => `<${String(key)}>${String(item[key])}</${String(key)}>`)\r\n .join(\"\\n\")}</${name}>`\r\n )\r\n .join(\"\\n\");\r\n}\r\n"],"mappings":"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"}
@@ -1,5 +1,27 @@
1
+ import { Category, RankedModel, SortType, TokenProfile, TokenSize } from "./ai.types.cjs";
2
+
1
3
  //#region src/modules/ai/ai.utils.d.ts
4
+ declare function getDefaultTokenProfile(category: Category): TokenProfile;
5
+ declare function getDefaultWeights(weights?: SortType | [SortType, SortType, SortType] | [number, number, number]): [number, number, number];
6
+ declare function weightsToPriceSensitivity(weights: [number, number, number]): number;
7
+ declare function addPriceScores(models: RankedModel[], profile: TokenProfile, priceSensitivity?: number): Array<RankedModel & {
8
+ price: number;
9
+ estimatedCost: number;
10
+ }>;
11
+ declare function rankModels(models: RankedModel[], profile: TokenProfile, category: Category, weights: [number, number, number]): {
12
+ score: number;
13
+ id: string;
14
+ inputCost: number;
15
+ outputCost: number;
16
+ quality: Record<Category, number>;
17
+ speed: number;
18
+ price: number;
19
+ estimatedCost: number;
20
+ }[];
21
+ declare function getSortedRankedModel(models: RankedModel[], category?: Category, weights?: SortType | [SortType, SortType, SortType] | [number, number, number], tokenProfile?: TokenProfile | number | TokenSize): RankedModel[];
22
+ declare function getSortedRecommendedModels(category?: Category, weights?: SortType | [SortType, SortType, SortType] | [number, number, number], tokenProfile?: TokenProfile | number | TokenSize): RankedModel[];
23
+ declare function getSortedRecommendedModelIds(category?: Category, weights?: SortType | [SortType, SortType, SortType] | [number, number, number], tokenProfile?: TokenProfile | number | TokenSize): string[];
2
24
  declare function arrayToPseudoXML<T extends Record<string, unknown>>(array: readonly T[], keys: readonly (keyof T)[], name?: string): string;
3
25
  //#endregion
4
- export { arrayToPseudoXML };
26
+ export { addPriceScores, arrayToPseudoXML, getDefaultTokenProfile, getDefaultWeights, getSortedRankedModel, getSortedRecommendedModelIds, getSortedRecommendedModels, rankModels, weightsToPriceSensitivity };
5
27
  //# sourceMappingURL=ai.utils.d.cts.map
@@ -1,5 +1,27 @@
1
+ import { Category, RankedModel, SortType, TokenProfile, TokenSize } from "./ai.types.mjs";
2
+
1
3
  //#region src/modules/ai/ai.utils.d.ts
4
+ declare function getDefaultTokenProfile(category: Category): TokenProfile;
5
+ declare function getDefaultWeights(weights?: SortType | [SortType, SortType, SortType] | [number, number, number]): [number, number, number];
6
+ declare function weightsToPriceSensitivity(weights: [number, number, number]): number;
7
+ declare function addPriceScores(models: RankedModel[], profile: TokenProfile, priceSensitivity?: number): Array<RankedModel & {
8
+ price: number;
9
+ estimatedCost: number;
10
+ }>;
11
+ declare function rankModels(models: RankedModel[], profile: TokenProfile, category: Category, weights: [number, number, number]): {
12
+ score: number;
13
+ id: string;
14
+ inputCost: number;
15
+ outputCost: number;
16
+ quality: Record<Category, number>;
17
+ speed: number;
18
+ price: number;
19
+ estimatedCost: number;
20
+ }[];
21
+ declare function getSortedRankedModel(models: RankedModel[], category?: Category, weights?: SortType | [SortType, SortType, SortType] | [number, number, number], tokenProfile?: TokenProfile | number | TokenSize): RankedModel[];
22
+ declare function getSortedRecommendedModels(category?: Category, weights?: SortType | [SortType, SortType, SortType] | [number, number, number], tokenProfile?: TokenProfile | number | TokenSize): RankedModel[];
23
+ declare function getSortedRecommendedModelIds(category?: Category, weights?: SortType | [SortType, SortType, SortType] | [number, number, number], tokenProfile?: TokenProfile | number | TokenSize): string[];
2
24
  declare function arrayToPseudoXML<T extends Record<string, unknown>>(array: readonly T[], keys: readonly (keyof T)[], name?: string): string;
3
25
  //#endregion
4
- export { arrayToPseudoXML };
26
+ export { addPriceScores, arrayToPseudoXML, getDefaultTokenProfile, getDefaultWeights, getSortedRankedModel, getSortedRecommendedModelIds, getSortedRecommendedModels, rankModels, weightsToPriceSensitivity };
5
27
  //# sourceMappingURL=ai.utils.d.mts.map
@@ -1,8 +1,164 @@
1
+ import { RANKED_MODELS } from "./ai.models.contsants.mjs";
2
+ import { TOKEN_PRESETS } from "./ai.constants.mjs";
1
3
  //#region src/modules/ai/ai.utils.ts
4
+ function getDefaultTokenProfile(category) {
5
+ switch (category) {
6
+ case "structured_output": return {
7
+ inputTokens: TOKEN_PRESETS.lg,
8
+ outputTokens: TOKEN_PRESETS.md
9
+ };
10
+ case "creative": return {
11
+ inputTokens: TOKEN_PRESETS.md,
12
+ outputTokens: TOKEN_PRESETS.lg
13
+ };
14
+ case "research": return {
15
+ inputTokens: TOKEN_PRESETS.xl,
16
+ outputTokens: TOKEN_PRESETS.xl
17
+ };
18
+ case "chat": return {
19
+ inputTokens: TOKEN_PRESETS.sm,
20
+ outputTokens: TOKEN_PRESETS.md
21
+ };
22
+ case "tool_use": return {
23
+ inputTokens: TOKEN_PRESETS.md,
24
+ outputTokens: TOKEN_PRESETS.sm
25
+ };
26
+ case "planning": return {
27
+ inputTokens: TOKEN_PRESETS.lg,
28
+ outputTokens: TOKEN_PRESETS.lg
29
+ };
30
+ case "classification": return {
31
+ inputTokens: TOKEN_PRESETS.sm,
32
+ outputTokens: TOKEN_PRESETS.xs
33
+ };
34
+ default: return {
35
+ inputTokens: TOKEN_PRESETS.md,
36
+ outputTokens: TOKEN_PRESETS.md
37
+ };
38
+ }
39
+ }
40
+ function getDefaultWeights(weights) {
41
+ if (Array.isArray(weights)) return weights.every((weight) => typeof weight === "number") ? weights : weights.reduce((acc, weight, index) => {
42
+ switch (weight) {
43
+ case "quality":
44
+ acc[0] = index === 0 ? 50 : index === 1 ? 30 : 20;
45
+ break;
46
+ case "price":
47
+ acc[1] = index === 0 ? 50 : index === 1 ? 30 : 20;
48
+ break;
49
+ case "speed":
50
+ acc[2] = index === 0 ? 50 : index === 1 ? 30 : 20;
51
+ break;
52
+ }
53
+ return acc;
54
+ }, [
55
+ 20,
56
+ 50,
57
+ 30
58
+ ]);
59
+ switch (weights) {
60
+ case "quality": return [
61
+ 50,
62
+ 30,
63
+ 20
64
+ ];
65
+ case "price": return [
66
+ 20,
67
+ 50,
68
+ 30
69
+ ];
70
+ case "speed": return [
71
+ 20,
72
+ 30,
73
+ 50
74
+ ];
75
+ default: return [
76
+ 50,
77
+ 25,
78
+ 25
79
+ ];
80
+ }
81
+ }
82
+ function weightsToPriceSensitivity(weights) {
83
+ const [qualityWeight, priceWeight, speedWeight] = weights;
84
+ const total = qualityWeight + priceWeight + speedWeight;
85
+ if (total <= 0) return 1;
86
+ const normalizedPriceWeight = priceWeight / total;
87
+ const min = .55;
88
+ const max = 1.75;
89
+ const sensitivity = max - normalizedPriceWeight * (max - min);
90
+ return Number(sensitivity.toFixed(3));
91
+ }
92
+ function addPriceScores(models, profile, priceSensitivity = 1) {
93
+ const costs = models.map((model) => {
94
+ return profile.inputTokens / 1e6 * model.inputCost + profile.outputTokens / 1e6 * model.outputCost;
95
+ });
96
+ const cheapest = Math.min(...costs);
97
+ const mostExpensive = Math.max(...costs);
98
+ return models.map((model, index) => {
99
+ const cost = costs[index];
100
+ if (mostExpensive === cheapest) return {
101
+ ...model,
102
+ estimatedCost: cost,
103
+ price: 10
104
+ };
105
+ const safeCheapest = Math.max(cheapest, Number.EPSILON);
106
+ const safeCost = Math.max(cost, Number.EPSILON);
107
+ const safeMostExpensive = Math.max(mostExpensive, Number.EPSILON);
108
+ const logMin = Math.log(safeCheapest);
109
+ const logMax = Math.log(safeMostExpensive);
110
+ const normalized = ((Math.log(safeCost) - logMin) / (logMax - logMin)) ** priceSensitivity;
111
+ return {
112
+ ...model,
113
+ estimatedCost: cost,
114
+ price: Math.round(10 - normalized * 9)
115
+ };
116
+ });
117
+ }
118
+ function clampScore(value) {
119
+ return Math.max(1, Math.min(10, value));
120
+ }
121
+ function shapeScoreByWeight(value, weight, maxWeight) {
122
+ const normalized = clampScore(value) / 10;
123
+ if (maxWeight <= 0 || weight <= 0) return 0;
124
+ const importance = (weight / maxWeight) ** 2;
125
+ const expanded = normalized ** 2 * 10;
126
+ const compressed = 8 + normalized * 2;
127
+ return compressed + (expanded - compressed) * importance;
128
+ }
129
+ function rankModels(models, profile, category, weights) {
130
+ const scoredModels = addPriceScores(models, profile, weightsToPriceSensitivity(weights));
131
+ const [qualityWeight, priceWeight, speedWeight] = weights;
132
+ const maxWeight = Math.max(qualityWeight, priceWeight, speedWeight);
133
+ return scoredModels.map((model) => {
134
+ const qualityScore = shapeScoreByWeight(model.quality[category], qualityWeight, maxWeight);
135
+ const priceScore = shapeScoreByWeight(model.price, priceWeight, maxWeight);
136
+ const speedScore = shapeScoreByWeight(model.speed, speedWeight, maxWeight);
137
+ return {
138
+ ...model,
139
+ score: qualityScore * qualityWeight + priceScore * priceWeight + speedScore * speedWeight
140
+ };
141
+ }).sort((a, b) => b.score - a.score);
142
+ }
143
+ function getSortedRankedModel(models, category = "chat", weights, tokenProfile) {
144
+ return rankModels(models, typeof tokenProfile === "string" ? {
145
+ inputTokens: TOKEN_PRESETS[tokenProfile],
146
+ outputTokens: TOKEN_PRESETS[tokenProfile]
147
+ } : typeof tokenProfile === "number" ? {
148
+ inputTokens: tokenProfile,
149
+ outputTokens: tokenProfile
150
+ } : tokenProfile ? tokenProfile : getDefaultTokenProfile(category), category, getDefaultWeights(weights));
151
+ }
152
+ function getSortedRecommendedModels(category = "chat", weights, tokenProfile) {
153
+ return getSortedRankedModel(RANKED_MODELS, category, weights, tokenProfile);
154
+ }
155
+ function getSortedRecommendedModelIds(category = "chat", weights, tokenProfile) {
156
+ return getSortedRankedModel(RANKED_MODELS, category, weights, tokenProfile).map((model) => model.id);
157
+ }
2
158
  function arrayToPseudoXML(array, keys, name = "item") {
3
159
  return array.map((item) => `<${name}>${keys.map((key) => `<${String(key)}>${String(item[key])}</${String(key)}>`).join("\n")}</${name}>`).join("\n");
4
160
  }
5
161
  //#endregion
6
- export { arrayToPseudoXML };
162
+ export { addPriceScores, arrayToPseudoXML, getDefaultTokenProfile, getDefaultWeights, getSortedRankedModel, getSortedRecommendedModelIds, getSortedRecommendedModels, rankModels, weightsToPriceSensitivity };
7
163
 
8
164
  //# sourceMappingURL=ai.utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai.utils.mjs","names":[],"sources":["../../../../src/modules/ai/ai.utils.ts"],"sourcesContent":["export function arrayToPseudoXML<T extends Record<string, unknown>>(\r\n array: readonly T[],\r\n keys: readonly (keyof T)[],\r\n name = \"item\"\r\n): string {\r\n return array\r\n .map(\r\n (item) =>\r\n `<${name}>${keys\r\n .map((key) => `<${String(key)}>${String(item[key])}</${String(key)}>`)\r\n .join(\"\\n\")}</${name}>`\r\n )\r\n .join(\"\\n\");\r\n}\r\n"],"mappings":";AAAA,SAAgB,iBACd,OACA,MACA,OAAO,QACC;AACR,QAAO,MACJ,KACE,SACC,IAAI,KAAK,GAAG,KACT,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CACrE,KAAK,KAAK,CAAC,IAAI,KAAK,GAC1B,CACA,KAAK,KAAK"}
1
+ {"version":3,"file":"ai.utils.mjs","names":[],"sources":["../../../../src/modules/ai/ai.utils.ts"],"sourcesContent":["import { RANKED_MODELS, TOKEN_PRESETS } from \"./ai.constants\";\r\nimport type { Category, RankedModel, SortType, TokenProfile, TokenSize } from \"./ai.types\";\r\n\r\nexport function getDefaultTokenProfile(category: Category): TokenProfile {\r\n switch (category) {\r\n case \"structured_output\":\r\n return { inputTokens: TOKEN_PRESETS.lg, outputTokens: TOKEN_PRESETS.md };\r\n case \"creative\":\r\n return { inputTokens: TOKEN_PRESETS.md, outputTokens: TOKEN_PRESETS.lg };\r\n case \"research\":\r\n return { inputTokens: TOKEN_PRESETS.xl, outputTokens: TOKEN_PRESETS.xl };\r\n case \"chat\":\r\n return { inputTokens: TOKEN_PRESETS.sm, outputTokens: TOKEN_PRESETS.md };\r\n case \"tool_use\":\r\n return { inputTokens: TOKEN_PRESETS.md, outputTokens: TOKEN_PRESETS.sm };\r\n case \"planning\":\r\n return { inputTokens: TOKEN_PRESETS.lg, outputTokens: TOKEN_PRESETS.lg };\r\n case \"classification\":\r\n return { inputTokens: TOKEN_PRESETS.sm, outputTokens: TOKEN_PRESETS.xs };\r\n default:\r\n return { inputTokens: TOKEN_PRESETS.md, outputTokens: TOKEN_PRESETS.md };\r\n }\r\n}\r\n\r\nexport function getDefaultWeights(\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number]\r\n): [number, number, number] {\r\n if (Array.isArray(weights)) {\r\n return weights.every((weight) => typeof weight === \"number\")\r\n ? weights\r\n : weights.reduce<[number, number, number]>(\r\n (acc, weight, index) => {\r\n switch (weight) {\r\n case \"quality\":\r\n acc[0] = index === 0 ? 50 : index === 1 ? 30 : 20;\r\n break;\r\n case \"price\":\r\n acc[1] = index === 0 ? 50 : index === 1 ? 30 : 20;\r\n break;\r\n case \"speed\":\r\n acc[2] = index === 0 ? 50 : index === 1 ? 30 : 20;\r\n break;\r\n }\r\n return acc;\r\n },\r\n [20, 50, 30]\r\n );\r\n }\r\n switch (weights) {\r\n case \"quality\":\r\n return [50, 30, 20];\r\n case \"price\":\r\n return [20, 50, 30];\r\n case \"speed\":\r\n return [20, 30, 50];\r\n default:\r\n return [50, 25, 25];\r\n }\r\n}\r\n\r\nexport function weightsToPriceSensitivity(weights: [number, number, number]): number {\r\n const [qualityWeight, priceWeight, speedWeight] = weights;\r\n\r\n const total = qualityWeight + priceWeight + speedWeight;\r\n\r\n if (total <= 0) {\r\n return 1;\r\n }\r\n\r\n const normalizedPriceWeight = priceWeight / total;\r\n\r\n const min = 0.55; // very price-sensitive\r\n const max = 1.75; // price is soft / secondary\r\n\r\n // Higher price weight -> lower exponent -> stronger price penalty.\r\n const sensitivity = max - normalizedPriceWeight * (max - min);\r\n\r\n return Number(sensitivity.toFixed(3));\r\n}\r\n\r\nexport function addPriceScores(\r\n models: RankedModel[],\r\n profile: TokenProfile,\r\n priceSensitivity = 1\r\n): Array<RankedModel & { price: number; estimatedCost: number }> {\r\n const costs = models.map((model) => {\r\n return (\r\n (profile.inputTokens / 1_000_000) * model.inputCost +\r\n (profile.outputTokens / 1_000_000) * model.outputCost\r\n );\r\n });\r\n\r\n const cheapest = Math.min(...costs);\r\n const mostExpensive = Math.max(...costs);\r\n\r\n return models.map((model, index) => {\r\n const cost = costs[index];\r\n\r\n if (mostExpensive === cheapest) {\r\n return {\r\n ...model,\r\n estimatedCost: cost,\r\n price: 10,\r\n };\r\n }\r\n\r\n const safeCheapest = Math.max(cheapest, Number.EPSILON);\r\n const safeCost = Math.max(cost, Number.EPSILON);\r\n const safeMostExpensive = Math.max(mostExpensive, Number.EPSILON);\r\n\r\n const logMin = Math.log(safeCheapest);\r\n const logMax = Math.log(safeMostExpensive);\r\n const logCost = Math.log(safeCost);\r\n\r\n const normalizedRaw = (logCost - logMin) / (logMax - logMin);\r\n\r\n // < 1 makes price matter less.\r\n // > 1 makes price matter more.\r\n const normalized = normalizedRaw ** priceSensitivity;\r\n\r\n return {\r\n ...model,\r\n estimatedCost: cost,\r\n price: Math.round(10 - normalized * 9),\r\n };\r\n });\r\n}\r\n\r\nfunction clampScore(value: number): number {\r\n return Math.max(1, Math.min(10, value));\r\n}\r\n\r\nfunction shapeScoreByWeight(value: number, weight: number, maxWeight: number): number {\r\n const score = clampScore(value);\r\n const normalized = score / 10;\r\n\r\n if (maxWeight <= 0 || weight <= 0) {\r\n return 0;\r\n }\r\n\r\n const importance = (weight / maxWeight) ** 2;\r\n const expanded = normalized ** 2 * 10;\r\n const compressed = 8 + normalized * 2;\r\n return compressed + (expanded - compressed) * importance;\r\n}\r\n\r\nexport function rankModels(\r\n models: RankedModel[],\r\n profile: TokenProfile,\r\n category: Category,\r\n weights: [number, number, number]\r\n) {\r\n const scoredModels = addPriceScores(models, profile, weightsToPriceSensitivity(weights));\r\n\r\n const [qualityWeight, priceWeight, speedWeight] = weights;\r\n const maxWeight = Math.max(qualityWeight, priceWeight, speedWeight);\r\n\r\n return scoredModels\r\n .map((model) => {\r\n const qualityScore = shapeScoreByWeight(model.quality[category], qualityWeight, maxWeight);\r\n\r\n const priceScore = shapeScoreByWeight(model.price, priceWeight, maxWeight);\r\n\r\n const speedScore = shapeScoreByWeight(model.speed, speedWeight, maxWeight);\r\n\r\n return {\r\n ...model,\r\n score: qualityScore * qualityWeight + priceScore * priceWeight + speedScore * speedWeight,\r\n };\r\n })\r\n .sort((a, b) => b.score - a.score);\r\n}\r\n\r\nexport function getSortedRankedModel(\r\n models: RankedModel[],\r\n category: Category = \"chat\",\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number],\r\n tokenProfile?: TokenProfile | number | TokenSize\r\n): RankedModel[] {\r\n const profile =\r\n typeof tokenProfile === \"string\"\r\n ? {\r\n inputTokens: TOKEN_PRESETS[tokenProfile as TokenSize],\r\n outputTokens: TOKEN_PRESETS[tokenProfile as TokenSize],\r\n }\r\n : typeof tokenProfile === \"number\"\r\n ? { inputTokens: tokenProfile, outputTokens: tokenProfile }\r\n : tokenProfile\r\n ? (tokenProfile as TokenProfile)\r\n : getDefaultTokenProfile(category);\r\n return rankModels(models, profile, category, getDefaultWeights(weights));\r\n}\r\n\r\nexport function getSortedRecommendedModels(\r\n category: Category = \"chat\",\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number],\r\n tokenProfile?: TokenProfile | number | TokenSize\r\n): RankedModel[] {\r\n return getSortedRankedModel(RANKED_MODELS, category, weights, tokenProfile);\r\n}\r\n\r\nexport function getSortedRecommendedModelIds(\r\n category: Category = \"chat\",\r\n weights?: SortType | [SortType, SortType, SortType] | [number, number, number],\r\n tokenProfile?: TokenProfile | number | TokenSize\r\n): string[] {\r\n return getSortedRankedModel(RANKED_MODELS, category, weights, tokenProfile).map(\r\n (model) => model.id\r\n );\r\n}\r\n\r\nexport function arrayToPseudoXML<T extends Record<string, unknown>>(\r\n array: readonly T[],\r\n keys: readonly (keyof T)[],\r\n name = \"item\"\r\n): string {\r\n return array\r\n .map(\r\n (item) =>\r\n `<${name}>${keys\r\n .map((key) => `<${String(key)}>${String(item[key])}</${String(key)}>`)\r\n .join(\"\\n\")}</${name}>`\r\n )\r\n .join(\"\\n\");\r\n}\r\n"],"mappings":"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"}
@@ -12,9 +12,9 @@ declare const notificationProviderSchema: z.ZodEnum<{
12
12
  fcm: "fcm";
13
13
  }>;
14
14
  declare const notificationSendStatusSchema: z.ZodEnum<{
15
+ failed: "failed";
15
16
  pending: "pending";
16
17
  sent: "sent";
17
- failed: "failed";
18
18
  }>;
19
19
  /** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */
20
20
  declare const pushSubscriptionJsonSchema: z.ZodObject<{
@@ -100,9 +100,9 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
100
100
  body: z.ZodString;
101
101
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
102
102
  status: z.ZodEnum<{
103
+ failed: "failed";
103
104
  pending: "pending";
104
105
  sent: "sent";
105
- failed: "failed";
106
106
  }>;
107
107
  error: z.ZodNullable<z.ZodString>;
108
108
  jobId: z.ZodNullable<z.ZodString>;
@@ -127,9 +127,9 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
127
127
  body: z.ZodString;
128
128
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
129
129
  status: z.ZodEnum<{
130
+ failed: "failed";
130
131
  pending: "pending";
131
132
  sent: "sent";
132
- failed: "failed";
133
133
  }>;
134
134
  error: z.ZodNullable<z.ZodString>;
135
135
  jobId: z.ZodNullable<z.ZodString>;
@@ -12,9 +12,9 @@ declare const notificationProviderSchema: z.ZodEnum<{
12
12
  fcm: "fcm";
13
13
  }>;
14
14
  declare const notificationSendStatusSchema: z.ZodEnum<{
15
+ failed: "failed";
15
16
  pending: "pending";
16
17
  sent: "sent";
17
- failed: "failed";
18
18
  }>;
19
19
  /** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */
20
20
  declare const pushSubscriptionJsonSchema: z.ZodObject<{
@@ -100,9 +100,9 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
100
100
  body: z.ZodString;
101
101
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
102
102
  status: z.ZodEnum<{
103
+ failed: "failed";
103
104
  pending: "pending";
104
105
  sent: "sent";
105
- failed: "failed";
106
106
  }>;
107
107
  error: z.ZodNullable<z.ZodString>;
108
108
  jobId: z.ZodNullable<z.ZodString>;
@@ -127,9 +127,9 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
127
127
  body: z.ZodString;
128
128
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
129
129
  status: z.ZodEnum<{
130
+ failed: "failed";
130
131
  pending: "pending";
131
132
  sent: "sent";
132
- failed: "failed";
133
133
  }>;
134
134
  error: z.ZodNullable<z.ZodString>;
135
135
  jobId: z.ZodNullable<z.ZodString>;