Skip to content

Update sample human evaluations code with agent identifiers - #47444

Closed
seangayler-msft wants to merge 1 commit into
mainfrom
feature/azure-ai-projects/fix-human-evals-sample
Closed

Update sample human evaluations code with agent identifiers#47444
seangayler-msft wants to merge 1 commit into
mainfrom
feature/azure-ai-projects/fix-human-evals-sample

Conversation

@seangayler-msft

Copy link
Copy Markdown

Description

This follows #46962 to add agent identifiers to the human evaluation results. This is essential for correlating evaluation results back to an agent, which is what automated evaluators do.

It specifically adds these attributes:

  • gen_ai.agent.name
  • gen_ai.agent.id

Both of which are documented in the OTel spec here: https://github.com/open-telemetry/semantic-conventions/blob/785e90b5bcea04072eb000b04ec4fc9c9608e76c/docs/registry/attributes/gen-ai.md

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 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 updates the azure-ai-projects human-evaluations sample and its tests to require agent metadata and to emit agent identifiers on the gen_ai.evaluation.result event, enabling correlation of human evaluation results back to a specific agent.

Changes:

  • Require agent_name and agent_version parameters for the human-evaluation helper functions in the sample.
  • Emit gen_ai.agent.name and gen_ai.agent.id in the generated evaluation event attributes.
  • Update tests to (a) assert missing agent metadata raises TypeError and (b) validate the emitted agent identifiers.

Reviewed changes

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

File Description
sdk/ai/azure-ai-projects/tests/evaluations/test_human_evaluations.py Adds agent metadata constants/wrappers, verifies missing agent metadata fails fast, and asserts emitted agent attributes.
sdk/ai/azure-ai-projects/samples/evaluations/sample_human_evaluations.py Extends sample API to take agent metadata and emits gen_ai.agent.* attributes on human evaluation events.

Comment on lines +203 to 205
"gen_ai.agent.name": agent_name,
"gen_ai.agent.id": f"{agent_name}:{agent_version}",
"microsoft.gen_ai.human_evaluation.source": "end_user",
Comment on lines +141 to +143
assert attrs["gen_ai.agent.name"] == AGENT_NAME
assert attrs["gen_ai.agent.id"] == AGENT_ID
assert "gen_ai.agent.version" not in attrs
@seangayler-msft
seangayler-msft force-pushed the feature/azure-ai-projects/fix-human-evals-sample branch from f6c6efe to 9a1b2ec Compare June 10, 2026 21:32
@seangayler-msft

Copy link
Copy Markdown
Author

Discussed change with team. Change not needed.

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.

2 participants