本页还没有译文
本页 35 段还没译成한국어,下面显示的是英文原文。Microsoft integrations
还没翻译译自英文(docs.langchain.com)本页 35 段都还没译
All functionality related to Microsoft Azure and other Microsoft products.
Chat models
Azure OpenAI
See a usage example
import { AzureChatOpenAI } from "@langchain/openai";
const model = new AzureChatOpenAI({
temperature: 0.9,
azureOpenAIApiKey: "<your_key>", // In Node.js defaults to process.env.AZURE_OPENAI_API_KEY
azureOpenAIApiInstanceName: "<your_instance_name>", // In Node.js defaults to process.env.AZURE_OPENAI_API_INSTANCE_NAME
azureOpenAIApiDeploymentName: "<your_deployment_name>", // In Node.js defaults to process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME
azureOpenAIApiVersion: "<api_version>", // In Node.js defaults to process.env.AZURE_OPENAI_API_VERSION
});LLM
Azure OpenAI
Microsoft Azure, often referred to as
Azureis a cloud computing platform run byMicrosoft, which offers access, management, and development of applications and services through global data centers. It provides a range of capabilities, including software as a service (SaaS), platform as a service (PaaS), and infrastructure as a service (IaaS).Microsoft Azuresupports many programming languages, tools, and frameworks, including Microsoft-specific and third-party software and systems.
Azure OpenAI is a cloud service to help you quickly develop generative AI experiences with a diverse set of prebuilt and curated models from OpenAI, Meta and beyond.
LangChain.js supports integration with Azure OpenAI using the new Azure integration in the OpenAI SDK.
You can learn more about Azure OpenAI and its difference with the OpenAI API on this page. If you don't have an Azure account, you can create a free account to get started.
You'll need to have an Azure OpenAI instance deployed. You can deploy a version on Azure Portal following this guide.
Once you have your instance running, make sure you have the name of your instance and key. You can find the key in the Azure Portal, under the "Keys and Endpoint" section of your instance.
If you're using Node.js, you can define the following environment variables to use the service:
AZURE_OPENAI_API_INSTANCE_NAME=<YOUR_INSTANCE_NAME>
AZURE_OPENAI_API_DEPLOYMENT_NAME=<YOUR_DEPLOYMENT_NAME>
AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME=<YOUR_EMBEDDINGS_DEPLOYMENT_NAME>
AZURE_OPENAI_API_KEY=<YOUR_KEY>
AZURE_OPENAI_API_VERSION="2024-02-01"Info
You can find the list of supported API versions in the Azure OpenAI documentation.
npm install @langchain/openai @langchain/coreSee a usage example.
import { AzureOpenAI } from "@langchain/openai";
const model = new AzureOpenAI({
azureOpenAIApiKey: "<your_key>", // In Node.js defaults to process.env.AZURE_OPENAI_API_KEY
azureOpenAIApiInstanceName: "<your_instance_name>", // In Node.js defaults to process.env.AZURE_OPENAI_API_INSTANCE_NAME
azureOpenAIApiDeploymentName: "<your_deployment_name>", // In Node.js defaults to process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME
azureOpenAIApiVersion: "<api_version>", // In Node.js defaults to process.env.AZURE_OPENAI_API_VERSION
});Text embedding models
Azure OpenAI
See a usage example
import { AzureOpenAIEmbeddings } from "@langchain/openai";
const model = new AzureOpenAIEmbeddings({
azureOpenAIApiKey: "<your_key>", // In Node.js defaults to process.env.AZURE_OPENAI_API_KEY
azureOpenAIApiInstanceName: "<your_instance_name>", // In Node.js defaults to process.env.AZURE_OPENAI_API_INSTANCE_NAME
azureOpenAIApiEmbeddingsDeploymentName: "<your_embeddings_deployment_name>", // In Node.js defaults to process.env.AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME
azureOpenAIApiVersion: "<api_version>", // In Node.js defaults to process.env.AZURE_OPENAI_API_VERSION
});Vector stores
Azure cosmos DB for NoSQL
Azure Cosmos DB for NoSQL provides support for querying items with flexible schemas and native support for JSON. It now offers vector indexing and search. This feature is designed to handle high-dimensional vectors, enabling efficient and accurate vector search at any scale. You can now store vectors directly in the documents alongside your data. Each document in your database can contain not only traditional schema-free data, but also high-dimensional vectors as other properties of the documents.
npm install @langchain/azure-cosmosdb @langchain/coreSee a usage example.
import { AzureCosmosDBNoSQLVectorStore } from "@langchain/azure-cosmosdb";Azure DocumentDB
Azure DocumentDB (formerly Azure Cosmos DB for MongoDB vCore) 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 connection string. Use vector search in Azure DocumentDB to seamlessly integrate your AI-based applications with your data that's stored in Azure DocumentDB.
npm install @langchain/azure-cosmosdb @langchain/coreSee a usage example.
import { AzureDocumentDBVectorStore } from "@langchain/azure-cosmosdb";Semantic cache
Azure cosmos DB NoSQL Semantic cache
The Semantic Cache feature is supported with Azure Cosmos DB for NoSQL integration, enabling users to retrieve cached responses based on semantic similarity between the user input and previously cached results. It leverages AzureCosmosDBNoSQLVectorStore, which stores vector embeddings of cached prompts. These embeddings enable similarity-based searches, allowing the system to retrieve relevant cached results.
npm install @langchain/azure-cosmosdb @langchain/coreSee a usage example.
import { AzureCosmosDBNoSQLSemanticCache } from "@langchain/azure-cosmosdb";Tools
Azure Container apps dynamic sessions
Azure Container Apps dynamic sessions provide fast access to secure sandboxed environments that are ideal for running code or applications that require strong isolation from other workloads.
npm install @langchain/azure-dynamic-sessions @langchain/coreSee a usage example.
import { SessionsPythonREPLTool } from "@langchain/azure-dynamic-sessions";