Skip to content

Conversation

@jayesh-tanna
Copy link
Member

@jayesh-tanna jayesh-tanna commented Jan 15, 2026

Description

This PR adds User-Agent header support to OpenAI client requests. The User-Agent value is set to "AIProjectClient/Python" by default. Users can customize the User-Agent at two levels:
(1) At AIProjectClient level using the user_agent parameter: AIProjectClient(endpoint="...", credential=credential, user_agent="MyApp"), which results in "MyApp-AIProjectClient/Python-{VERSION}",

(2) At get_openai_client level using default_headers: client.get_openai_client(default_headers={"User-Agent": "DifferentApp"}), which results in "DifferentApp-AIProjectClient/Python-{VERSION}".

If neither is provided, the default "AIProjectClient/Python-{VERSION}" is used. This ensures all OpenAI requests include the SDK identifier for backend telemetry tracking.

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.

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 adds User-Agent header support to OpenAI client requests in the Azure AI Projects SDK. The User-Agent value defaults to "AIProjectClient/Python" and can be customized at the AIProjectClient level or via the get_openai_client method's default_headers parameter. The implementation ensures all OpenAI requests include the SDK identifier for backend telemetry tracking.

Changes:

  • Updated USER_AGENT_APP_ID from "AIProjectClient" to "AIProjectClient/Python" in _patch_user_agent function
  • Added User-Agent header configuration in the sync get_openai_client method
  • Updated docstring to document the automatic User-Agent header inclusion

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.

3 participants