Skip to main content

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

LLMs

Azure ML

查看 使用示例

from langchain_community.llms.azureml_endpoint import AzureMLOnlineEndpoint

Azure OpenAI

查看 使用示例.

from langchain_openai import 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

Azure AI Document Intelligence

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

Document Intelligence 支持 PDFJPEG/JPGPNGBMPTIFFHEIFDOCXXLSXPPTXHTML

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

pip install azure-ai-documentintelligence

查看 使用示例

from langchain.document_loaders import AzureAIDocumentIntelligenceLoader

Azure Blob Storage

Azure Blob Storage 是微软的云对象存储解决方案。Blob 存储经过优化,适合存储大量非结构化数据。非结构化数据是指不遵循特定数据模型或定义的数据,例如文本或二进制数据。

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)是由微软运营的文件托管服务。

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

pip install o365

查看 使用示例

from langchain_community.document_loaders import OneDriveLoader

Microsoft OneDrive 文件

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

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

pip install o365
from langchain_community.document_loaders import OneDriveFileLoader

Microsoft Word

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

查看 使用示例.

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 是一个基于网站的协作系统,利用工作流应用程序、“列表”数据库以及其他网页组件和安全功能,帮助商业团队协同工作,由微软开发。

查看使用示例

from langchain_community.document_loaders.sharepoint import SharePointLoader

Microsoft PowerPoint

Microsoft PowerPoint 是微软的一款演示文稿程序。

查看 使用示例

from langchain_community.document_loaders import UnstructuredPowerPointLoader

Microsoft OneNote

首先,让我们安装依赖项:

pip install bs4 msal

查看使用示例

from langchain_community.document_loaders.onenote import OneNoteLoader

AI代理记忆系统

AI代理 需要强大的记忆系统,以支持多模态,提供强大的操作性能,并实现代理记忆的共享与分离。

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

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

Azure Cosmos DB for MongoDB (vCore)

Azure Cosmos DB for MongoDB vCore 使创建一个完全原生支持 MongoDB 的数据库变得简单。
您可以利用您的 MongoDB 经验,并通过将应用程序指向 MongoDB vCore 账户的连接字符串,继续使用您喜欢的 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 现在提供预览版的向量索引和搜索功能。该功能旨在处理高维向量,实现高效且准确的向量搜索,无论规模如何。您现在可以直接在文档中存储向量,与您的数据并存。这意味着数据库中的每个文档不仅可以包含传统的无模式数据,还可以作为文档的其他属性包含高维向量。数据和向量的共存使得高效的索引和搜索成为可能,因为向量与其所表示的数据存储在同一逻辑单元中。这简化了数据管理、人工智能应用架构以及基于向量的操作的效率。

安装和设置

请参阅 详细配置说明

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

pip install azure-cosmos

在 Microsoft Azure 上部署 Azure Cosmos DB

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

注册 免费开始使用。

请参阅 使用示例

from langchain_community.vectorstores import AzureCosmosDBNoSQLVectorSearch

检索器

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

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

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

请参阅 设置说明

查看 使用示例

from langchain.retrievers import AzureAISearchRetriever

工具

Azure Container Apps 动态会话

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

我们需要安装一个 Python 包。

pip install langchain-azure-dynamic-sessions

请参阅 使用示例

from langchain_azure_dynamic_sessions import SessionsPythonREPLTool

Bing搜索

请按照这里的文档获取该工具的详细说明和使用说明。

需要从Bing搜索资源中获取环境变量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

Microsoft Office 365 邮件和日历

我们需要安装 O365 python 包。

pip install O365

查看 使用示例

from langchain_community.agent_toolkits import O365Toolkit

Microsoft Azure PowerBI

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

pip install azure-identity

查看 使用示例

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

图表

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

实用工具

Bing Search API

微软必应,通常称为 BingBing Search, 是由 Microsoft 拥有和运营的网络搜索引擎。

查看 使用示例

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

此页面是否有帮助?


您还可以留下详细的反馈 在 GitHub 上