Skip to content

AzureOpenAIEmbeddings with Azure Entra-Id Authentication #16922

Answered by dosubot bot
thusithaC asked this question in Q&A
Discussion options

You must be logged in to vote

🤖

Hey @thusithaC, back at it with another interesting challenge, I see! Good to have you around.

Based on the LangChain codebase, it appears that the AzureOpenAIEmbeddings class does support Azure AD token-based authentication. This can be done either directly using the azure_ad_token field or via a function provided to the azure_ad_token_provider field.

Here's an example of how you can use the azure_ad_token_provider field:

from langchain_openai import AzureOpenAIEmbeddings

def my_token_provider():
    # Your logic to get the Azure AD token
    return "your_azure_ad_token"

openai = AzureOpenAIEmbeddings(
    model="text-embedding-3-large", 
    azure_ad_token_provider=my_token_provider
)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@thusithaC
Comment options

Answer selected by thusithaC
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants