跳到主要内容
Open on GitHub

Microsoft

Microsoft Azure 和其他 Microsoft 产品相关的所有功能。

聊天模型

Azure OpenAI

Microsoft Azure,通常称为 Azure,是由 Microsoft 运行的云计算平台,通过全球数据中心提供对应用程序和服务的访问、管理和开发。它提供一系列功能,包括软件即服务 (SaaS)、平台即服务 (PaaS) 和基础设施即服务 (IaaS)。Microsoft Azure 支持多种编程语言、工具和框架,包括 Microsoft 特定的和第三方软件及系统。

Azure OpenAI 是一项 Azure 服务,它利用来自 OpenAI 的强大语言模型,包括 GPT-3CodexEmbeddings model 系列,用于内容生成、摘要、语义搜索以及自然语言到代码的翻译。

pip install langchain-openai

设置环境变量以访问 Azure OpenAI 服务。

import os

os.environ["AZURE_OPENAI_ENDPOINT"] = "https://<your-endpoint.openai.azure.com/"
os.environ["AZURE_OPENAI_API_KEY"] = "your AzureOpenAI key"

查看使用示例

from langchain_openai import AzureChatOpenAI
API 参考:AzureChatOpenAI

Azure ML 聊天在线端点

请参阅此处的文档,以了解如何访问由 Azure Machine Learning 托管的聊天模型。

LLM

Azure ML

查看使用示例

from langchain_community.llms.azureml_endpoint import AzureMLOnlineEndpoint

Azure OpenAI

查看使用示例

from langchain_openai import AzureOpenAI
API 参考:AzureOpenAI

嵌入模型

Azure OpenAI

查看使用示例

from langchain_openai import AzureOpenAIEmbeddings

文档加载器

Azure AI 数据

Azure AI Studio 提供将数据资产上传到云存储以及从以下源注册现有数据资产的功能

  • Microsoft OneLake
  • Azure Blob Storage
  • Azure Data Lake gen 2

首先,您需要安装几个 python 包。

pip install azureml-fsspec, azure-ai-generative

查看使用示例

from langchain.document_loaders import AzureAIDataLoader
API 参考:AzureAIDataLoader

Azure AI 文档智能

Azure AI 文档智能(以前称为 Azure Form Recognizer)是一项基于机器学习的服务,可从数字或扫描的 PDF、图像、Office 和 HTML 文件中提取文本(包括手写)、表格、文档结构和键值对。

文档智能支持 PDFJPEG/JPGPNGBMPTIFFHEIFDOCXXLSXPPTXHTML

首先,您需要安装一个 python 包。

pip install azure-ai-documentintelligence

查看使用示例

from langchain.document_loaders import AzureAIDocumentIntelligenceLoader

Azure Blob Storage

Azure Blob Storage 是 Microsoft 针对云的对象存储解决方案。Blob Storage 经过优化,可用于存储大量非结构化数据。非结构化数据是不符合特定数据模型或定义的数据,例如文本或二进制数据。

Azure Files 在云中提供完全托管的文件共享,可通过行业标准服务器消息块 (SMB) 协议、网络文件系统 (NFS) 协议和 Azure Files REST API 访问。Azure Files 基于 Azure Blob Storage

Azure Blob Storage 专为以下用途而设计:

  • 直接向浏览器提供图像或文档。
  • 存储文件以进行分布式访问。
  • 流式传输视频和音频。
  • 写入日志文件。
  • 存储数据以进行备份和还原、灾难恢复和存档。
  • 存储数据以供本地部署或 Azure 托管的服务进行分析。
pip install azure-storage-blob

查看 Azure Blob Storage 的使用示例

from langchain_community.document_loaders import AzureBlobStorageContainerLoader

查看 Azure Files 的使用示例

from langchain_community.document_loaders import AzureBlobStorageFileLoader

Microsoft OneDrive

Microsoft OneDrive(以前称为 SkyDrive)是由 Microsoft 运营的文件托管服务。

首先,您需要安装一个 python 包。

pip install o365

查看使用示例

from langchain_community.document_loaders import OneDriveLoader
API 参考:OneDriveLoader

Microsoft OneDrive 文件

Microsoft OneDrive(以前称为 SkyDrive)是由 Microsoft 运营的文件托管服务。

首先,您需要安装一个 python 包。

pip install o365
from langchain_community.document_loaders import OneDriveFileLoader
API 参考:OneDriveFileLoader

Microsoft Word

Microsoft Word 是 Microsoft 开发的文字处理器。

查看使用示例

from langchain_community.document_loaders import UnstructuredWordDocumentLoader

Microsoft Excel

Microsoft Excel 是 Microsoft 为 Windows、macOS、Android、iOS 和 iPadOS 开发的电子表格编辑器。它具有计算或运算功能、图表工具、数据透视表以及名为 Visual Basic for Applications (VBA) 的宏编程语言。Excel 是 Microsoft 365 软件套件的一部分。

UnstructuredExcelLoader 用于加载 Microsoft Excel 文件。加载器同时适用于 .xlsx.xls 文件。页面内容将是 Excel 文件的原始文本。如果您在 "elements" 模式下使用加载器,则 Excel 文件的 HTML 表示将在文档元数据中的 text_as_html 键下可用。

查看使用示例

from langchain_community.document_loaders import UnstructuredExcelLoader

Microsoft SharePoint

Microsoft SharePoint 是一个基于网站的协作系统,它使用工作流应用程序、“列表”数据库和其他 Web 部件和安全功能来增强业务团队的协作能力,由 Microsoft 开发。

查看使用示例

from langchain_community.document_loaders.sharepoint import SharePointLoader
API 参考:SharePointLoader

Microsoft PowerPoint

Microsoft PowerPoint 是 Microsoft 的演示程序。

查看使用示例

from langchain_community.document_loaders import UnstructuredPowerPointLoader

Microsoft OneNote

首先,让我们安装依赖项

pip install bs4 msal

查看使用示例

from langchain_community.document_loaders.onenote import OneNoteLoader
API 参考:OneNoteLoader

Playwright URL 加载器

Playwright 是由 Microsoft 开发的开源自动化工具,允许您以编程方式控制和自动化 Web 浏览器。它专为端到端测试、抓取和自动化跨各种 Web 浏览器(如 ChromiumFirefoxWebKit)的任务而设计。

首先,让我们安装依赖项

pip install playwright unstructured

请参阅使用示例

from langchain_community.document_loaders.onenote import OneNoteLoader
API 参考:OneNoteLoader

向量存储

Azure Cosmos DB

AI 代理可以依赖 Azure Cosmos DB 作为统一的内存系统解决方案,享受速度、规模和简易性。此服务成功地使 OpenAI 的 ChatGPT 服务能够以高可靠性和低维护动态扩展。它由原子记录序列引擎驱动,是世界上第一个全局分布式NoSQL关系型向量数据库服务,并提供无服务器模式。

以下是两个可用的 Azure Cosmos DB API,可以提供向量存储功能。

Azure Cosmos DB for MongoDB (vCore)

Azure Cosmos DB for MongoDB vCore 使创建具有完整原生 MongoDB 支持的数据库变得容易。您可以通过将应用程序指向 API for MongoDB vCore 帐户的连接字符串,应用您的 MongoDB 经验并继续使用您最喜欢的 MongoDB 驱动程序、SDK 和工具。在 Azure Cosmos DB for MongoDB vCore 中使用向量搜索,将您的 AI 应用程序与存储在 Azure Cosmos DB 中的数据无缝集成。

安装和设置

请参阅详细配置说明

我们需要安装 pymongo python 包。

pip install pymongo
在 Microsoft Azure 上部署 Azure Cosmos DB

Azure Cosmos DB for MongoDB vCore 为开发人员提供完全托管的 MongoDB 兼容数据库服务,用于构建具有熟悉架构的现代应用程序。

借助 Cosmos DB for MongoDB vCore,开发人员在迁移现有应用程序或构建新应用程序时,可以享受原生 Azure 集成、低总拥有成本 (TCO) 和熟悉的 vCore 架构的优势。

免费注册,立即开始使用。

请参阅使用示例

from langchain_community.vectorstores import AzureCosmosDBVectorSearch

Azure Cosmos DB NoSQL

Azure Cosmos DB for NoSQL 现在提供预览版的向量索引和搜索。此功能旨在处理高维向量,从而实现任何规模的高效准确的向量搜索。您现在可以将向量直接存储在文档中以及您的数据旁边。这意味着数据库中的每个文档不仅可以包含传统的无模式数据,还可以包含高维向量作为文档的其他属性。数据和向量的这种共置允许高效的索引和搜索,因为向量与它们所代表的数据存储在相同的逻辑单元中。这简化了数据管理、AI 应用程序架构和基于向量的操作的效率。

安装和设置

请参阅详细配置说明

我们需要安装 azure-cosmos python 包。

pip install azure-cosmos
在 Microsoft Azure 上部署 Azure Cosmos DB

Azure Cosmos DB 通过动态和弹性自动缩放提供非常快速的响应,为现代应用程序和智能工作负载提供解决方案。它在每个 Azure 区域都可用,并且可以自动将数据复制到更靠近用户的位置。它具有 SLA 保证的低延迟和高可用性。

免费注册,立即开始使用。

请参阅使用示例

from langchain_community.vectorstores import AzureCosmosDBNoSQLVectorSearch

Azure Database for PostgreSQL

Azure Database for PostgreSQL - 灵活服务器 是一项基于开源 Postgres 数据库引擎的关系数据库服务。它是一种完全托管的数据库即服务,可以处理具有可预测的性能、安全性、高可用性和动态可扩展性的关键任务工作负载。

请参阅 Azure Database for PostgreSQL 的设置说明

请参阅使用示例。只需使用 Azure 门户中的连接字符串即可。

由于 Azure Database for PostgreSQL 是开源 Postgres,因此您可以使用LangChain 的 Postgres 支持连接到 Azure Database for PostgreSQL。

Azure SQL 数据库

Azure SQL 数据库 是一项强大的服务,它结合了可伸缩性、安全性和高可用性,提供了现代数据库解决方案的所有优势。它还提供了专用的 Vector 数据类型和内置函数,简化了关系数据库中向量嵌入的存储和查询。这消除了对单独的向量数据库和相关集成的需求,提高了解决方案的安全性,同时降低了总体复杂性。

通过利用您当前的 SQL Server 数据库进行向量搜索,您可以增强数据功能,同时最大限度地减少开支并避免过渡到新系统的挑战。

安装和设置

请参阅详细配置说明

我们需要安装 langchain-sqlserver python 包。

!pip install langchain-sqlserver==0.1.1
在 Microsoft Azure 上部署 Azure SQL DB

免费注册,立即开始使用。

请参阅使用示例

from langchain_sqlserver import SQLServer_VectorStore

Azure AI 搜索 是一项云搜索服务,为开发人员提供基础结构、API 和工具,用于大规模信息检索向量、关键字和混合查询。请参阅此处的使用示例。

from langchain_community.vectorstores.azuresearch import AzureSearch
API 参考:AzureSearch

检索器

Azure AI 搜索

Azure AI 搜索(以前称为 Azure SearchAzure Cognitive Search)是一项云搜索服务,为开发人员提供基础结构、API 和工具,用于在 Web、移动和企业应用程序中构建跨私有异构内容的丰富搜索体验。

搜索是任何向用户呈现文本的应用程序的基础,常见的场景包括目录或文档搜索、在线零售应用程序或专有内容的数据探索。当您创建搜索服务时,您将使用以下功能

  • 用于对包含用户拥有的内容的搜索索引进行全文搜索的搜索引擎
  • 丰富的索引编制,具有词法分析和可选的 AI 增强功能,用于内容提取和转换
  • 用于文本搜索、模糊搜索、自动完成、地理搜索等的丰富查询语法
  • 通过 REST API 和 Azure SDK 中的客户端库进行可编程性
  • 数据层、机器学习层和 AI(AI 服务)的 Azure 集成

请参阅设置说明

请参阅使用示例

from langchain_community.retrievers import AzureAISearchRetriever

向量存储

Azure Database for PostgreSQL

Azure Database for PostgreSQL - 灵活服务器 是一项基于开源 Postgres 数据库引擎的关系数据库服务。它是一种完全托管的数据库即服务,可以处理具有可预测的性能、安全性、高可用性和动态可扩展性的关键任务工作负载。

请参阅 Azure Database for PostgreSQL 的设置说明

您需要在数据库中启用 pgvector 扩展才能将 Postgres 用作向量存储。启用扩展后,您可以使用LangChain 中的 PGVector 连接到 Azure Database for PostgreSQL。

请参阅使用示例。只需使用 Azure 门户中的连接字符串即可。

工具

Azure Container Apps 动态会话

我们需要从 Azure Container Apps 服务获取 POOL_MANAGEMENT_ENDPOINT 环境变量。请参阅此处的说明

我们需要安装一个 python 包。

pip install langchain-azure-dynamic-sessions

请参阅使用示例

from langchain_azure_dynamic_sessions import SessionsPythonREPLTool

请关注此处的文档,以获取此工具的详细说明和说明。

BING_SUBSCRIPTION_KEYBING_SEARCH_URL 环境变量是必应搜索资源所必需的。

from langchain_community.tools.bing_search import BingSearchResults
from langchain_community.utilities import BingSearchAPIWrapper

api_wrapper = BingSearchAPIWrapper()
tool = BingSearchResults(api_wrapper=api_wrapper)

工具包

Azure AI 服务

我们需要安装几个 python 包。

pip install azure-ai-formrecognizer azure-cognitiveservices-speech azure-ai-vision-imageanalysis

请参阅使用示例

from langchain_community.agent_toolkits import azure_ai_services
API 参考:azure_ai_services

Azure AI 服务个别工具

azure_ai_services 工具包包括以下工具

Azure 认知服务

我们需要安装几个 python 包。

pip install azure-ai-formrecognizer azure-cognitiveservices-speech azure-ai-vision-imageanalysis

请参阅使用示例

from langchain_community.agent_toolkits import AzureCognitiveServicesToolkit

Azure AI 服务个别工具

azure_ai_services 工具包包括查询 Azure Cognitive Services 的工具

  • AzureCogsFormRecognizerTool:表单识别器 API
  • AzureCogsImageAnalysisTool:图像分析 API
  • AzureCogsSpeech2TextTool:Speech2Text API
  • AzureCogsText2SpeechTool:Text2Speech API
  • AzureCogsTextAnalyticsHealthTool:健康文本分析 API
from langchain_community.tools.azure_cognitive_services import (
AzureCogsFormRecognizerTool,
AzureCogsImageAnalysisTool,
AzureCogsSpeech2TextTool,
AzureCogsText2SpeechTool,
AzureCogsTextAnalyticsHealthTool,
)

Microsoft Office 365 电子邮件和日历

我们需要安装 O365 python 包。

pip install O365

请参阅使用示例

from langchain_community.agent_toolkits import O365Toolkit
API 参考:O365Toolkit

Office 365 个别工具

您可以使用 Office 365 工具包中的个别工具

  • O365CreateDraftMessage:在 Office 365 中创建草稿电子邮件
  • O365SearchEmails:在 Office 365 中搜索电子邮件
  • O365SearchEvents:在 Office 365 中搜索日历事件
  • O365SendEvent:在 Office 365 中发送日历事件
  • O365SendMessage:在 Office 365 中发送电子邮件
from langchain_community.tools.office365 import O365CreateDraftMessage
from langchain_community.tools.office365 import O365SearchEmails
from langchain_community.tools.office365 import O365SearchEvents
from langchain_community.tools.office365 import O365SendEvent
from langchain_community.tools.office365 import O365SendMessage

Microsoft Azure PowerBI

我们需要安装 azure-identity python 包。

pip install azure-identity

请参阅使用示例

from langchain_community.agent_toolkits import PowerBIToolkit
from langchain_community.utilities.powerbi import PowerBIDataset

PowerBI 个别工具

您可以使用 Azure PowerBI 工具包中的个别工具

  • InfoPowerBITool:获取有关 PowerBI 数据集的元数据
  • ListPowerBITool:获取表名
  • QueryPowerBITool:查询 PowerBI 数据集
from langchain_community.tools.powerbi.tool import InfoPowerBITool
from langchain_community.tools.powerbi.tool import ListPowerBITool
from langchain_community.tools.powerbi.tool import QueryPowerBITool

PlayWright 浏览器工具包

Playwright 是由 Microsoft 开发的开源自动化工具,允许您以编程方式控制和自动化 Web 浏览器。它专为端到端测试、抓取和自动化跨各种 Web 浏览器(如 ChromiumFirefoxWebKit)的任务而设计。

我们需要安装几个 python 包。

pip install playwright lxml

请参阅使用示例

from langchain_community.agent_toolkits import PlayWrightBrowserToolkit

PlayWright 浏览器个别工具

您可以使用 PlayWright 浏览器工具包中的个别工具。

from langchain_community.tools.playwright import ClickTool
from langchain_community.tools.playwright import CurrentWebPageTool
from langchain_community.tools.playwright import ExtractHyperlinksTool
from langchain_community.tools.playwright import ExtractTextTool
from langchain_community.tools.playwright import GetElementsTool
from langchain_community.tools.playwright import NavigateTool
from langchain_community.tools.playwright import NavigateBackTool

Azure Cosmos DB for Apache Gremlin

我们需要安装一个 python 包。

pip install gremlinpython

请参阅使用示例

from langchain_community.graphs import GremlinGraph
from langchain_community.graphs.graph_document import GraphDocument, Node, Relationship

实用程序

必应搜索 API

Microsoft Bing,通常被称为 BingBing Search,是由 Microsoft 拥有和运营的 Web 搜索引擎。

请参阅使用示例

from langchain_community.utilities import BingSearchAPIWrapper

更多

Microsoft Presidio

Presidio(源自拉丁语 praesidium ‘保护,驻军’)有助于确保敏感数据得到妥善管理和治理。它为文本和图像中的私有实体(如信用卡号、姓名、位置、社会安全号码、比特币钱包、美国电话号码、财务数据等)提供快速识别和匿名化模块。

首先,您需要安装几个 python 包并下载 SpaCy 模型。

pip install langchain-experimental openai presidio-analyzer presidio-anonymizer spacy Faker
python -m spacy download en_core_web_lg

请参阅使用示例

from langchain_experimental.data_anonymizer import PresidioAnonymizer, PresidioReversibleAnonymizer

此页内容对您有帮助吗?