[DRAFT] adding generated and custom code for custom training#45951
Open
jayesh-tanna wants to merge 69 commits intomainfrom
Open
[DRAFT] adding generated and custom code for custom training#45951jayesh-tanna wants to merge 69 commits intomainfrom
jayesh-tanna wants to merge 69 commits intomainfrom
Conversation
This reverts commit 86d53c5.
…allow_preview=True" is not specified (#45600)
…#45611) * marking finetuning pause and resume operations as live extended tests * updating recording --------- Co-authored-by: Jayesh Tanna <jatanna@microsoft.com>
* rename env vars * rename env var * resolved comments * remove chat completion * resolved comment
* Add CSV and synthetic data generation evaluation samples Add two new evaluation samples under sdk/ai/azure-ai-projects/samples/evaluations/: - sample_evaluations_builtin_with_csv.py: Demonstrates evaluating pre-computed responses from a CSV file using the csv data source type. Uploads a CSV file via the datasets API, runs coherence/violence/f1 evaluators, and polls results. - sample_synthetic_data_evaluation.py: Demonstrates synthetic data evaluation (preview) that generates test queries from a prompt, sends them to a model target, and evaluates responses with coherence/violence evaluators. Also adds: - data_folder/sample_data_evaluation.csv: Sample CSV data file with 3 rows - README.md: Updated sample index with both new samples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update synthetic eval sample: agent target + cleaner dataset ID retrieval - Switch from model target to agent target (azure_ai_agent) - Create agent version via agents.create_version() before evaluation - Simplify output_dataset_id retrieval using getattr instead of nested hasattr/isinstance checks - Add AZURE_AI_AGENT_NAME env var requirement - Remove input_messages (not needed for agent target) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add model target synthetic eval sample, cross-reference both - Add sample_synthetic_data_model_evaluation.py for model target with input_messages system prompt - Update sample_synthetic_data_evaluation.py docstring with cross-reference - Update README.md with both synthetic samples (agent and model) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename synthetic agent sample, clarify README, add prompt/files comments - Rename sample_synthetic_data_evaluation.py to sample_synthetic_data_agent_evaluation.py - Clarify README: JSONL dataset vs CSV dataset descriptions - Remove (preview) from synthetic sample descriptions in README - Add comments about prompt and reference_files options in both synthetic samples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Skip new eval samples in recording tests Add sample_evaluations_builtin_with_csv.py, sample_synthetic_data_agent_evaluation.py, and sample_synthetic_data_model_evaluation.py to samples_to_skip list since they require file upload prerequisites or are long-running preview features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename env vars per PR review: FOUNDRY_PROJECT_ENDPOINT, FOUNDRY_MODEL_NAME Address review comments from howieleung: - AZURE_AI_PROJECT_ENDPOINT -> FOUNDRY_PROJECT_ENDPOINT - AZURE_AI_MODEL_DEPLOYMENT_NAME -> FOUNDRY_MODEL_NAME Updated in all 3 new samples and README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename AZURE_AI_AGENT_NAME to FOUNDRY_AGENT_NAME per review Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update changelog with new sample entries Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ollingMethod` should be private (#45685)
…ed when relevant (#45718)
* New samples * resolved comments
* LLM validation use 5.2 and chat completion * change log * Resolved comments
…Azure/azure-sdk-for-python into feature/azure-ai-projects/2.0.2
* Adding-Upload-Evaluator * Adding-Upload-Evaluator * Adding-Upload-Evaluator * Adding-Upload-Evaluator-aio * rename * added - eval and eval run * fix * adding tests * updated as per review
Member
|
Please hold off on merging the PR. I want to get Johan's feedback on introducing nested sub-clients like |
* Sample-Fix * fix samples
* Instruction now not provided in test function. * fix test
…r upload (#46063) * fix(azure-ai-projects): skip all dot-prefixed directories in evaluator upload Change skip_dirs filter to exclude any directory starting with '.' instead of only '.git' and '.venv'. This covers .venv, .git, .mypy_cache, .tox, .pytest_cache, and any other hidden/tool directories. Applied to both sync and async upload functions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(azure-ai-projects): skip dot-prefixed files in evaluator upload Extend the existing skip logic to also exclude dot-prefixed files (e.g. .env, .DS_Store, .gitignore) from evaluator uploads, matching the treatment already applied to dot-prefixed directories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat(azure-ai-projects): add file_pattern and folder_exclusions_pattern to evaluators.upload Add optional regex-based filtering parameters to _upload_folder_to_blob and upload methods, consistent with datasets.upload_folder pattern: - file_pattern: filter which files to upload by name - folder_exclusions_pattern: exclude directories by name pattern Applied to both sync and async implementations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: remove hardcoded skip lists, let customer control via patterns Remove hardcoded skip_dirs and skip_extensions. Filtering is now fully controlled by the optional file_pattern and folder_exclusions_pattern parameters. Docstrings include recommended excludes for typical Python evaluator projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: restore sample_eval_upload_friendly_evaluator.py accidentally emptied Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: update upload tests for customer-controlled pattern filtering Replace test_upload_skips_pycache_and_pyc_files with two new tests: - test_upload_skips_pycache_and_pyc_files_with_patterns: verifies filtering works when patterns are provided - test_upload_uploads_all_files_without_patterns: verifies all files are uploaded when no patterns are given Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: fix Sphinx docstring continuation line alignment Align continuation lines under the directive name (e.g. 'p' in :param) instead of using deeper indentation, per Sphinx requirements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
eac227e to
223cb73
Compare
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Typespec PullRequest: Azure/azure-rest-api-specs#41619
Add Training Jobs support to
azure-ai-projectsSDKOverview
This PR introduces
CommandJobsupport underclient.beta.training.jobs(sync) andasync_client.beta.training.jobs(async), enabling users to create, get, list, update,cancel, and delete training jobs from the Azure AI Projects SDK without wrapping boilerplate.
A lot of our customers are currently using
azure-ai-mlfeels familiar to them — same patterns, same mental model. That way, when they are ready to move to Azure AI Foundry, the migration is a small step rather than a full rewrite.Design Choices
1. Flat
CommandJobsurface — no envelope requiredCallers pass
CommandJobdirectly tocreate_or_updateand receiveCommandJobback fromget/list. The SDK wraps/unwraps theJob(properties=...)wire envelope transparently.2. Custom
CommandJobsubclass (model patch)CommandJobextends the auto-generated_RestCommandJoband exposes read-onlynameandidproperties promoted from the outer
Jobenvelope returned by the service.3.
_from_rest_objectfactory methodA classmethod on
CommandJobconstructs the flat model from any service response object,with explicit
ValueError/TypeErroron unexpected shapes rather than silentNonefields.4.
CommandJobLimits.timeoutacceptsint,float, ortimedeltaThe patched
CommandJobLimits.__init__converts plain numeric seconds totimedeltabeforeforwarding to the generated model, eliminating a common serialization foot-gun.
5. Auto-injection of
Foundry-Featurespreview headerEvery operation (list, get, create_or_update, begin_delete, begin_cancel) automatically injects
Foundry-Features: Jobs=V1Previewso callers never need to pass it manually as a custom header.6. Automatic local-path resolution for
codeandinputsIf
codeor an inputpathis a local file or folder, the SDK transparently uploads it as adataset asset and swaps in the returned datastore URI before the request is sent.
7. Input validation before every create/update
create_or_updatevalidatesname,command,environment_image_reference, andcomputeare non-empty upfront, surfacing clear
ValueErrors instead of opaque HTTP 400 responses.8. Full async mirror (
_patch_jobs_async.py)All sync customizations are mirrored in the async operations class using
async/awaitanddistributed_trace_async, including async dataset upload resolution forcodeandinputs.Customizations Summary
CommandJobmodel withnameandidpropertiesJobenvelope. We subclass the generated model to surfacenameandiddirectly on the object so callers never need to unwrapjob.properties.name.CommandJob._from_rest_objectfactoryJobresponse into a flatCommandJobin one place, with typed error messages if the response shape is unexpected (missing properties, wrong job type).Jobenvelope wrapping increate_or_updateJob(properties=CommandJob(...)). The patch wraps the caller's flatCommandJobinto the envelope automatically before the HTTP call, keeping the public API clean.CommandJobLimitstimeout coercion__init__to accept plainint/floatseconds in addition totimedelta, converting them automatically. Removes a class of runtime serialization errors when callers pass numeric timeouts.Foundry-Featurespreview header injectionFoundry-Features: Jobs=V1Previewinto every request from_inject_preview_header, so the preview feature flag is always active without callers needing to know about it.codeandinputscodeor inputpathis uploaded to a new dataset viaDatasetsOperationsand the field is replaced with the returned datastore URI transparently.name:versionorazureai:name:versionform is resolved to a full datastore URI by fetching the existing dataset, removing the need for callers to look up URIs manually._validateguardname,command,environment_image_reference, andcomputeare non-empty before any network call, giving callers an immediateValueErrorwith a clear message instead of a cryptic HTTP 400.async/awaitin_patch_jobs_async.pyso the async client has identical behaviour.Pending / Future Work
command()factory function — Following the same pattern asazure-ai-ml's top-levelcommand()function (seeazure.ai.ml.entities._builders.command_func), a standalonecommand(*, command, environment, compute, inputs, outputs, ...)helper will be added so userscan write
job = command(...); client.beta.training.jobs.create_or_update(name, job)withoutconstructing
CommandJobdirectly.header injection,
_from_rest_objecterror paths, async equivalents) will be added in this PRin the next commit.
Sample code
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines