你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
注意
Azure AI 搜索可通过Azure门户、REST API 和Azure SDK获取。 它也是 Foundry IQ 的基础;Foundry IQ 是一个托管式知识层,可将企业内容转化为供 Microsoft Foundry 门户中的智能体使用的、可复用且具备权限感知能力的知识库。
Important
标记为“预览”的特性、功能或属性不受服务级别协议 (SLA) 保障,不建议用于生产工作负载,并且在正式发布之前可能会更改或受到限制。 Azure AI 搜索预览条款适用于所有预览功能,无论是独立功能还是正式版功能的一部分。
已编制索引的 SharePoint 知识源(预览版)将 SharePoint 内容引入 Azure AI 搜索 中的代理式检索管道。 知识库是在运行时查询知识库时独立创建的、在知识库中引用的,并用作基础数据。
创建索引SharePoint知识源时,请指定SharePoint 连接字符串、模型和属性以自动生成以下Azure AI 搜索对象:
- 指向 SharePoint 站点并原样使用连接字符串的数据源。 生成的数据源遵循SharePoint索引器
TenantId的规则。 - 分块和可选向量化多模态内容的技能。
- 存储扩充内容并满足代理检索条件的索引。
- 使用前面的对象驱动索引和扩充管道的索引器。
生成的索引器符合Microsoft 365索引器中的SharePoint,其先决条件、支持的文档格式和限制也适用于索引SharePoint知识源。 有关详细信息,请参阅SharePoint索引器文档和索引器限制。 如果生成的技能集调用外部服务,该技能的输入和服务限制也适用。
使用支持
| Azure 门户 | Microsoft Foundry 门户 | .NET SDK | Python SDK | Java SDK | JavaScript SDK | REST API |
|---|---|---|---|---|---|---|
| ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
先决条件
在任意提供代理检索功能的区域中提供的 Azure AI 搜索服务。
完成以下SharePoint索引器配置步骤:
步骤 1:为 Azure AI 搜索 启用托管标识(仅在使用无密钥认证时才需要;如果使用客户端密码,请跳过)
第3步:创建 Microsoft Entra 应用程序注册(对于应用程序权限,还需配置 客户端密钥 或 无密钥认证)
如果
contentExtractionMode为standard,请在 Foundry Tools 中内容理解支持的区域以及 终结点中使用 Microsoft Foundry 资源https://<resource-name>.services.ai.azure.com。 部署嵌入模型,并在启用图像语言化时部署多模式聊天模型。创建知识源的权限。 使用分配给用户帐户的搜索服务参与者和搜索索引数据参与者角色(建议)或使用管理员 API 密钥配置无密钥身份验证。
如果知识来源为嵌入或图像描述指定了 Azure OpenAI 模型,则搜索服务必须具有托管标识,并且该标识在 Microsoft Foundry 资源上具有认知服务用户权限。
如果将
networkAccessMode设置为private,请完成以下要求:保留上述先决条件中所述的SharePoint 连接字符串、Microsoft Entra应用程序和SharePoint权限。 SharePoint Online 不是受支持的共享专用链接目标,因此专用模式不会使此源连接专用。
对于每个受保护的模型终结点,请在搜索服务上启用托管标识,在资源上授予 认知服务用户 角色,并创建和批准共享专用链接。 将
openai_account组 ID 用于 Azure OpenAI 终结点,将foundry_account用于 Foundry 资源终结点。
最新的
Azure.Search.Documents预览包:dotnet add package Azure.Search.Documents --prerelease对于无密钥身份验证,请使用
Azure.Identity软件包:dotnet add package Azure.Identity
最新的
azure-search-documents预览包:pip install --pre azure-search-documents对于无密钥身份验证,请使用
azure-identity软件包:pip install azure-identity
搜索服务 REST API 的 2026-08-01-preview 版本。
对于无密钥身份验证,请在每个 HTTP 请求的标头中包含
AuthorizationMicrosoft Entra ID令牌。
检查现有知识源
知识源是顶级可重用对象。 了解现有知识源有助于重复使用或命名新对象。
运行以下代码,按名称和类型列出知识源。
// List knowledge sources by name and type
using Azure.Search.Documents.Indexes;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential);
var knowledgeSources = indexClient.GetKnowledgeSourcesAsync();
Console.WriteLine("Knowledge Sources:");
await foreach (var ks in knowledgeSources)
{
Console.WriteLine($" Name: {ks.Name}, Type: {ks.GetType().Name}");
}
Reference:SearchIndexClient
# List knowledge sources by name and type
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key"))
for ks in index_client.list_knowledge_sources():
print(f" - {ks.name} ({ks.kind})")
Reference:SearchIndexClient
### List knowledge sources by name and type
GET {{search-url}}/knowledgesources?api-version={{api-version}}&$select=name,kind
Authorization: Bearer {{token}}
参考:知识源 - 列表
还可以按名称返回单个知识源以查看其 JSON 定义。
using Azure.Search.Documents.Indexes;
using System.Text.Json;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential);
// Specify the knowledge source name to retrieve
string ksNameToGet = "earth-knowledge-source";
// Get its definition
var knowledgeSourceResponse = await indexClient.GetKnowledgeSourceAsync(ksNameToGet);
var ks = knowledgeSourceResponse.Value;
// Serialize to JSON for display
var jsonOptions = new JsonSerializerOptions
{
WriteIndented = true,
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.Never
};
Console.WriteLine(JsonSerializer.Serialize(ks, ks.GetType(), jsonOptions));
Reference:SearchIndexClient
# Get a knowledge source definition
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
import json
index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key"))
ks = index_client.get_knowledge_source("knowledge_source_name")
print(json.dumps(ks.as_dict(), indent = 2))
Reference:SearchIndexClient
### Get a knowledge source definition
GET {{search-url}}/knowledgesources/{{knowledge-source-name}}?api-version={{api-version}}
Authorization: Bearer {{token}}
参考:知识源 - 获取
以下 JSON 是索引SharePoint知识源的示例响应。
{
"name": "my-indexed-sharepoint-ks",
"kind": "indexedSharePoint",
"description": "A sample indexed SharePoint knowledge source",
"encryptionKey": null,
"indexedSharePointParameters": {
"connectionString": "<redacted>",
"containerName": "defaultSiteLibrary",
"query": null,
"ingestionParameters": {
"disableImageVerbalization": false,
"ingestionPermissionOptions": [],
"contentExtractionMode": "minimal",
"identity": null,
"embeddingModel": {
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "<redacted>",
"deploymentId": "text-embedding-3-large",
"modelName": "text-embedding-3-large",
"authIdentity": null
}
},
"chatCompletionModel": null,
"ingestionSchedule": null,
"assetStore": null,
"aiServices": null
},
"createdResources": {
"datasource": "my-indexed-sharepoint-ks-datasource",
"indexer": "my-indexed-sharepoint-ks-indexer",
"skillset": "my-indexed-sharepoint-ks-skillset",
"index": "my-indexed-sharepoint-ks-index"
}
},
"indexedOneLakeParameters": null
}
创建知识源
运行以下代码以创建索引SharePoint知识源。
// Create an IndexedSharePoint knowledge source
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Indexes.Models;
using Azure.Search.Documents.KnowledgeBases.Models;
using Azure.Identity;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), new DefaultAzureCredential());
var chatCompletionParams = new AzureOpenAIVectorizerParameters
{
ResourceUri = new Uri(aoaiEndpoint),
DeploymentName = aoaiGptDeployment,
ModelName = aoaiGptModel
};
var embeddingParams = new AzureOpenAIVectorizerParameters
{
ResourceUri = new Uri(aoaiEndpoint),
DeploymentName = aoaiEmbeddingDeployment,
ModelName = aoaiEmbeddingModel
};
var ingestionParams = new KnowledgeSourceIngestionParameters
{
NetworkAccessMode = KnowledgeSourceNetworkAccessMode.Public,
DisableImageVerbalization = false,
ChatCompletionModel = new KnowledgeBaseAzureOpenAIModel(azureOpenAIParameters: chatCompletionParams),
EmbeddingModel = new KnowledgeSourceAzureOpenAIVectorizer
{
AzureOpenAIParameters = embeddingParams
}
};
var sharePointParams = new IndexedSharePointKnowledgeSourceParameters(
connectionString: sharePointConnectionString,
containerName: "defaultSiteLibrary")
{
IngestionParameters = ingestionParams
};
var knowledgeSource = new IndexedSharePointKnowledgeSource(
name: "my-indexed-sharepoint-ks",
indexedSharePointParameters: sharePointParams)
{
Description = "A sample indexed SharePoint knowledge source."
};
await indexClient.CreateOrUpdateKnowledgeSourceAsync(knowledgeSource);
Console.WriteLine($"Knowledge source '{knowledgeSource.Name}' created or updated successfully.");
Reference:SearchIndexClient、 IndexedSharePointKnowledgeSource
# Create an indexed SharePoint knowledge source
from azure.identity import DefaultAzureCredential
from azure.search.documents.indexes import SearchIndexClient
from azure.search.documents.indexes.models import IndexedSharePointKnowledgeSource, IndexedSharePointKnowledgeSourceParameters, KnowledgeBaseAzureOpenAIModel, AzureOpenAIVectorizerParameters, KnowledgeSourceContentExtractionMode
from azure.search.documents.knowledgebases.models import KnowledgeSourceIngestionParameters, KnowledgeSourceNetworkAccessMode, KnowledgeSourceAzureOpenAIVectorizer
index_client = SearchIndexClient(endpoint = "<search-endpoint>", credential = DefaultAzureCredential())
knowledge_source = IndexedSharePointKnowledgeSource(
name = "my-indexed-sharepoint-ks",
description = "A sample indexed SharePoint knowledge source.",
encryption_key = None,
indexed_share_point_parameters = IndexedSharePointKnowledgeSourceParameters(
connection_string = "connection_string",
container_name = "defaultSiteLibrary",
query = None,
ingestion_parameters = KnowledgeSourceIngestionParameters(
network_access_mode = KnowledgeSourceNetworkAccessMode.PUBLIC,
identity = None,
disable_image_verbalization = False,
chat_completion_model = KnowledgeBaseAzureOpenAIModel(
azure_open_ai_parameters = AzureOpenAIVectorizerParameters(
resource_url = "<aoai-endpoint>",
deployment_name = "<aoai-gpt-deployment>",
model_name = "<aoai-gpt-model>",
)
),
embedding_model = KnowledgeSourceAzureOpenAIVectorizer(
azure_open_ai_parameters=AzureOpenAIVectorizerParameters(
resource_url = "<aoai-endpoint>",
deployment_name = "<aoai-embedding-deployment>",
model_name = "<aoai-embedding-model>",
)
),
content_extraction_mode = KnowledgeSourceContentExtractionMode.MINIMAL,
ingestion_schedule = None,
ingestion_permission_options = None
)
)
)
index_client.create_or_update_knowledge_source(knowledge_source)
print(f"Knowledge source '{knowledge_source.name}' created or updated successfully.")
Reference:SearchIndexClient
### Create an indexed SharePoint knowledge source
PUT {{search-endpoint}}/knowledgesources/my-indexed-sharepoint-ks?api-version=2026-08-01-preview
Authorization: Bearer {{search-access-token}}
Content-Type: application/json
{
"name": "my-indexed-sharepoint-ks",
"kind": "indexedSharePoint",
"description": "A sample indexed SharePoint knowledge source.",
"encryptionKey": null,
"indexedSharePointParameters": {
"connectionString": "{{sharepoint-federated-connection-string}}",
"containerName": "defaultSiteLibrary",
"query": null,
"ingestionParameters": {
"networkAccessMode": "public",
"identity": null,
"embeddingModel": {
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"deploymentId": "text-embedding-3-large",
"modelName": "text-embedding-3-large",
"resourceUri": "{{aoai-endpoint}}"
}
},
"chatCompletionModel": null,
"disableImageVerbalization": false,
"ingestionSchedule": null,
"ingestionPermissionOptions": [],
"contentExtractionMode": "minimal"
}
}
}
参考:知识源 - 创建或更新
在引入期间保护Azure依赖项
从 2026-08-01-preview API 版本开始,networkAccessMode 控制为已编制索引的 SharePoint 知识源生成的索引器运行所在的网络环境。 此设置仅影响引入,不会更改知识库检索请求或响应。
networkAccessMode 默认为 public保留现有公共网络行为。 如果 networkAccessMode 为 private,生成的索引器在 专用执行环境中运行。 它使用批准的共享专用链接访问支持的Azure依赖项,例如Azure OpenAI 模型和 Microsoft Foundry 资源。
Important
对于索引SharePoint知识源,专用模式仅适用于受支持的Azure依赖项。 SharePoint Online 不是受支持的共享专用链接目标,因此SharePoint源连接保持公共状态。
若要配置和验证对支持的Azure依赖项的专用访问,
完成 专用网络先决条件。
在知识源创建请求中,将
networkAccessMode设置为private。 只能在创建过程中设置此属性。 若要稍后对其进行更改,请删除并重新创建知识源。如果服务层或运行时不支持专用执行,或者所需的共享专用链接不存在,则创建可能会失败。
确认生成的索引器
executionEnvironment为private.确认每个必需的共享专用链接都已获得批准,并针对正确的依赖项。 仅凭成功创建并不能确认链接已获批准或定向设置已生效。
轮询知识源状态,直到
lastSynchronizationState.endTime具有值。 确认itemsUpdatesFailed为0,然后验证特定于连接器的源内容。 如果无法访问依赖项,同步将失败。
使用自动按语言选择的分析器
从 2026-08-01-preview API 版本开始,针对 Blob、已编制索引的 OneLake 以及已编制索引的 SharePoint 知识源提供了按语言的自动分析器。 启用后,Azure AI 搜索检测每个源文档的语言,并自动应用匹配Microsoft语言分析器。 不会在知识源定义或查询中指定分析器。
若要启用每种语言的自动分析器,请在知识源定义中设置为contentExtractionModeminimal和配置ingestionParameters.aiServices。
对于无密钥身份验证,请省略 aiServices.apiKey,并在 Microsoft Foundry 资源上将 认知服务用户 角色分配给搜索服务的托管标识。 对于基于密钥的身份验证,请将 aiServices.apiKey 设置为您的 Foundry 资源的有效密钥。
支持以下语言:
- English
- 日语
- French
- Spanish
- German
- 荷兰语
- Italian
- 巴西葡萄牙语
- 欧洲葡萄牙语
- 简体中文
- 繁体中文
- Korean
对于多语言内容,Azure AI 搜索根据检测到的主要语言选择分析器。 当语言不受支持或不确定时,它使用标准分析器。
启用自动每种语言分析器时,Azure AI 搜索向生成的索引架构添加每个支持语言的语言特定内容字段,无论数据是否包含这些语言中的文档。 在摄取过程中,文档会根据检测到的语言被路由到相应的语言专用字段。
未使用的语言字段不包含索引内容,并且存储影响最小,但它们仍然是索引架构的一部分,并计入索引字段限制。 规划索引设计、字段计数和存储要求时,请考虑其他字段。 有关更多信息,请参阅索引限制和估算和管理搜索服务的容量。
语言检测在超出免费 AI 增强额度后将开始收费。 有关详细信息,请参阅 免费扩充。
检查摄取状态
运行以下代码来监视引入进度和运行状况,包括知识源类型以及生成索引器管道并填充搜索索引的知识源的详细索引错误。
using Azure.Search.Documents.Indexes;
using System.Text.Json;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), new AzureKeyCredential(apiKey));
// Get knowledge source ingestion status
var statusResponse = await indexClient.GetKnowledgeSourceStatusAsync(knowledgeSourceName);
var status = statusResponse.Value;
// Serialize to JSON for display
var json = JsonSerializer.Serialize(status, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(json);
Reference:SearchIndexClient
# Check knowledge source ingestion status
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
import json
index_client = SearchIndexClient(endpoint="search_url", credential=AzureKeyCredential("api_key"))
status = index_client.get_knowledge_source_status("knowledge_source_name")
print(json.dumps(status.as_dict(), indent=2))
Reference:SearchIndexClient
### Check knowledge source ingestion status
GET {{search-url}}/knowledgesources/{{knowledge-source-name}}/status?api-version={{api-version}}
Authorization: Bearer {{token}}
Content-Type: application/json
参考:知识源 - 获取状态
包含引入参数且正在主动引入内容的请求的响应可能如以下示例所示。
{
"kind": "azureBlob",
"synchronizationStatus": "active",
"synchronizationInterval": "1d",
"currentSynchronizationState": {
"startTime": "2026-04-10T19:30:00Z",
"itemUpdatesProcessed": 1100,
"itemsUpdatesFailed": 100,
"itemsSkipped": 1100,
"errors": [
{
"key": "Item id 1",
"docURL": "https://contoso.blob.core.windows.net/contracts/2024/Q4/doc-00023.csv",
"statusCode": 400,
"componentName": "DocumentExtraction.AzureBlob.MyDataSource",
"errorMessage": "Could not read the value of column 'foo' at index '0'.",
"details": "The file could not be parsed.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2049388"
}
]
},
"lastSynchronizationState": {
"status": "partialSuccess",
"startTime": "2026-04-09T19:30:00Z",
"endTime": "2026-04-09T19:40:01Z",
"itemUpdatesProcessed": 1100,
"itemsUpdatesFailed": 100,
"itemsSkipped": 1100,
"errors": null
},
"statistics": {
"totalSynchronizations": 25,
"averageSynchronizationDuration": "00:15:20",
"averageItemsProcessedPerSynchronization": 500
}
}
注意
从 2026-04-01 API 版本开始,文档级错误详细信息的 kind 属性和 currentSynchronizationState.errors[] 数组即可使用。 对于早期 API 版本,不会返回这些字段。 该 lastSynchronizationState.status 字段也是 2026-04-01 中的新增字段。
查看生成的对象
创建此知识源时,Azure AI 搜索自动生成数据源、技能集、索引器和索引。 创建响应将列出下 createdResources的每个对象。
这些对象根据固定模板生成,其名称基于知识源的名称。 无法更改对象名称。 避免直接编辑这些对象,因为更改可能会引入中断索引器管道的错误或不兼容。
可以使用Azure门户验证对象创建。 工作流为:
检查索引器是否有成功或失败的消息。 这里会显示连接错误或配额错误。
检查数据源以验证与数据存储的连接。 该连接使用连接字符串或托管标识,具体取决于你如何配置知识源。
检查技能集以查看内容是如何分块和选择性的矢量化的。
检查索引以了解您的内容是如何被编制索引和公开以供检索的,包括哪些字段可供搜索和筛选,以及哪些字段存储用于相似性搜索的向量。 使用搜索资源管理器针对生成的索引运行查询。
分配给知识库
如果对知识源感到满意, 请将其添加到知识库。
对于指定索引SharePoint知识源的任何知识库,请务必将 includeReferenceSourceData 设置为 true。 此步骤是将源文档 URL 拉取到引文中所必需的。
查询知识库
配置知识库后, 调用检索操作或 MCP 终结点 来查询知识源。 选择与方案匹配的配置。
强制实施文档级权限
若要强制实施文档级权限,请在创建此知识源时设置 ingestionPermissionOptions ,然后在检索请求中包含用户的访问令牌。 有关详细信息,请参阅在查询时强制实施权限(预览版)。
有关索引SharePoint权限查询中缺少、意外或失败的结果,请参阅“排查SharePoint权限筛选问题”。
显示文档嵌入图像
若要在答案合成响应中显示文档嵌入的图像(如图表或扫描),请对此知识源进行配置 assetStore ,然后在知识库上启用图像服务。 配置了 ingestionPermissionOptions 时,不支持图像服务。 有关详细信息,请参阅代理检索中Surface文档嵌入图像(预览版)。
删除知识源
在删除知识库之前,必须删除引用它的任何知识库或更新知识库定义以删除引用。 对于生成索引和索引器管道的知识源,也会删除所有 生成的对象 。 但是,如果使用现有索引创建知识源,则不会删除索引。
如果尝试删除正在使用的知识源,该操作将失败并返回受影响的知识库列表。
删除知识源:
获取搜索服务上所有知识库的列表。
using Azure.Search.Documents.Indexes; var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential); var knowledgeBases = indexClient.GetKnowledgeBasesAsync(); Console.WriteLine("Knowledge Bases:"); await foreach (var kb in knowledgeBases) { Console.WriteLine($" - {kb.Name}"); }Reference:SearchIndexClient
示例响应可能如下所示:
{ "@odata.context": "https://my-search-service.search.windows.net/$metadata#knowledgebases(name)", "value": [ { "name": "my-kb" }, { "name": "my-kb-2" } ] }获取单个知识库定义以检查知识源引用。
using Azure.Search.Documents.Indexes; using System.Text.Json; var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential); // Specify the knowledge base name to retrieve string kbNameToGet = "earth-knowledge-base"; // Get a specific knowledge base definition var knowledgeBaseResponse = await indexClient.GetKnowledgeBaseAsync(kbNameToGet); var kb = knowledgeBaseResponse.Value; // Serialize to JSON for display string json = JsonSerializer.Serialize(kb, new JsonSerializerOptions { WriteIndented = true }); Console.WriteLine(json);Reference:SearchIndexClient
示例响应可能如下所示:
{ "Name": "earth-knowledge-base", "KnowledgeSources": [ { "Name": "earth-knowledge-source" } ], "Models": [ {} ], "RetrievalReasoningEffort": {}, "OutputMode": {}, "ETag": "\u00220x8DE278629D782B3\u0022", "EncryptionKey": null, "Description": null, "RetrievalInstructions": null, "AnswerInstructions": null }删除知识库,或者如果有多个知识库,请更新知识库以删除源。 此示例显示删除。
using Azure.Search.Documents.Indexes; var indexClient = new SearchIndexClient(new Uri(searchEndpoint), credential); await indexClient.DeleteKnowledgeBaseAsync(knowledgeBaseName); System.Console.WriteLine($"Knowledge base '{knowledgeBaseName}' deleted successfully.");Reference:SearchIndexClient
删除知识源。
await indexClient.DeleteKnowledgeSourceAsync(knowledgeSourceName); System.Console.WriteLine($"Knowledge source '{knowledgeSourceName}' deleted successfully.");Reference:SearchIndexClient
获取搜索服务上所有知识库的列表。
# Get knowledge bases from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) print("Knowledge Bases:") for kb in index_client.list_knowledge_bases(): print(f" - {kb.name}")Reference:SearchIndexClient
示例响应可能如下所示:
{ "@odata.context": "https://my-search-service.search.windows.net/$metadata#knowledgebases(name)", "value": [ { "name": "my-kb" }, { "name": "my-kb-2" } ] }获取单个知识库定义以检查知识源引用。
# Get a knowledge base definition from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) kb = index_client.get_knowledge_base("knowledge_base_name") print(kb)Reference:SearchIndexClient
示例响应可能如下所示:
{ "name": "my-kb", "description": null, "retrievalInstructions": null, "answerInstructions": null, "outputMode": null, "knowledgeSources": [ { "name": "my-blob-ks" } ], "models": [], "encryptionKey": null, "retrievalReasoningEffort": { "kind": "low" } }删除知识库,或者如果有多个知识库,请更新知识库以删除源。 此示例显示删除。
# Delete a knowledge base from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) index_client.delete_knowledge_base("knowledge_base_name") print(f"Knowledge base deleted successfully.")Reference:SearchIndexClient
删除知识源。
# Delete a knowledge source from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key")) index_client.delete_knowledge_source("knowledge_source_name") print(f"Knowledge source deleted successfully.")Reference:SearchIndexClient
获取搜索服务上所有知识库的列表。
### Get knowledge bases GET {{search-url}}/knowledgebases?api-version={{api-version}}&$select=name Authorization: Bearer {{token}}参考:知识库 - 列表
示例响应可能如下所示:
{ "@odata.context": "https://my-search-service.search.windows.net/$metadata#knowledgebases(name)", "value": [ { "name": "my-kb" }, { "name": "my-kb-2" } ] }获取单个知识库定义以检查知识源引用。
### Get a knowledge base definition GET {{search-url}}/knowledgebases/{{knowledge-base-name}}?api-version={{api-version}} Authorization: Bearer {{token}}参考:知识库 - 获取
示例响应可能如下所示:
{ "name": "my-kb", "description": null, "retrievalInstructions": null, "answerInstructions": null, "outputMode": null, "knowledgeSources": [ { "name": "my-blob-ks" } ], "models": [], "encryptionKey": null, "retrievalReasoningEffort": { "kind": "low" } }删除知识库,或者如果有多个知识库,请更新知识库以删除源。 此示例显示删除。
### Delete a knowledge base DELETE {{search-url}}/knowledgebases/{{knowledge-base-name}}?api-version={{api-version}} Authorization: Bearer {{token}}参考:知识库 - 删除
删除知识源。
### Delete a knowledge source DELETE {{search-url}}/knowledgesources/{{knowledge-source-name}}?api-version={{api-version}} Authorization: Bearer {{token}}参考:知识源 - 删除
已知错误
生成的SharePoint数据源和索引器使用与直接配置SharePoint索引器相同的Microsoft Entra租户验证和身份验证行为。 对于与租户相关的失败,请查看生成的索引器状态和执行历史记录,然后遵循Invalid AAD tenant修正步骤。