Skip to content

Explicit EP download and registration#559

Open
baijumeswani wants to merge 4 commits intomainfrom
baijumeswani/explicit-ep-download
Open

Explicit EP download and registration#559
baijumeswani wants to merge 4 commits intomainfrom
baijumeswani/explicit-ep-download

Conversation

@baijumeswani
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 27, 2026 21:13
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Mar 28, 2026 6:51am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds explicit execution-provider (EP) discovery/download/registration APIs across SDKs (C#, Rust, Python, JS) and updates catalogs/examples/docs to avoid implicitly blocking catalog access on EP downloads.

Changes:

  • Introduces discover_eps and download_and_register_eps APIs (plus new EP result/info types) in multiple SDKs.
  • Removes client-side catalog refresh TTL/invalidator logic so catalog refresh behavior relies on the core’s caching.
  • Updates docs and samples to use explicit EP registration (and removes some legacy/implicit EP behavior).

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
www/src/routes/models/service.ts Removes DirectML EP from the UI/service EP list.
sdk/rust/src/types.rs Adds EpInfo and EpDownloadResult Rust types (serde PascalCase).
sdk/rust/src/model_variant.rs Removes catalog cache invalidation hooks from model variant operations.
sdk/rust/src/lib.rs Re-exports new EP types from the Rust crate.
sdk/rust/src/foundry_local_manager.rs Adds discover_eps and download_and_register_eps APIs to the Rust manager.
sdk/rust/src/catalog.rs Removes TTL/invalidation-based caching; always refreshes via core.
sdk/rust/README.md Documents explicit EP management for Rust SDK.
sdk/python/test/test_foundry_local_manager.py Adds tests for EP discovery/download APIs and deprecated wrapper behavior.
sdk/python/src/foundry_local_manager.py Adds EP APIs and deprecates ensure_eps_downloaded() in favor of explicit registration.
sdk/python/src/ep_types.py Adds Python EpInfo / EpDownloadResult dataclasses + parsers.
sdk/python/src/catalog.py Removes 6-hour TTL refresh guard for catalog updates.
sdk/python/src/init.py Exports EP types from Python package surface.
sdk/python/examples/chat_completion.py Demonstrates EP discovery and explicit registration in example.
sdk/python/README.md Updates backend table + adds explicit EP management docs and API list entries.
sdk/js/src/types.ts Adds JS EP type interfaces.
sdk/js/src/foundryLocalManager.ts Adds discoverEps() and downloadAndRegisterEps() methods to JS manager.
sdk/js/src/catalog.ts Removes 6-hour TTL refresh guard for catalog updates.
sdk/js/examples/chat-completion.ts Refactors example toward audio transcription flow (but currently inconsistent/buggy).
sdk/js/README.md Adds explicit EP management docs for JS.
sdk/cs/src/FoundryLocalManager.cs Adds DiscoverEps() + DownloadAndRegisterEpsAsync() and updates catalog remarks.
sdk/cs/src/EpInfo.cs Adds .NET EP DTOs (EpInfo, EpDownloadResult).
sdk/cs/src/Detail/JsonSerializationContext.cs Registers EP DTOs for source-generated JSON serialization.
sdk/cs/src/Catalog.cs Removes 6-hour TTL refresh guard for catalog updates.
sdk/cs/docs/api/microsoft.ai.foundry.local.foundrylocalmanager.md Updates .NET API docs to reflect explicit EP flow.
sdk/cs/README.md Updates guidance to use explicit EP management APIs.
samples/cs/GettingStarted/src/ToolCallingFoundryLocalWebServer/Program.cs Updates sample to call DownloadAndRegisterEpsAsync().
samples/cs/GettingStarted/src/ToolCallingFoundryLocalSdk/Program.cs Updates sample to call DownloadAndRegisterEpsAsync().
samples/cs/GettingStarted/src/ModelManagementExample/Program.cs Updates sample to call DownloadAndRegisterEpsAsync().
samples/cs/GettingStarted/src/HelloFoundryLocalSdk/Program.cs Adds EP discovery output + switches to DownloadAndRegisterEpsAsync().
samples/cs/GettingStarted/src/FoundryLocalWebServer/Program.cs Updates sample to call DownloadAndRegisterEpsAsync().
samples/cs/GettingStarted/src/AudioTranscriptionExample/Program.cs Updates sample EP call + sets audio transcription language.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


/**
* Discovers available execution providers (EPs) and their registration status.
* @returns An array of EpInfo describing each available EP.
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc block for discoverEps() has inconsistent indentation on the @returns line, which can lead to messy generated docs and makes the comment harder to read. Align the * indentation with the surrounding JSDoc lines.

Suggested change
* @returns An array of EpInfo describing each available EP.
* @returns An array of EpInfo describing each available EP.

Copilot uses AI. Check for mistakes.
Comment on lines +150 to +151
return JsonSerializer.Deserialize(result.Data!, JsonSerializationContext.Default.EpInfoArray)
?? Array.Empty<EpInfo>();
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DiscoverEps() can throw a raw JsonException if the core returns invalid JSON (or unexpected shape). Other public manager APIs wrap unexpected exceptions via Utils.CallWithExceptionHandling, but this method currently returns JsonSerializer.Deserialize(...) directly. Consider catching JsonException (and/or validating result.Data is non-null) and rethrowing a FoundryLocalException with context so callers get consistent error semantics.

Suggested change
return JsonSerializer.Deserialize(result.Data!, JsonSerializationContext.Default.EpInfoArray)
?? Array.Empty<EpInfo>();
if (string.IsNullOrWhiteSpace(result.Data))
{
throw new FoundryLocalException(
"Error discovering execution providers: core returned no data.",
_logger);
}
try
{
return JsonSerializer.Deserialize(result.Data, JsonSerializationContext.Default.EpInfoArray)
?? Array.Empty<EpInfo>();
}
catch (JsonException ex)
{
throw new FoundryLocalException(
"Error discovering execution providers: invalid JSON payload from core.",
ex,
_logger);
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants