Skip to content

implements python sdk#533

Open
prathikr wants to merge 35 commits intomainfrom
prathikrao/implement-python-sdk
Open

implements python sdk#533
prathikr wants to merge 35 commits intomainfrom
prathikrao/implement-python-sdk

Conversation

@prathikr
Copy link
Contributor

mvp

Copilot AI review requested due to automatic review settings March 18, 2026 19:45
@vercel
Copy link

vercel bot commented Mar 18, 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 19, 2026 6:19am

Request Review

Copy link
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 an MVP Python SDK under sdk/python that wraps Foundry Local Core via ctypes, provides model discovery/load operations plus OpenAI-compatible chat/audio clients, and introduces pytest-based integration tests and CI build steps.

Changes:

  • Introduce Python SDK runtime: configuration, core interop layer, catalog/model abstractions, and OpenAI-style chat/audio clients.
  • Add pytest integration tests + shared fixtures mirroring the JS/C# SDK test suites.
  • Add GitHub Actions workflow steps to build Python wheels (standard + WinML) and run tests.

Reviewed changes

Copilot reviewed 37 out of 40 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
sdk/python/test/test_model.py Model caching + load/unload lifecycle tests
sdk/python/test/test_foundry_local_manager.py Manager initialization + catalog exposure tests
sdk/python/test/test_catalog.py Catalog listing/lookup/cached/variant tests
sdk/python/test/openai/test_chat_client.py Chat completion + streaming + validation tests
sdk/python/test/openai/test_audio_client.py Audio transcription + streaming + validation tests
sdk/python/test/openai/init.py Test package marker for openai tests
sdk/python/test/detail/test_model_load_manager.py ModelLoadManager tests for core + external service modes
sdk/python/test/detail/init.py Test package marker for detail tests
sdk/python/test/conftest.py Session fixtures and shared test configuration/constants
sdk/python/test/init.py Test package marker
sdk/python/test/README.md Test suite setup and execution instructions
sdk/python/src/version.py SDK version definition
sdk/python/src/openai/chat_client.py OpenAI-compatible chat client implementation
sdk/python/src/openai/audio_client.py OpenAI-compatible audio transcription client implementation
sdk/python/src/openai/init.py Public exports for openai-compatible clients
sdk/python/src/model_variant.py Variant-level model operations + client creation
sdk/python/src/model.py Alias-level model wrapper + variant selection
sdk/python/src/logging_helper.py Log level mapping + default logger severity helper
sdk/python/src/imodel.py Abstract model interface
sdk/python/src/foundry_local_manager.py Singleton manager: init, catalog creation, web service control
sdk/python/src/exception.py SDK base exception type
sdk/python/src/detail/utils.py Native binary discovery + install/verify CLI utility
sdk/python/src/detail/model_load_manager.py Load/unload/list-loaded via core interop or external web service
sdk/python/src/detail/model_data_types.py Pydantic types for catalog/model metadata
sdk/python/src/detail/core_interop.py ctypes FFI bridge to native Core library
sdk/python/src/detail/init.py Re-exports for detail layer
sdk/python/src/configuration.py Configuration object + validation + serialization
sdk/python/src/catalog.py Catalog caching/refresh + lookup + cached/loaded queries
sdk/python/src/init.py Top-level package exports + basic logger setup
sdk/python/requirements.txt Runtime dependencies for standard variant
sdk/python/requirements-winml.txt Runtime dependencies for WinML variant
sdk/python/requirements-dev.txt Dev/test dependencies aggregation
sdk/python/pyproject.toml Packaging metadata, scripts, pytest config
sdk/python/examples/chat_completion.py Example usage: discover, load, chat (streaming + non-streaming)
sdk/python/build_backend.py PEP517 build backend shim for WinML variant builds
sdk/python/README.md SDK installation + usage documentation
sdk/python/LICENSE.txt MIT license for the Python package
sdk/python/.gitignore Ignore build artifacts/logs/venv caches for Python SDK
.github/workflows/foundry-local-sdk-build.yml Add Python build jobs to the SDK build workflow
.github/workflows/build-python-steps.yml New reusable workflow to build/install/test Python wheels

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
prathikr and others added 2 commits March 18, 2026 12:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Prathik Rao and others added 2 commits March 18, 2026 13:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Prathik Rao and others added 4 commits March 18, 2026 13:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
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

This PR introduces an MVP Foundry Local Python SDK (packaging + runtime + tests) and wires it into CI builds.

Changes:

  • Adds the Python SDK runtime: configuration + manager singleton, catalog/model APIs, native Core ctypes interop, and OpenAI-compatible chat/audio clients.
  • Adds a pytest-based integration test suite mirroring the JS/C# SDK tests, plus a small example script and documentation.
  • Adds GitHub Actions workflows to build the Python wheels (standard + WinML) and run tests on Windows/macOS.

Reviewed changes

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

Show a summary per file
File Description
sdk/python/src/detail/core_interop.py ctypes FFI layer to native Foundry Local Core; command execution + callbacks
sdk/python/src/detail/utils.py Native binary discovery + ORT symlink workaround + foundry-local-install CLI
sdk/python/src/detail/model_load_manager.py Load/unload/list model operations via core interop or external web service
sdk/python/src/catalog.py Catalog model listing/cached/loaded lookups with refresh caching
sdk/python/src/model.py Alias-level model wrapper that delegates to selected variant
sdk/python/src/model_variant.py Variant-level operations + creation of chat/audio clients
sdk/python/src/openai/chat_client.py OpenAI-compatible chat completions client (streaming/non-streaming + tools)
sdk/python/src/openai/audio_client.py OpenAI-compatible audio transcription client (streaming/non-streaming)
sdk/python/src/configuration.py SDK configuration object + validation + serialization to native config
sdk/python/src/foundry_local_manager.py Singleton manager that initializes core, catalog, and web service lifecycle
sdk/python/src/logging_helper.py Log level mapping + minimal StrEnum shim
sdk/python/src/init.py / src/version.py Package exports + version definition
sdk/python/pyproject.toml / build_backend.py Packaging + WinML variant build shim + pytest settings
sdk/python/requirements*.txt / requirements-dev.txt Runtime + dev dependencies
sdk/python/README.md SDK documentation and usage examples
sdk/python/examples/chat_completion.py End-to-end usage example
sdk/python/test/** Pytest integration tests + fixtures + test README
.github/workflows/build-python-steps.yml Reusable workflow to build wheels and run Python tests
.github/workflows/foundry-local-sdk-build.yml Adds Python build jobs (standard + WinML) to main SDK build workflow

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

prathikr and others added 2 commits March 18, 2026 22:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
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

This PR introduces an MVP Foundry Local Python SDK (packaging, native core interop, model/catalog APIs, OpenAI-compatible clients) plus an integration-style pytest suite and CI build workflow wiring.

Changes:

  • Add Python SDK implementation: configuration, manager/catalog/model APIs, ctypes Core interop, and OpenAI-style chat/audio clients.
  • Add pytest-based integration tests + test documentation and example script.
  • Add Python packaging/build backend (WinML variant) and GitHub Actions workflow steps to build/test wheels on multiple platforms.

Reviewed changes

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

Show a summary per file
File Description
sdk/python/src/__init__.py Public package exports + default logger setup
sdk/python/src/version.py SDK version constant
sdk/python/src/exception.py Base SDK exception type
sdk/python/src/logging_helper.py LogLevel enum + logger severity helper
sdk/python/src/configuration.py Configuration object and validation
sdk/python/src/foundry_local_manager.py Singleton manager initialization + web service start/stop
sdk/python/src/catalog.py Catalog querying, caching, and model/variant lookup
sdk/python/src/imodel.py Model interface used by Model / ModelVariant
sdk/python/src/model.py Alias-level model wrapper that delegates to selected variant
sdk/python/src/model_variant.py Variant-level operations (cache/load, create clients)
sdk/python/src/openai/__init__.py OpenAI client re-exports
sdk/python/src/openai/chat_client.py Chat completions (streaming + tools) backed by Core interop
sdk/python/src/openai/audio_client.py Audio transcription (streaming + non-streaming) backed by Core interop
sdk/python/src/detail/__init__.py Internal re-exports for detail modules
sdk/python/src/detail/core_interop.py ctypes bindings + command execution + callback plumbing
sdk/python/src/detail/model_data_types.py Pydantic models for catalog data
sdk/python/src/detail/model_load_manager.py Load/unload/list-loaded via Core interop or web service
sdk/python/src/detail/utils.py Native binary discovery + symlink compatibility + install CLI
sdk/python/test/conftest.py Session fixtures, shared constants, CI skipping logic
sdk/python/test/test_foundry_local_manager.py Manager initialization tests
sdk/python/test/test_catalog.py Catalog API tests
sdk/python/test/test_model.py Model load/unload + cache tests
sdk/python/test/detail/test_model_load_manager.py ModelLoadManager tests (core + external service)
sdk/python/test/openai/test_chat_client.py Chat client tests (streaming + tools + validation)
sdk/python/test/openai/test_audio_client.py Audio transcription tests (streaming + validation)
sdk/python/test/README.md Test suite setup and usage docs
sdk/python/examples/chat_completion.py End-to-end usage example
sdk/python/requirements*.txt Runtime + WinML dependency sets
sdk/python/requirements-dev.txt Test/build dependencies
sdk/python/pyproject.toml Packaging metadata + pytest config + scripts
sdk/python/build_backend.py PEP517 backend shim for WinML wheel variant
sdk/python/README.md SDK documentation (install, usage, CLI, tests)
.github/workflows/build-python-steps.yml Wheel build + install + pytest run pipeline
.github/workflows/foundry-local-sdk-build.yml Add Python jobs to the multi-SDK build workflow

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
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 an MVP Foundry Local Python SDK implementation (packaging + ctypes-based core interop) along with an integration-style pytest suite and CI workflow support to build/test wheels (standard + WinML).

Changes:

  • Introduces core SDK surface area: FoundryLocalManager, Catalog, Model/ModelVariant, ctypes CoreInterop, and ModelLoadManager (core + optional web-service mode).
  • Adds OpenAI-compatible clients for chat completions (streaming + tool-calling) and audio transcription (streaming + non-streaming).
  • Adds Python test suite mirroring JS/C# structure and updates GitHub Actions to build/test Python wheels on multiple platforms.

Reviewed changes

Copilot reviewed 38 out of 41 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/python/test/test_model.py Adds model cache + load/unload lifecycle tests.
sdk/python/test/test_foundry_local_manager.py Adds basic manager initialization + catalog access tests.
sdk/python/test/test_catalog.py Adds catalog listing/lookup/cached/variant lookup tests.
sdk/python/test/openai/test_chat_client.py Adds chat completion tests including streaming and tool calling.
sdk/python/test/openai/test_audio_client.py Adds audio transcription tests including streaming + validation.
sdk/python/test/openai/init.py Declares test subpackage for OpenAI client tests.
sdk/python/test/detail/test_model_load_manager.py Adds ModelLoadManager tests for core interop + external service (skipped in CI).
sdk/python/test/detail/init.py Declares test subpackage for detail tests.
sdk/python/test/conftest.py Adds session fixtures, CI detection, and shared helpers/tool definitions.
sdk/python/test/init.py Declares test package.
sdk/python/test/README.md Documents prerequisites, structure, and how to run tests.
sdk/python/src/version.py Introduces SDK version module.
sdk/python/src/openai/chat_client.py Implements OpenAI-style chat completions client (sync + streaming).
sdk/python/src/openai/audio_client.py Implements audio transcription client (sync + streaming).
sdk/python/src/openai/init.py Exposes OpenAI client entry points.
sdk/python/src/model_variant.py Implements per-variant operations + client factories.
sdk/python/src/model.py Implements alias-grouped model wrapper with variant selection.
sdk/python/src/logging_helper.py Adds log level mapping + default logger severity setter.
sdk/python/src/imodel.py Adds model interface for download/load/inference client creation.
sdk/python/src/foundry_local_manager.py Adds singleton manager for initialization/catalog/web-service control.
sdk/python/src/exception.py Adds SDK exception base type.
sdk/python/src/detail/utils.py Adds native binary discovery + install/verify CLI utilities.
sdk/python/src/detail/model_load_manager.py Adds load/unload/list logic via core interop or HTTP service.
sdk/python/src/detail/model_data_types.py Adds Pydantic models for catalog data.
sdk/python/src/detail/core_interop.py Adds ctypes FFI layer and native library initialization logic.
sdk/python/src/detail/init.py Re-exports key detail types.
sdk/python/src/configuration.py Adds SDK configuration object and validation/serialization.
sdk/python/src/catalog.py Adds catalog model discovery + cached/loaded queries with refresh window.
sdk/python/src/_str_enum.py Adds Python 3.10-compatible StrEnum shim.
sdk/python/src/init.py Adds package exports and logging setup.
sdk/python/requirements.txt Adds runtime dependency set for standard variant.
sdk/python/requirements-winml.txt Adds runtime dependency set for WinML variant.
sdk/python/requirements-dev.txt Adds dev/test dependencies for local development.
sdk/python/pyproject.toml Adds packaging metadata, scripts, and pytest configuration.
sdk/python/examples/chat_completion.py Adds example demonstrating initialization, loading, and chat usage.
sdk/python/build_backend.py Adds custom build backend shim for WinML variant builds.
sdk/python/README.md Adds end-user documentation for install/build/usage/tests/examples.
sdk/python/LICENSE.txt Adds Python SDK license file.
sdk/python/.gitignore Adds ignores for Python build artifacts and logs.
.github/workflows/foundry-local-sdk-build.yml Wires Python builds into the main SDK build workflow.
.github/workflows/build-python-steps.yml Adds reusable GitHub Actions workflow to build/test Python wheels.

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Prathik Rao and others added 3 commits March 18, 2026 23:17
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
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

Introduces an MVP Foundry Local Python SDK with OpenAI-compatible chat/audio clients, plus packaging, examples, and CI/test coverage to validate end-to-end model discovery/load/inference.

Changes:

  • Adds core SDK primitives (Configuration, FoundryLocalManager, Catalog/Model/Variant) and ctypes Core interop.
  • Implements OpenAI-compatible ChatClient (including streaming + tool calling) and AudioClient (streaming + non-streaming transcription).
  • Adds pytest integration tests and GitHub Actions workflow steps to build wheels and run the Python test suite.

Reviewed changes

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

Show a summary per file
File Description
sdk/python/test/test_model.py Adds model cache + load/unload lifecycle tests
sdk/python/test/test_foundry_local_manager.py Adds manager initialization/catalog smoke tests
sdk/python/test/test_catalog.py Adds catalog listing and lookup tests
sdk/python/test/openai/test_chat_client.py Adds chat completion + streaming + tool-calling tests
sdk/python/test/openai/test_audio_client.py Adds audio transcription tests (streaming + non-streaming)
sdk/python/test/detail/test_model_load_manager.py Adds model load manager tests (core interop + external service)
sdk/python/test/conftest.py Adds shared pytest fixtures and test configuration helpers
sdk/python/test/README.md Documents Python test suite setup and structure
sdk/python/src/version.py Introduces SDK version module for packaging/user-agent
sdk/python/src/openai/chat_client.py Implements OpenAI-compatible chat client + settings/validation
sdk/python/src/openai/audio_client.py Implements OpenAI-compatible audio transcription client
sdk/python/src/openai/init.py Exports OpenAI-compatible client APIs
sdk/python/src/model_variant.py Adds ModelVariant operations (download/cache/load + client factories)
sdk/python/src/model.py Adds Model wrapper for variants and selection
sdk/python/src/logging_helper.py Adds log-level mapping + default logger configuration
sdk/python/src/imodel.py Defines the model interface used by Model/ModelVariant
sdk/python/src/foundry_local_manager.py Adds singleton manager initialization + optional web service controls
sdk/python/src/exception.py Adds SDK base exception type
sdk/python/src/detail/utils.py Adds native binary discovery + CLI installer/validator
sdk/python/src/detail/model_load_manager.py Adds model load/unload/list via core interop or web service
sdk/python/src/detail/model_data_types.py Adds Pydantic models for catalog/model metadata
sdk/python/src/detail/core_interop.py Adds ctypes FFI layer for Foundry Local Core + callbacks
sdk/python/src/detail/init.py Adds detail package exports for convenience imports
sdk/python/src/configuration.py Adds configuration model + validation + serialization
sdk/python/src/catalog.py Implements catalog refresh, listing, cached/loaded queries
sdk/python/src/_str_enum.py Adds StrEnum compatibility shim for Python 3.10
sdk/python/src/init.py Sets up package exports + default logging handler
sdk/python/requirements.txt Defines runtime dependencies for standard variant
sdk/python/requirements-winml.txt Defines runtime dependencies for WinML variant
sdk/python/requirements-dev.txt Defines dev/test dependencies
sdk/python/pyproject.toml Adds packaging metadata + build backend wiring + pytest config
sdk/python/examples/chat_completion.py Adds example demonstrating basic chat + streaming usage
sdk/python/build_backend.py Adds PEP 517 backend shim to build WinML vs standard wheels
sdk/python/README.md Adds SDK documentation (install, usage, API overview)
sdk/python/LICENSE.txt Adds MIT license file for Python package
sdk/python/.gitignore Adds Python SDK-specific ignores
.github/workflows/foundry-local-sdk-build.yml Wires Python SDK build jobs into main build workflow
.github/workflows/build-python-steps.yml Adds reusable workflow to build/install wheel and run pytest
Comments suppressed due to low confidence (1)

sdk/python/src/openai/chat_client.py:1

  • New validation behavior for response_format and tool_choice is introduced here, but the added tests only appear to cover valid configurations. Add pytest cases that assert invalid shapes/types raise the expected exceptions (e.g., unknown type, missing/extra fields, and function tool_choice missing name) to prevent silently regressing these guards.
# -------------------------------------------------------------------------

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

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