From 9b68c8f58c6db7aadb66cf9ad342f08a657396ba Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Thu, 22 Jan 2026 01:04:08 -0800 Subject: [PATCH] CC: slashcommands: update llms:ollama --- .claude/commands/llms/update-models-ollama.md | 8 ++++---- .claude/scripts/parse-ollama-models.js | 16 ++++++++++------ src/modules/llms/server/ollama/ollama.models.ts | 8 ++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.claude/commands/llms/update-models-ollama.md b/.claude/commands/llms/update-models-ollama.md index fb1986da9..c0ecec142 100644 --- a/.claude/commands/llms/update-models-ollama.md +++ b/.claude/commands/llms/update-models-ollama.md @@ -8,8 +8,8 @@ Reference `src/modules/llms/server/llm.server.types.ts` and `src/modules/llms/se **Automated Workflow:** ```bash -# 1. Fetch the HTML -curl -s "https://ollama.com/library?sort=featured" -o /tmp/ollama-featured.html +# 1. Fetch the HTML (sorted by newest for stable ordering) +curl -s "https://ollama.com/library?sort=newest" -o /tmp/ollama-newest.html # 2. Parse it with the script node .claude/scripts/parse-ollama-models.js > /tmp/ollama-parsed.txt 2>&1 @@ -22,7 +22,7 @@ The parser outputs: `modelName|pulls|capabilities|sizes` - Example: `deepseek-r1|66200000|tools,thinking|1.5b,7b,8b,14b,32b,70b,671b` **Primary Sources:** -- Model Library: https://ollama.com/library?sort=featured +- Model Library: https://ollama.com/library?sort=newest - Parser script: `.claude/scripts/parse-ollama-models.js` **Fallbacks if blocked:** Check https://github.com/ollama/ollama, search "ollama featured models", "ollama latest models", or search GitHub for latest model info @@ -30,7 +30,7 @@ The parser outputs: `modelName|pulls|capabilities|sizes` **Important:** - Skip models below 50,000 pulls (parser does this automatically) - Skip embedding models (parser does not do this automatically) -- Sort them in the EXACT same order as the source (featured models) +- Sort them in the EXACT same order as the source (newest first, for stable ordering) - Extract tags: 'tools' → hasTools, 'vision' → hasVision, 'embedding' → isEmbeddings (note the 's'), 'thinking' → tags only - Extract 'b' tags (1.5b, 7b, 32b) to tags field - Set today's date (YYYYMMDD format) for newly added models only diff --git a/.claude/scripts/parse-ollama-models.js b/.claude/scripts/parse-ollama-models.js index 6cc99358c..21695cea8 100755 --- a/.claude/scripts/parse-ollama-models.js +++ b/.claude/scripts/parse-ollama-models.js @@ -1,23 +1,28 @@ #!/usr/bin/env node /** - * Parse Ollama featured models from HTML + * Parse Ollama models from HTML (sorted by newest for stable ordering) * * Usage: - * 1. Fetch HTML: curl -s "https://ollama.com/library?sort=featured" -o /tmp/ollama-featured.html + * 1. Fetch HTML: curl -s "https://ollama.com/library?sort=newest" -o /tmp/ollama-newest.html * 2. Parse: node .claude/scripts/parse-ollama-models.js * * Outputs: pipe-delimited format: modelName|pulls|capabilities|sizes * Example: deepseek-r1|66200000|tools,thinking|1.5b,7b,8b,14b,32b,70b,671b + * + * Pull counts are rounded to significant figures for stable diffs: + * - >=10M: round to 100K (e.g., 109,123,456 -> 109,100,000) + * - >=1M: round to 10K (e.g., 5,432,100 -> 5,430,000) + * - <1M: round to 1K (e.g., 88,700 -> 89,000) */ const fs = require('fs'); -const htmlPath = process.argv[2] || '/tmp/ollama-featured.html'; +const htmlPath = process.argv[2] || '/tmp/ollama-newest.html'; if (!fs.existsSync(htmlPath)) { console.error(`Error: HTML file not found at ${htmlPath}`); console.error('Please fetch it first with:'); - console.error(' curl -s "https://ollama.com/library?sort=featured" -o /tmp/ollama-featured.html'); + console.error(' curl -s "https://ollama.com/library?sort=newest" -o /tmp/ollama-newest.html'); process.exit(1); } @@ -78,8 +83,7 @@ for (let i = 1; i < modelSections.length; i++) { function roundPulls(pulls) { if (pulls >= 10000000) return Math.round(pulls / 100000) * 100000; // >=10M: round to 100K if (pulls >= 1000000) return Math.round(pulls / 10000) * 10000; // >=1M: round to 10K - if (pulls >= 100000) return Math.round(pulls / 1000) * 1000; // >=100K: round to 1K - return pulls; + return Math.round(pulls / 1000) * 1000; // <1M: round to 1K } // Output in pipe-delimited format (in the order they appear on the page) diff --git a/src/modules/llms/server/ollama/ollama.models.ts b/src/modules/llms/server/ollama/ollama.models.ts index cce00f6ab..3a44bd2cf 100644 --- a/src/modules/llms/server/ollama/ollama.models.ts +++ b/src/modules/llms/server/ollama/ollama.models.ts @@ -5,10 +5,10 @@ * * <<< Can you modify the following data structure, according to the updated information from the attached - web page(https://ollama.ai/library?sort=featured). Be very thorough, do not skip any lines, both in - the provided file and in the web page. Add/remove to reflect the order in the web page, update - the *description* and *pulls*, and preserve the existing *added* field on existing entries, or set - it to 20250312 on brand new entries. Note: the default contextWindow in code is 8192, so we do not redefine that. + web page (https://ollama.com/library?sort=newest). Be very thorough, do not skip any lines, both in + the provided file and in the web page. Add/remove to reflect the order in the web page (newest first), + update the *pulls*, and preserve the existing *added* field on existing entries, or set it to today's + date (YYYYMMDD) on brand new entries. Note: the default contextWindow in code is 8192, so we do not redefine that. >>> */ export const OLLAMA_BASE_MODELS: { [key: string]: { pulls: number, contextWindow?: number, hasTools?: true, hasVision?: true, isEmbeddings?: true, tags?: string[], added?: string } } = {