You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Propagate IModel API changes across Python, JS, Rust SDKs and update C# docs (#565)
Mirrors the C# changes from #556 across all language bindings: public
APIs use the `IModel` interface instead of concrete
`Model`/`ModelVariant` types, `GetLatestVersion` moves from `Model` to
`Catalog`, and `ModelVariant` becomes an implementation detail.
### IModel interface extended (Python, JS)
- Added `info`, `variants`, `selected_variant`/`selectedVariant`,
`select_variant`/`selectVariant` to the abstract interface
- `ModelVariant` implements these as self-referential
(`variants=[self]`, `selected_variant=self`, `select_variant` throws)
```python
# Python - IModel now exposes variant info
model = catalog.get_model("qwen2.5-0.5b")
for v in model.variants: # List[IModel], not List[ModelVariant]
print(v.info.name, v.id)
model.select_variant(v) # takes IModel, not ModelVariant
latest = catalog.get_latest_version(model) # moved from Model to Catalog
```
### Catalog return types changed (Python, JS)
- `list_models()` → `List[IModel]` (was `List[Model]`)
- `get_model()` → `Optional[IModel]` (was `Optional[Model]`)
- `get_model_variant()` → `Optional[IModel]` (was
`Optional[ModelVariant]`)
- `get_cached_models()` / `get_loaded_models()` → `List[IModel]` (was
`List[ModelVariant]`)
### `get_latest_version` added to Catalog (Python, JS, Rust)
Moved from `Model` to `Catalog` since `ModelVariant` lacks sufficient
context to implement it. Takes any `IModel` and resolves the latest
version by name matching against the variant list.
### Rust SDK
- Added `Model::info()` (delegates to selected variant)
- Added `Catalog::get_latest_version(&self, model: &Arc<Model>) ->
Result<Arc<ModelVariant>>`
### C# docs and samples updated
- README, API docs (`ICatalog`, `IModel`, `Model`, `ModelVariant`)
updated to reflect `IModel` return types
- `ModelVariant` docs marked as internal
- Samples updated to avoid direct `ModelVariant` type references
- `GetLatestVersionAsync` added to `ICatalog` docs
---------
Co-authored-by: Baiju Meswani <bmeswani@microsoft.com>
Co-authored-by: Nenad Banfic <46795300+nenad1002@users.noreply.github.com>
Copy file name to clipboardExpand all lines: sdk/cs/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,11 +181,11 @@ var loaded = await catalog.GetLoadedModelsAsync();
181
181
182
182
### Model Lifecycle
183
183
184
-
Each `Model` wraps one or more `ModelVariant` entries (different quantizations, hardware targets). The SDK auto-selects the best variant, or you can pick one:
184
+
Each model may have multiple variants (different quantizations, hardware targets). The SDK auto-selects the best variant, or you can pick one. All models implement the `IModel` interface.
Each `Model` can have multiple variants (different quantizations or formats). The SDK automatically selects the best available variant, preferring cached versions.
151
+
Each model can have multiple variants (different quantizations or formats). The SDK automatically selects the best available variant, preferring cached versions. All models implement the `IModel` interface.
152
152
153
153
```typescript
154
154
const model =awaitcatalog.getModel('qwen2.5-0.5b');
@@ -259,8 +259,7 @@ Auto-generated class documentation lives in [`docs/classes/`](docs/classes/):
259
259
260
260
-[FoundryLocalManager](docs/classes/FoundryLocalManager.md) — SDK entry point, web service management
261
261
-[Catalog](docs/classes/Catalog.md) — Model discovery and browsing
262
-
-[Model](docs/classes/Model.md) — High-level model with variant selection
263
-
-[ModelVariant](docs/classes/ModelVariant.md) — Specific model variant: download, load, inference
262
+
-[IModel](docs/README.md#imodel) — Model interface: variant selection, download, load, inference
264
263
-[ChatClient](docs/classes/ChatClient.md) — Chat completions (sync and streaming)
265
264
-[AudioClient](docs/classes/AudioClient.md) — Audio transcription (sync and streaming)
266
265
-[ModelLoadManager](docs/classes/ModelLoadManager.md) — Low-level model loading management
0 commit comments