Skip to content

Feature/finetuning sessions sdk#47495

Open
harshith-arunkumar wants to merge 4 commits into
mainfrom
feature/finetuning-sessions-sdk
Open

Feature/finetuning sessions sdk#47495
harshith-arunkumar wants to merge 4 commits into
mainfrom
feature/finetuning-sessions-sdk

Conversation

@harshith-arunkumar

Copy link
Copy Markdown

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings June 15, 2026 08:07
@github-actions github-actions Bot added the AI label Jun 15, 2026
Ports the reviewed azure-ai-finetuning-sessions package from azure-sdk-for-python-pr into the main SDK repo.
@harshith-arunkumar harshith-arunkumar force-pushed the feature/finetuning-sessions-sdk branch from f393d38 to 7eefdbb Compare June 15, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 a new azure-ai-finetuning-sessions Python SDK package (generated from TypeSpec) and adds a handwritten FineTuningSession convenience wrapper plus offline/unit test scaffolding for fine-tuning session workflows (forward/backward, optimizer step, checkpointing, sampling, operations polling).

Changes:

  • Added a new sdk/ai/azure-ai-finetuning-sessions/ package with generated client/models/operations (sync + async) and packaging metadata.
  • Implemented a handwritten FineTuningSession wrapper (_patch.py) that POSTs actions and polls Loom-style request endpoints, normalizing results into OperationResult models.
  • Added unit tests + fixtures and an offline “smoke test” script, and updated the shared TypeSpec client package-lock.json.

Reviewed changes

Copilot reviewed 37 out of 41 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
sdk/ai/azure-ai-finetuning-sessions/tsp-location.yaml TypeSpec source location configuration for generation.
sdk/ai/azure-ai-finetuning-sessions/tests/test_finetuning_session.py Unit tests for FineTuningSession wrapper and models.
sdk/ai/azure-ai-finetuning-sessions/tests/conftest.py Shared pytest fixtures + fake transport/credential for offline tests.
sdk/ai/azure-ai-finetuning-sessions/test_smoke.py Offline smoke test script demonstrating “hero” usage patterns.
sdk/ai/azure-ai-finetuning-sessions/README.md Package README with getting-started and examples.
sdk/ai/azure-ai-finetuning-sessions/pyproject.toml Package build metadata and dependencies.
sdk/ai/azure-ai-finetuning-sessions/MANIFEST.in Source distribution manifest for packaging.
sdk/ai/azure-ai-finetuning-sessions/LICENSE Package license file.
sdk/ai/azure-ai-finetuning-sessions/dev_requirements.txt Dev/test requirements for the package.
sdk/ai/azure-ai-finetuning-sessions/CHANGELOG.md Initial changelog entry for the new package.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/py.typed PEP 561 marker for typing support.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/operations/_patch.py Generated customization hook for operations.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/operations/_operations.py Generated sync operations implementations.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/operations/init.py Generated operations package exports + patch hook.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/models/_patch.py Generated customization hook for models.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/models/_models.py Generated data models for sessions/ops/requests.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/models/_enums.py Generated enums (loss fn, statuses, preview flags, etc.).
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/models/init.py Generated models package exports + patch hook.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/operations/_patch.py Generated async customization hook for operations.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/operations/_operations.py Generated async operations implementations.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/operations/init.py Generated async operations exports + patch hook.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/_patch.py Generated async client patch hook.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/_configuration.py Generated async client configuration.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/_client.py Generated async client implementation.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/aio/init.py Generated async package exports + patch hook.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_version.py Package version constant.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_validation.py Generated API version validation decorator.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_utils/serialization.py Generated serializer/deserializer helpers.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_utils/model_base.py Generated model base + JSON/XML (de)serialization utilities.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_utils/init.py Generated utils package marker.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_types.py Generated type aliases used by models.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_patch.py Handwritten convenience wrapper (FineTuningSession) + request normalization.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_configuration.py Generated sync client configuration (with custom auth tweaks).
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/_client.py Generated sync client implementation.
sdk/ai/azure-ai-finetuning-sessions/azure/ai/finetuning_sessions/init.py Package exports (FineTuningSessionClient, FineTuningSession, version).
sdk/ai/azure-ai-finetuning-sessions/azure/ai/init.py Namespace package marker for azure.ai.
sdk/ai/azure-ai-finetuning-sessions/azure/init.py Namespace package marker for azure.
sdk/ai/azure-ai-finetuning-sessions/apiview-properties.json APIView cross-language mapping metadata.
sdk/ai/azure-ai-finetuning-sessions/_metadata.json Generation metadata placeholder.
eng/common/tsp-client/package-lock.json Lockfile update for shared TypeSpec client tooling.
Files not reviewed (1)
  • eng/common/tsp-client/package-lock.json: Generated file

Comment on lines +1 to +7
# Release History

## 1.0.0b1 (1970-01-01)

### Other Changes

- Initial version No newline at end of file
python -m pip install azure-ai-finetuning-sessions
```

#### Prequisites
Comment on lines +42 to +51
>>> from azure.ai.finetuning_sessions import FineTuningSessionClient
>>> from azure.identity import DefaultAzureCredential
>>> from azure.core.exceptions import HttpResponseError

>>> client = FineTuningSessionClient(endpoint='<endpoint>', credential=DefaultAzureCredential())
>>> try:
<!-- write test code here -->
except HttpResponseError as e:
print('service responds error: {}'.format(e.response.json()))

Comment on lines +45 to +61
[tool.setuptools.dynamic]
version = {attr = "azure.ai.finetuning_sessions._version.VERSION"}
readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"}

[tool.setuptools.packages.find]
exclude = [
"tests*",
"generated_tests*",
"samples*",
"generated_samples*",
"doc*",
"azure",
"azure.ai",
]

[tool.setuptools.package-data]
pytyped = ["py.typed"]
Comment on lines +1 to +6
"""
Offline smoke test for azure-ai-finetuning-sessions SDK.
Mirrors the hero code patterns from SPEC_FOUNDRY_AICLIENT.md.
Run: python test_smoke.py
No real endpoint or credentials required.
"""
Comment on lines +137 to +144
sample_op = session.sample(
prompt_tokens=prompt_ids,
sampling_params=SamplingParams(max_tokens=32, temperature=1.0, top_p=1.0, top_k=-1),
num_samples=4,
sampling_session_id="sampling_abc123",
seq_id=0,
prompt_logprobs=True,
)
Comment on lines +1 to +3
# Azure Finetuning Sessions client library for Python
<!-- write necessary description of service -->

Comment on lines +90 to +93
def open(self): pass
def close(self): pass
def __enter__(self): return self
def __exit__(self, *args): self.close()
Comment on lines +81 to +84
def open(self): pass
def close(self): pass
def __enter__(self): return self
def __exit__(self, *args): self.close()
Harshith Arun Kumar added 3 commits June 15, 2026 10:16
Updates generated models (SessionStatus vocabulary, LoRAConfig.alpha, SampledSequence.text, SaveCheckpointRequest.step_number/metrics, ejectable, Forward models) and ports custom patch files, typed exceptions (_exceptions.py), and logging setup (_logging_setup.py) from loom master.
@dargilco

Copy link
Copy Markdown
Member

You'll also need to update \sdk\ai\ci.yml to add your pacakge, similar to what you see for azure-ai-projects and azure-ai-agents.

@dargilco

Copy link
Copy Markdown
Member

Don't check in binary files (the .whl file). Why do you need it there?

@dargilco

Copy link
Copy Markdown
Member

remove package-lock file from this PR. Why did you need to update it?

@dargilco

Copy link
Copy Markdown
Member

Add cspell.json file at the project root to suppress some spelling errors. See example in the azure-ai-projects folder

"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please also add
"Programming Language :: Python :: 3.14",

]

[project.urls]
repository = "https://github.com/Azure/azure-sdk-for-python"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can deep link to your folder... add /sdk/ai/azure-ai-finetunning-sessions

@@ -0,0 +1,155 @@
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is there a test file at the package root? Should this not be in the tests folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants