Skip to content

Move patched evaluation TypedDicts to the azure.ai.projects.types namespace#48159

Open
dargilco wants to merge 3 commits into
feature/azure-ai-projects/vnextfrom
dargilco/move-evaluation-typeddicts
Open

Move patched evaluation TypedDicts to the azure.ai.projects.types namespace#48159
dargilco wants to merge 3 commits into
feature/azure-ai-projects/vnextfrom
dargilco/move-evaluation-typeddicts

Conversation

@dargilco

@dargilco dargilco commented Jul 21, 2026

Copy link
Copy Markdown
Member

CoPilot notes:

  • This guarantees runtime availability for normal imports.
  • Static analysis/discovery (like pyright docs/intellisense) may still not show monkey-patched names unless stubs/generated sources include them.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

This comment has been minimized.

patch_types_module = importlib.import_module(f"{__package__}._patch_types")

for name in getattr(patch_types_module, "__all__", []):
setattr(types_module, name, getattr(patch_types_module, name))

@dargilco dargilco Jul 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The above is the run-time hack to export the hand-written TypedDicts into the "azure.ai.projects.typed" namespace. But since it's run-time, there won't be any typing hints...

@github-actions

Copy link
Copy Markdown
Contributor
[Pilot] PR Pipeline Failure Analysis

A CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green.

What failed

The azure-ai-projects CI pipeline (Build #6596138) failed in two areas that share a single root cause:

  • Validation (apistub): The API stub generator crashes with NameError: name 'AzureAIAgentTarget' is not defined at _patch_types.py line 69, when azure.ai.projects is imported.
  • Tests (all test suites — whl, sdist, mindependency — on both macOS and Ubuntu): Every test in sdk.ai.azure-ai-projects fails, almost certainly because the same import error prevents the package from loading at all.

Root cause: _patch_types.py references AzureAIAgentTarget (and likely other types such as AzureAIModelTarget) that are not in scope when the module is executed. This PR moves evaluation TypedDicts to azure.ai.projects.types, which means the names must be imported (or defined) in _patch_types.py before they are referenced in class bodies.

Recommended next steps

  • In sdk/ai/azure-ai-projects/azure/ai/projects/_patch_types.py, add the missing imports for AzureAIAgentTarget, AzureAIModelTarget, and any other names that are used but not yet in scope at the top of the file (or at the point of use, avoiding circular imports).
  • Verify the fix locally by running python -c "import azure.ai.projects" — it should succeed without errors.
  • Run the mindependency tests locally: pytest sdk/ai/azure-ai-projects/tests/test_base.py as a quick smoke test.
  • See the CI troubleshooting guide: https://aka.ms/ci-fix
  • Push new commits to address the failures; this comment updates automatically on the next failing run.
Raw pipeline analysis (azsdk ci analyze)
Analyzing pipeline https://github.com/Azure/azure-sdk-for-python/pull/48159...

Failed Tests (all platforms: macOS, Ubuntu; all test types: whl, sdist, mindependency)
  ~90 test modules in sdk.ai.azure-ai-projects.tests.* — all failing
  Root: package import failure due to NameError in _patch_types.py

Failed Validation (apistub):
  _patch_types.py line 69:
    class TargetCompletionEvalRunDataSource(TypedDict, total=False):
        target: Required[Union[AzureAIAgentTarget, AzureAIModelTarget, dict[str, Any]]]
  NameError: name 'AzureAIAgentTarget' is not defined

  azure-ai-projects exited with error 1 (apistub check FAIL in 182.51s)

Failed Sphinx docs (same NameError: 'AzureAIAgentTarget' is not defined)

### Pipeline: https://dev.azure.com/azure-sdk/public/_build/results?buildId=6596138

Copilot detected the failing pipeline and generated the analysis above. To have it attempt a fix automatically, reply with @copilot please fix the failing pipeline on this PR.

Generated by Pipeline Analysis - Next Steps · 39 AIC · ⌖ 6.19 AIC · ⊞ 6.6K ·

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant