Repository navigation
feat(llm): abstract the LLM provider behind IChangelogModel - #41
Merged
Merged
Conversation
Introduce Chartula.Core with a domain-focused LLM seam the pipeline depends on (IChangelogModel: RephraseAsync, CheckFaithfulnessAsync), backed by a provider-agnostic Microsoft.Extensions.AI IChatClient. The only provider-specific code (Anthropic) lives in the CLI composition root, so swapping providers never touches the pipeline. API keys are read by environment-variable name from configuration, never hardcoded. Add Chartula.Core.Tests exercising the seam with a stub IChatClient, so the pipeline is verified without a live provider call.
5 tasks
This was referenced Sep 15, 2026
goldbarth
added a commit
that referenced
this pull request
Oct 1, 2026
… alone (#319) Follows #318, which added the ADR index and template. - **Why:** the reason the domain knows no model provider was argued in one bullet of `architecture.md`, in `CLAUDE.md`, and implied in `testing.md`, but recorded nowhere as a decision with its date and its cost. A contributor who wanted to call a provider feature from `Chartula.Core` found a rule without the reasons behind it. - **ADR 0004** records it in the template of #318: decided 2026-07-16 in #41 (for #2), recorded here. - **Context:** two operations need a model, both with structured output; the product promises several providers (#75); a domain tied to one SDK ties the pipeline to it, and lets a test of the domain reach a real model, which costs tokens, needs a key and depends on the model. - **Decision:** `Chartula.Core` references `Microsoft.Extensions.AI` alone, `ChatModel` sends to an `IChatClient`, the provider packages are referenced by `Chartula.Cli` alone, and what the domain asks of a model is expressed in `Microsoft.Extensions.AI` terms. Provider knowledge such as `ClaudeThinkingSupport` stays in `Cli/Composition`. - **Consequences, precise about the tests:** `Chartula.Core.Tests` cannot reach a model by construction. `Chartula.Cli.Tests` does reference the SDKs, on purpose, and stays offline because its tests replace the network, not because of its references; the ADR says so rather than claiming the whole suite is safe by construction. Also: a provider joins in the composition root (#88 changed no file in `Chartula.Core`), the domain is limited to what `IChatClient` expresses, a provider package is weighed for trimming (ADR 0002), and referencing one from `Core` or `Infrastructure` starts as an issue. - **`architecture.md`** keeps the choice as one line and links the ADR instead of arguing it; **`testing.md`** links the ADR for why no Core test can reach a model. - The index in `adr/README.md` lists 0004. **Verified:** - The references were read from the project files: `Chartula.Core.csproj` holds `Microsoft.Extensions.AI` and nothing else; `Anthropic` and `Microsoft.Extensions.AI.OpenAI` are in `Chartula.Cli.csproj` only; `Chartula.Cli.Tests` references `Chartula.Cli`. - The decision date and pull request from `git log -S IChatClient` and #41's description; the provider promise from the decision comment on #75; that #88 touched no file in `src/Chartula.Core` from its diff. - `GetResponseAsync<T>`, `ReasoningOptions` and `UsageDetails` as used in `ChatModel.cs` and `ChatModelOptions.cs`. - Every relative link and anchor in all Markdown files of the repository resolves (script, with a negative test). Tests: none, documentation only.
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.
Closes #2
What
Adds the provider-agnostic LLM seam the pipeline builds on.
Chartula.Core(new): the domain-focused seam.IChangelogModel- the interface the pipeline depends on (RephraseAsync,CheckFaithfulnessAsync).ChatModel- the single implementation, backed by a provider-agnosticMicrosoft.Extensions.AI.IChatClient.Audience,GroundedFacts,RephraseRequest,FaithfulnessRequest,FaithfulnessReport.Chartula.Cli: composition root wiring Anthropic as the first provider (AsIChatClient), model + provider selectable via config, API key read by env-var name. This is the only provider-specific code.Chartula.Core.Tests(new): 5 tests exercising the seam with a stubIChatClient- no live provider call.Acceptance criteria
Notes
IChatClient). Swapping providers is a composition-root change only.GroundedFactsand theChatModelprompts are intentionally minimal placeholders; the fact base and prompt design are their own issues.Build: 0 warnings / 0 errors.
dotnet test: 5/5 green.