Skip to content

Refresh the models list, add some tooling for dynamically pulling the static list#22

Closed
cmbrose wants to merge 5 commits intotonybaloney:mainfrom
cmbrose:cmbrose/model-refresh
Closed

Refresh the models list, add some tooling for dynamically pulling the static list#22
cmbrose wants to merge 5 commits intotonybaloney:mainfrom
cmbrose:cmbrose/model-refresh

Conversation

@cmbrose
Copy link
Copy Markdown
Contributor

@cmbrose cmbrose commented May 19, 2025

Fixes #19 (as a side effect 😄)

(Generated by git diff forked/main parse_models_json.py refresh_models_json.py ../llm_github_models.py | llm -m github/o3-mini "Summarize this git diff into a PR body")

This PR makes several enhancements and additions to the GitHub models integration and associated tooling:

  1. Changes in llm_github_models.py:
     • The chat models list (CHAT_MODELS) has been updated to include an extra field, api_version. Each model tuple now contains: model name, whether it supports streaming, input modalities, output modalities, and the API version (set to None by default or a preview version for select models like "o3", "o3-mini", and "o4-mini").
     • The register_models function now unpacks this extra api_version field and passes it to the GitHubModels constructor.
     • In the GitHubModels class, the api_version is stored and used to add an extra key in the client call, replacing the previous hardcoded logic for "o3-mini".
     • Minor formatting improvements (e.g., in the attachment_as_content_item and build_messages functions) help with clarity and maintainability.

  2. Updates in tools/parse_models_json.py:
     • The script now categorizes models from models.json into “chat-completion”, “embeddings”, and “unknown” buckets.
     • For chat models, the tuple now includes the new api_version field determined via a helper function. For embeddings, an extra dimensions list is added (for example, [256, 1024] or [512] for specific models).
     • The function supports_streaming has been updated to mark additional models (such as "o3", "o4-mini") as not supporting streaming.
     • The script generates a Markdown fragment (“models.fragment.md”) that documents model details. It now produces separate sections for supported chat models and embedding models, including images, usage information, publisher details, and a formatted description.

  3. New script: tools/refresh_models_json.py:
     • This new utility fetches the latest models catalog from the GitHub API using a valid GITHUB_TOKEN.
     • It builds URLs for model detail pages and scrapes each model’s JSON details (using BeautifulSoup) from the GitHub Marketplace.
     • The resulting list of models is sorted and written to a models.json file.
     • This script facilitates periodically refreshing local metadata without waiting for a live API.

Overall, these changes improve model metadata management by adding versioning support and richer attributes, automate documentation generation through Markdown fragments, and provide a new tool for updating the models catalog by combining API calls with web scraping.

@cmbrose
Copy link
Copy Markdown
Contributor Author

cmbrose commented May 19, 2025

Looking through the PRs, this definitely collides with #18 and #9. Closing this one out in favor of aligning with those others.

@cmbrose cmbrose closed this May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown model: github/mistral-large

1 participant