Migrate tagging CLI from Gemini to OpenRouter with structured output#207
Merged
Conversation
The tagging CLI now reaches its model through OpenRouter (an OpenAI-compatible aggregator) via Microsoft.Extensions.AI, so the backend model is a one-line config change. Responses are schema-bound structured output, which retires the hand-rolled JSON-fence parser and makes parse failures during an unattended batch essentially impossible. Tagging now runs on the English body — translations come from stronger models than the source-language originals — so the prompts and tag vocabulary descriptions are de-Slovaked and sharpened so the Area is judged from mathematical content, not surface keywords. Adds opt-in reasoning effort (default medium, the sweet spot from an effort sweep), a --retag flag to redo a whole folder, per-pass timing and round-cost logging off the key's spend, a thread-safe CliLog, and a short retry around the occasional OpenRouter routing hiccup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Moves the draft-tagging CLI off the bespoke Gemini HTTP client and onto OpenRouter (an OpenAI-compatible aggregator) through
Microsoft.Extensions.AI. The backend model is now a one-lineappsettings.jsonchange.What changed
IChatClient—Program.csbuilds anOpenAI.Chat.ChatClientpointed at OpenRouter and exposes it asIChatClient;OpenRouterSettingsholds base URL + model (appsettings) and the API key (user secrets). The oldGeminiService/IGeminiService/AddGemini/AiModelConfigare deleted.GetResponseAsync<T>(useJsonSchemaResponseFormat: true), retiring the hand-rolled markdown-fence parser (TaggingHelpers) and its parse-failure modes. System message carries the constant instructions + candidate vocabulary (cacheable); the problem rides in the user message.approved-tags.jsondescriptions are de-Slovaked and sharpened so the Area is judged from mathematical content, not surface keywords (e.g. integers alone ≠ Number Theory; a grid is just a container).ReasoningEffortpatched into the request body viaRawRepresentationFactory; defaults tomedium(the sweet spot from an effort sweep).--retag— redoes a whole folder, stripping and rewriting each sidecar's tags block (with a strip-then-append round-trip covered by tests).CliLog, and a short retry around the occasional OpenRouter routing hiccup.Notes
dotnet format/jb inspectcodeclean; full suite (257 tests) green.🤖 Generated with Claude Code