Conversation
… stubbed for testing as you no longer need a concrete Model or ModelVariant class. - Make Model and ModelVariant implementation details - Add variant info and selection to IModel so it works with either Model or ModelVariant - Move GetLatestVersion to Catalog and take IModel as input - ModelVariant has insufficient info to implement this and intuitively the catalog should know this information. - Update tests - fix usage of test config file for shared test data path
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
sdk/cs/src/Detail/ModelVariant.cs
Outdated
| if (variant != this) | ||
| { | ||
| // error message is consistent with Model.SelectVariant | ||
| throw new FoundryLocalException($"Input variant was not found in Variants."); | ||
| } |
There was a problem hiding this comment.
Not sure if it would be clearer to throw here to make the user aware it's a single variant and they need to call Catalog.GetModelAsync(variant.Alias) for this to be a meaningful option. I feel like that would avoid confusion given it should fail loudly during development if they call this.
There was a problem hiding this comment.
Updated in 889fd59. ModelVariant.SelectVariant now always throws a FoundryLocalException with a message directing the caller to use Catalog.GetModelAsync(alias) to get a Model with all variants available.
There was a problem hiding this comment.
Pull request overview
This PR refactors the C# SDK public surface area to use IModel/ICatalog instead of concrete Model/ModelVariant, adds variant selection info to IModel, and moves “latest version” lookup logic onto the catalog. It also updates tests and test configuration to align with the new abstractions.
Changes:
- Update
ICatalogAPIs to return/acceptIModeland introduceGetLatestVersionAsync(IModel, ...). - Expand
IModelwithInfo,Variants,SelectedVariant, andSelectVariant(IModel). - Adjust test setup/config and add/modify tests around catalog/model versioning behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cs/src/ICatalog.cs | Switches catalog API to IModel and adds GetLatestVersionAsync. |
| sdk/cs/src/IModel.cs | Adds Info and variant-selection surface to the public model interface. |
| sdk/cs/src/Catalog.cs | Implements updated ICatalog methods and adds latest-version lookup. |
| sdk/cs/src/Detail/Model.cs | Adapts concrete Model to new IModel variant APIs. |
| sdk/cs/src/Detail/ModelVariant.cs | Adapts ModelVariant to new IModel variant APIs. |
| sdk/cs/test/FoundryLocal.Tests/CatalogTests.cs | Adds unit test coverage for GetLatestVersionAsync. |
| sdk/cs/test/FoundryLocal.Tests/ModelTests.cs | Updates tests to new APIs (currently duplicates CatalogTests). |
| sdk/cs/test/FoundryLocal.Tests/ChatCompletionsTests.cs | Moves test state to IModel instead of Model. |
| sdk/cs/test/FoundryLocal.Tests/AudioClientTests.cs | Moves test state to IModel instead of Model. |
| sdk/cs/test/FoundryLocal.Tests/EndToEnd.cs | Uses catalog model retrieval + variant selection instead of new Model(...). |
| sdk/cs/test/FoundryLocal.Tests/TestAssemblySetupCleanup.cs | Makes cleanup resilient when the singleton manager wasn’t initialized. |
| sdk/cs/test/FoundryLocal.Tests/Utils.cs | Reads test model cache directory from config; improves error visibility when missing. |
| sdk/cs/test/FoundryLocal.Tests/appsettings.Test.json | Updates default test cache directory name. |
| sdk/cs/test/FoundryLocal.Tests/LOCAL_MODEL_TESTING.md | Updates docs for running local model tests (currently has rendering issues). |
Comments suppressed due to low confidence (2)
sdk/cs/src/Detail/Model.cs:15
- PR description says Model should become an implementation detail, but this type is still
publicin the main namespace. If the intent is to hide it from the public surface, consider making it internal (or moving it under a non-public namespace) and ensuring ICatalog/IModel are the only public entry points; otherwise, please update the PR description to reflect that Model remains a supported public type.
sdk/cs/src/Detail/ModelVariant.cs:26 - PR description mentions ModelVariant becoming an implementation detail, but it remains a public type and is still surfaced via the public namespace (even if returned as IModel). If the goal is to hide it, consider making it internal/non-public; otherwise update the PR description to avoid implying it’s no longer part of the supported surface area.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ctVariant error message Agent-Logs-Url: https://github.com/microsoft/Foundry-Local/sessions/b48314ac-0aa9-457e-a8ea-03edb0b835f3 Co-authored-by: skottmckay <979079+skottmckay@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Use IModel in the public API. Changes allow ICatalog and IModel to be stubbed for testing as you no longer need a concrete Model or ModelVariant class.