Skip to main content

Documentation Index

Fetch the complete documentation index at: https://nvd-54.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

本页面涵盖了 LangChain 与Microsoft Azure and its related projects. Integration packages for Azure AI, Dynamic Sessions, SQL Server are maintained in the langchain-azure repository.

聊天模型

We recommend developers start with the (langchain-azure-ai) to access all the models available in Azure AI Foundry.

Azure AI chat completions

Access models like Azure OpenAI, DeepSeek R1, Cohere, Phi and Mistral 使用 AzureAIOpenAIApiChatModel class.
pip install -U langchain-azure-ai
Configure your endpoint. You can use a project endpoint with DefaultAzureCredential, or set an API key directly.
export AZURE_AI_PROJECT_ENDPOINT=your-project-endpoint
from langchain_azure_ai.chat_models import AzureAIOpenAIApiChatModel
from azure.identity import DefaultAzureCredential

llm = AzureAIOpenAIApiChatModel(
    model="gpt-5.4",
    credential=DefaultAzureCredential(),
)

llm.invoke('Tell me a joke and include some emojis')

向量嵌入模型

Azure AI model inference for embeddings

pip install -U langchain-azure-ai
Configure your endpoint. You can use a project endpoint with DefaultAzureCredential, or set an API key directly.
export AZURE_AI_PROJECT_ENDPOINT=your-project-endpoint
from langchain_azure_ai.embeddings import AzureAIOpenAIApiEmbeddingsModel
from azure.identity import DefaultAzureCredential

embed_model = AzureAIOpenAIApiEmbeddingsModel(
    model="text-embedding-ada-002",
    credential=DefaultAzureCredential(),
)

向量存储

Azure CosmosDB NoSQL is a fully managed, globally distributed, serverless document database for modern applications. It stores data in flexible JSON documents and uses a SQL-like query language. 这提供了 high performance, low latency, and automatic, elastic scalability. It also features integrated vector search capabilities for AI workloads like generative AI and RAG. 这允许您 store, index, and query vector embeddings alongside your operational data in the same database. You can combine vector similarity search with traditional keyword-based search for relevant results and choose from various indexing methods for optimal performance. This unified approach simplifies application architecture and ensures data consistency.
我们需要安装 langchain-azure-cosmosdb and azure-cosmos packages to use this vector store.
pip install -qU langchain-azure-cosmosdb azure-cosmos
from langchain_azure_cosmosdb import AzureCosmosDBNoSqlVectorSearch

vector_search = AzureCosmosDBNoSqlVectorSearch.from_documents(
    documents=docs,
    embedding=openai_embeddings,
    cosmos_client=cosmos_client,
    database_name=database_name,
    container_name=container_name,
    vector_embedding_policy=vector_embedding_policy,
    full_text_policy=full_text_policy,
    indexing_policy=indexing_policy,
    cosmos_container_properties=cosmos_container_properties,
    cosmos_database_properties={},
    full_text_search_enabled=True,
)
查看使用示例.
Azure CosmosDB Mongo vCore architecture makes it easy to create a database with full native MongoDB support. You can apply your MongoDB experience and continue to use your favorite MongoDB drivers, SDKs, and tools by pointing your application to the API for MongoDB (vCore) cluster’s connection string.
我们需要安装 pymongo package to use this vector store.
pip install -qU pymongo
from langchain_azure_ai.vectorstores.azure_cosmos_db_mongo_vcore import (
    AzureCosmosDBMongoVCoreVectorSearch,
)

vectorstore = AzureCosmosDBMongoVCoreVectorSearch.from_documents(
    docs,
    openai_embeddings,
    collection=collection,
    index_name=INDEX_NAME,
)
查看使用示例.