Skip to content

Conversation

@marlenezw
Copy link
Contributor

@marlenezw marlenezw commented Oct 28, 2025

Overview

This PR adds documentation for the new callable API key feature in ChatOpenAI, OpenAI, and OpenAIEmbeddings classes, introduced in langchain-ai/langchain#33532.

The documentation covers:

  • Using ChatOpenAI and OpenAIEmbeddings with Azure OpenAI's new v1 API endpoints
  • Microsoft Entra ID (formerly Azure AD) authentication with automatic token refresh
  • Custom callable API keys for dynamic key retrieval (sync and async)

Type of change

Type: Update existing documentation

Related issues/PRs

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using make lint_md
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed (not applicable - added sections to existing pages)
  • I have gotten approval from the relevant reviewers
  • (Internal team members only / optional) I have created a preview deployment using the Create Preview Branch workflow

Additional notes

Changes made:

  1. src/oss/python/integrations/chat/openai.mdx:

    • Added comprehensive "Using with Azure OpenAI" section with three subsections:
      • Using Azure OpenAI v1 API with API Key
      • Using Azure OpenAI with Microsoft Entra ID
      • Custom callable API keys (sync and async)
    • Fixed typo ("instaed" → "instead")
  2. src/oss/python/integrations/chat/azure_chat_openai.mdx:

    • Added info box explaining the new Azure OpenAI v1 API option
    • Cross-referenced the ChatOpenAI documentation for v1 API usage
    • Clarified that AzureChatOpenAI remains supported for traditional API versions
  3. src/oss/python/integrations/text_embedding/openai.mdx:

    • Added "Using with Azure OpenAI" section mirroring the structure in ChatOpenAI docs
    • Included examples for API key auth, Entra ID auth, and custom callables

Key features documented:

  • Callable API keys: Functions (sync or async) can now be passed as the api_key parameter
  • Azure v1 API: Direct usage of ChatOpenAI with Azure endpoints using /openai/v1/ path
  • Token providers: Automatic token refresh using get_bearer_token_provider from Azure Identity
  • Async support: Proper handling of async callables with async methods

All markdown linting issues have been addressed, and no new linting errors were introduced.

@marlenezw marlenezw requested a review from mdrxy as a code owner October 28, 2025 12:14
Copilot AI review requested due to automatic review settings October 28, 2025 12:14
@github-actions github-actions bot added langchain For docs changes to LangChain python For content related to the Python version of LangChain projects oss labels Oct 28, 2025
@marlenezw marlenezw changed the title Adding in DocumengOpenAI callable docs Adding in Documentation for using Azure Default Credential Callable with OpenAI Oct 28, 2025
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 documentation for using ChatOpenAI and OpenAIEmbeddings with Azure OpenAI's v1 API, including Microsoft Entra ID authentication support. The changes introduce new sections explaining how to configure these classes for Azure endpoints while maintaining backward compatibility references to the Azure-specific implementations.

Key changes:

  • Added comprehensive Azure OpenAI v1 API usage documentation for both chat and embeddings
  • Documented Microsoft Entra ID authentication with token provider callables
  • Added informational notes about the new v1 API across relevant pages
  • Fixed a typo in the ChatOpenAI documentation

Reviewed Changes

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

File Description
src/oss/python/integrations/text_embedding/openai.mdx Added new "Using with Azure OpenAI" section documenting v1 API support with API key and Microsoft Entra ID authentication methods
src/oss/python/integrations/chat/openai.mdx Added new "Using with Azure OpenAI" section with similar authentication patterns and fixed spelling typo ("instaed" → "instead")
src/oss/python/integrations/chat/azure_chat_openai.mdx Added informational banner about v1 API availability and recommendations for migrating to newer approaches

@marlenezw marlenezw changed the title Adding in Documentation for using Azure Default Credential Callable with OpenAI docs: Adding in Docs for using Azure Default Credential Callable with OpenAI Oct 28, 2025
Copilot AI review requested due to automatic review settings October 28, 2025 12:19
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

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

Copilot AI review requested due to automatic review settings October 28, 2025 12:24
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@ccurme ccurme merged commit 20b0078 into langchain-ai:main Oct 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

langchain For docs changes to LangChain oss python For content related to the Python version of LangChain projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants