Add LLM model registry with OpenRouter auto-generation#1033
Closed
aureliensibiril wants to merge 12 commits intogetprobo:mainfrom
Closed
Add LLM model registry with OpenRouter auto-generation#1033aureliensibiril wants to merge 12 commits intogetprobo:mainfrom
aureliensibiril wants to merge 12 commits intogetprobo:mainfrom
Conversation
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/cmd/genmodels/main.go">
<violation number="1" location="internal/cmd/genmodels/main.go:165">
P2: Generator can overwrite `registry_gen.go` with an empty registry because it never validates that any models were retained before writing.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
ModelDefinition, SupportedParameters, and Registry types with multi-key lookup supporting canonical, bare, and normalized model IDs. NewRegistry constructor accepts model definitions for testability; DefaultRegistry caches the generated data. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Fetches model metadata from the OpenRouter API and generates pkg/llm/registry_gen.go with typed ModelDefinition entries. Covers 9 providers: Anthropic, OpenAI, Google, xAI, Perplexity, Amazon, Meta, Mistral, DeepSeek. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
177 models across 9 providers fetched from OpenRouter. This file is generated by go generate and committed to avoid requiring an API call at build time. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Lookup by canonical ID, bare name, and normalized form. Capability assertions for Claude, GPT-5.4, and o3. Edge cases for empty string and provider-prefix-only inputs. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Always write both true and false values in the generated registry so unsupported parameters are visible at a glance instead of relying on Go zero-value defaults. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
6af0c03 to
248601b
Compare
Replaces []ModelDefinition with map[string]ModelDefinition so model ID uniqueness is enforced by the data structure itself and lookups do not require a linear scan. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Build registries from inline map literals instead of relying on generated OpenRouter data that can change between runs. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
The model registry fetches from an external API so it should not run as part of the regular generate/build pipeline. Replace the automatic generate dependency with a standalone genmodels target. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
The provider is always the prefix before "/" in the model ID, so storing it as a separate field is redundant. Replace the field with a Provider() method. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
Contributor
|
Merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/llm) so the agent framework knows what parameters each model supports — foundation for config validationgo generate ./pkg/llm/fetches model data from OpenRouter (free, no API key) and writesregistry_gen.gowith 177 models across 9 providersRegistry.Lookup()accepts canonical IDs (anthropic/claude-opus-4.6), bare names (claude-opus-4.6), and normalized forms (claude-opus-4-6)Test plan
go test ./pkg/llm/ -racepasses (9 tests: lookup variants, capability assertions, edge cases)go build ./pkg/llm/andgo build ./internal/cmd/genmodels/compile cleanlygo vetcleangofmtcleanSummary by cubic
Adds a typed LLM model registry with OpenRouter-based auto-generation and a committed dataset for offline builds. Lookups are fast and accept canonical, bare, and normalized IDs.
New Features
pkg/llmregistry withModelDefinition,SupportedParameters, andRegistry.Lookup();NewRegistry()allows custom registries;DefaultRegistry()caches generated data.internal/cmd/genmodels; added//go:generateinpkg/llmand updatedmake genmodelsto rungo generate ./pkg/llmto fetch OpenRouter models (no API key) and writepkg/llm/registry_gen.gowith explicit true/false flags; covers 177 models across 9 providers; no build-time API calls;cleanremovesregistry_gen.go.Refactors
map[string]ModelDefinitionfor O(1) lookups and ID uniqueness.ModelDefinition.Provider()to derive the provider from the model ID.Written for commit 7aaff30. Summary will update on new commits.