這很重要
Web Knowledge Source 採用 Grounding with Bing Search 和/或 Grounding with Bing 自訂搜尋,是一項第一 方消費服務 ,受 Grounding with Bing 使用條款 及 Microsoft 隱私聲明規範。
Microsoft 資料保護附錄不適用於傳送至 Web Knowledge Source 的資料。 當客戶使用網頁知識來源時,客戶資料會流出 Azure 合規與地理邊界。 這也意味著使用網路知識源(Web Knowledge Source)免除所有政府社群雲(Government Community Cloud)提升的安全與合規承諾,包括資料主權及篩選/公民身份支援(視情況而定)。
使用網路知識來源會產生成本;了解更多關於 定價的資訊。
了解更多 Azure 管理員如何 管理對 Web Knowledge Source 的存取。
備註
這項功能目前處於公開預覽狀態。 此預覽版在沒有服務等級協議的情況下提供,不建議用於生產工作負載。 可能不支援特定功能,或可能已經限制功能。 如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款。
Web Knowledge Source 允許透過代理式檢索管線從 Microsoft Bing 擷取即時網路資料。 知識來源 獨立建立,並在 知識庫中被引用,並作為代理或聊天機器人在查詢時呼叫 擷取動作 時的基礎資料。
Bing 自訂搜尋一直是 Web Knowledge Source 的搜尋服務提供者。 雖然你無法指定替代的搜尋服務提供者或引擎,但你可以包含或排除特定 網域,例如 https://learn.microsoft.com。 當未指定網域時,Web Knowledge Source 可不受限制地存取整個公共網際網路。
網路知識來源與其他知識來源搭配使用效果最佳。 當您的專有內容無法提供完整和最新的答案,或您希望使用商業搜尋引擎的資訊來補充結果時,請使用 Web 知識來源。
使用網路知識來源時,請記得以下幾點:
回應總是對查詢的單一且有組織的答案,而非來自網路的原始搜尋結果。
由於 Web Knowledge Source 不支援擷取資料,你的知識庫必須使用 答案綜合 和 低或中等推理努力。 你也無法定義答案指示。
先決條件
一個 Azure 訂閱,可以 存取 Web Knowledge Source。 預設情況下,存取權限是啟用的。 如果存取被停用,請聯絡你的管理員。
Azure AI 搜尋服務可在任何 地區提供主動檢索。 你必須 啟用語意排序器。 服務必須位於 Azure 公開區域,因為 Web Knowledge Source 在私有雲或主權雲中不被支援。
.NET SDK 用戶端函式庫的最新預覽版
Azure.Search.Documents。在 Azure AI Search 上建立及使用物件的權限。 我們建議使用 基於角色的存取,但如果角色指派不可行,也可以使用 API 金鑰 。 欲了解更多資訊,請參閱 「連接搜尋服務」。
檢查現有的知識來源
知識來源是一個頂層、可重複使用的物件。 瞭解現有的知識來源有助於重複使用或命名新物件。
執行以下程式碼,依名稱和類型列出知識來源。
// 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}");
}
您也可以按名稱傳回單一知識來源以檢閱其 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));
以下 JSON 是一個網頁知識來源資源的範例回應。
{
"WebParameters": {
"Domains": null
},
"Name": "my-web-ks",
"Description": "A sample Web Knowledge Source.",
"EncryptionKey": null,
}
建立知識來源
執行以下程式碼來建立一個網路知識來源資源。
// Create Web Knowledge Source
// Create a Web knowledge source
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Indexes.Models;
using Azure;
var indexClient = new SearchIndexClient(new Uri(searchEndpoint), new AzureKeyCredential(apiKey));
var knowledgeSource = new WebKnowledgeSource(name: "my-web-ks")
{
Description = "A sample Web Knowledge Source.",
WebParameters = new WebKnowledgeSourceParameters
{
Domains = new WebKnowledgeSourceDomains
{
AllowedDomains =
{
new WebKnowledgeSourceDomain(address: "learn.microsoft.com") { IncludeSubpages = true }
},
BlockedDomains =
{
new WebKnowledgeSourceDomain(address: "bing.com") { IncludeSubpages = false }
}
}
}
};
await indexClient.CreateOrUpdateKnowledgeSourceAsync(knowledgeSource);
Console.WriteLine($"Knowledge source '{knowledgeSource.Name}' created or updated successfully.");
來源特異性特性
你可以傳遞以下屬性來建立網路知識來源資源。
| 名稱 | Description | 類型 | 可編輯 | 為必填項目 |
|---|---|---|---|---|
Name |
知識來源的名稱必須在知識來源集合中唯一,並遵循 Azure AI 搜尋中物件 的命名指引 。 | 繩子 | Yes | Yes |
Description |
這是知識來源的描述。 若未指定,Azure AI 搜尋會套用預設描述。 | 繩子 | Yes | 否 |
EncryptionKey |
使用由客戶管理的金鑰來加密知識源中的敏感資訊。 | 物體 | Yes | 否 |
WebParameters |
針對Web 知識來源的特定參數。 目前,這僅為Domains。 |
物體 | Yes | 否 |
Domains |
在搜尋空間中允許或封鎖的網域。 預設情況下,該知識來源會使用 Bing Search 的 Grounding 來搜尋整個公共網路。 當你指定網域時,知識來源會使用 Bing 自訂搜尋的 Grounding 功能,將結果限制在指定的網域範圍內。 在這兩種情況下,Bing 自訂搜尋都是搜尋服務提供者。 | 物體 | Yes | 否 |
AllowedDomains |
搜尋空間中應包含的網域。 對於每個網域,您必須以 address 格式指定其 website.com。 你也可以透過設定IncludeSubpages為true或false,指定是否包含該網域的子頁面。 |
Array | Yes | 否 |
BlockedDomains |
要排除在搜尋空間之外的網域。 對於每個網域,您必須以 address 格式指定其 website.com。 你也可以透過設定IncludeSubpages為true或false,指定是否包含該網域的子頁面。 |
Array | Yes | 否 |
指派到知識庫
如果你對知識來源感到滿意,就繼續下一步:在 知識庫中指定知識來源。
知識庫設定完成後,使用 擷取動作 查詢知識來源。
刪除知識來源
在刪除知識來源之前,必須刪除所有引用該來源的知識庫,或更新知識庫定義以移除該參考。 對於產生索引與索引管線的知識來源,所有 產生的物件 也會被刪除。 不過,如果你用現有的索引建立知識來源,你的索引不會被刪除。
如果你嘗試刪除正在使用的知識來源,該動作會失敗,並回傳一份受影響的知識庫清單。
刪除知識來源:
取得你搜尋服務中所有知識庫的清單。
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}"); }範例回應可能如下所示:
Knowledge Bases: - earth-knowledge-base - hotels-sample-knowledge-base - my-demo-knowledge-base取得一個獨立的知識庫定義,以檢查是否有知識來源的參考。
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);範例回應可能如下所示:
{ "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.");刪除知識來源。
await indexClient.DeleteKnowledgeSourceAsync(knowledgeSourceName); System.Console.WriteLine($"Knowledge source '{knowledgeSourceName}' deleted successfully.");
這很重要
Web Knowledge Source 採用 Grounding with Bing Search 和/或 Grounding with Bing 自訂搜尋,是一項第一 方消費服務 ,受 Grounding with Bing 使用條款 及 Microsoft 隱私聲明規範。
Microsoft 資料保護附錄不適用於傳送至 Web Knowledge Source 的資料。 當客戶使用網頁知識來源時,客戶資料會流出 Azure 合規與地理邊界。 這也意味著使用網路知識源(Web Knowledge Source)免除所有政府社群雲(Government Community Cloud)提升的安全與合規承諾,包括資料主權及篩選/公民身份支援(視情況而定)。
使用網路知識來源會產生成本;了解更多關於 定價的資訊。
了解更多 Azure 管理員如何 管理對 Web Knowledge Source 的存取。
備註
這項功能目前處於公開預覽狀態。 此預覽版在沒有服務等級協議的情況下提供,不建議用於生產工作負載。 可能不支援特定功能,或可能已經限制功能。 如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款。
Web Knowledge Source 允許透過代理式檢索管線從 Microsoft Bing 擷取即時網路資料。 知識來源 獨立建立,並在 知識庫中被引用,並作為代理或聊天機器人在查詢時呼叫 擷取動作 時的基礎資料。
Bing 自訂搜尋一直是 Web Knowledge Source 的搜尋服務提供者。 雖然你無法指定替代的搜尋服務提供者或引擎,但你可以包含或排除特定 網域,例如 https://learn.microsoft.com。 當未指定網域時,Web Knowledge Source 可不受限制地存取整個公共網際網路。
網路知識來源與其他知識來源搭配使用效果最佳。 當您的專有內容無法提供完整和最新的答案,或您希望使用商業搜尋引擎的資訊來補充結果時,請使用 Web 知識來源。
使用網路知識來源時,請記得以下幾點:
回應總是對查詢的單一且有組織的答案,而非來自網路的原始搜尋結果。
由於 Web Knowledge Source 不支援擷取資料,你的知識庫必須使用 答案綜合 和 低或中等推理努力。 你也無法定義答案指示。
先決條件
一個 Azure 訂閱,可以 存取 Web Knowledge Source。 預設情況下,存取權限是啟用的。 如果存取被停用,請聯絡你的管理員。
Azure AI 搜尋服務可在任何 地區提供主動檢索。 你必須 啟用語意排序器。 服務必須位於 Azure 公開區域,因為 Web Knowledge Source 在私有雲或主權雲中不被支援。
在 Azure AI Search 上建立及使用物件的權限。 我們建議使用 基於角色的存取,但如果角色指派不可行,也可以使用 API 金鑰 。 欲了解更多資訊,請參閱 「連接搜尋服務」。
檢查現有的知識來源
知識來源是一個頂層、可重複使用的物件。 瞭解現有的知識來源有助於重複使用或命名新物件。
執行以下程式碼,依名稱和類型列出知識來源。
# List knowledge sources by name and type
import requests
import json
endpoint = "{search_url}/knowledgesources"
params = {"api-version": "2025-11-01-preview", "$select": "name, kind"}
headers = {"api-key": "{api_key}"}
response = requests.get(endpoint, params = params, headers = headers)
print(json.dumps(response.json(), indent = 2))
您也可以按名稱傳回單一知識來源以檢閱其 JSON 定義。
# Get a knowledge source definition
import requests
import json
endpoint = "{search_url}/knowledgesources/{knowledge_source_name}"
params = {"api-version": "2025-11-01-preview"}
headers = {"api-key": "{api_key}"}
response = requests.get(endpoint, params = params, headers = headers)
print(json.dumps(response.json(), indent = 2))
以下 JSON 是一個網頁知識來源資源的範例回應。
{
"name": "my-web-ks",
"kind": "web",
"description": "A sample Web Knowledge Source.",
"encryptionKey": null,
"webParameters": {
"domains": null
}
}
建立知識來源
執行以下程式碼來建立一個網路知識來源資源。
# Create Web Knowledge Source
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
from azure.search.documents.indexes.models import WebKnowledgeSource, WebKnowledgeSourceParameters, WebKnowledgeSourceDomains
index_client = SearchIndexClient(endpoint = "search_url", credential = AzureKeyCredential("api_key"))
knowledge_source = WebKnowledgeSource(
name = "my-web-ks",
description = "A sample Web Knowledge Source.",
encryption_key = None,
web_parameters = WebKnowledgeSourceParameters(
domains = WebKnowledgeSourceDomains(
allowed_domains = [ { "address": "learn.microsoft.com", "include_subpages": True } ],
blocked_domains = [ { "address": "bing.com", "include_subpages": False } ]
)
)
)
index_client.create_or_update_knowledge_source(knowledge_source)
print(f"Knowledge source '{knowledge_source.name}' created or updated successfully.")
來源特異性特性
你可以傳遞以下屬性來建立網路知識來源資源。
| 名稱 | Description | 類型 | 可編輯 | 為必填項目 |
|---|---|---|---|---|
name |
知識來源的名稱必須在知識來源集合中唯一,並遵循 Azure AI 搜尋中物件 的命名指引 。 | 繩子 | Yes | Yes |
description |
這是知識來源的描述。 若未指定,Azure AI 搜尋會套用預設描述。 | 繩子 | Yes | 否 |
encryption_key |
使用由客戶管理的金鑰來加密知識源中的敏感資訊。 | 物體 | Yes | 否 |
web_parameters |
針對Web 知識來源的特定參數。 目前,這僅為domains。 |
物體 | Yes | 否 |
domains |
在搜尋空間中允許或封鎖的網域。 預設情況下,該知識來源會使用 Bing Search 的 Grounding 來搜尋整個公共網路。 當你指定網域時,知識來源會使用 Bing 自訂搜尋的 Grounding 功能,將結果限制在指定的網域範圍內。 在這兩種情況下,Bing 自訂搜尋都是搜尋服務提供者。 | 物體 | Yes | 否 |
allowed_domains |
搜尋空間中應包含的網域。 對於每個網域,您必須以 address 格式指定其 website.com。 你也可以透過設定include_subpages為true或false,指定是否包含該網域的子頁面。 |
Array | Yes | 否 |
blocked_domains |
要排除在搜尋空間之外的網域。 對於每個網域,您必須以 address 格式指定其 website.com。 你也可以透過設定include_subpages為true或false,指定是否包含該網域的子頁面。 |
Array | Yes | 否 |
指派到知識庫
如果你對知識來源感到滿意,就繼續下一步:在 知識庫中指定知識來源。
知識庫設定完成後,使用 擷取動作 查詢知識來源。
刪除知識來源
在刪除知識來源之前,必須刪除所有引用該來源的知識庫,或更新知識庫定義以移除該參考。 對於產生索引與索引管線的知識來源,所有 產生的物件 也會被刪除。 不過,如果你用現有的索引建立知識來源,你的索引不會被刪除。
如果你嘗試刪除正在使用的知識來源,該動作會失敗,並回傳一份受影響的知識庫清單。
刪除知識來源:
取得你搜尋服務中所有知識庫的清單。
# Get knowledge bases import requests import json endpoint = "{search_url}/knowledgebases" params = {"api-version": "2025-11-01-preview", "$select": "name"} headers = {"api-key": "{api_key}"} response = requests.get(endpoint, params = params, headers = headers) print(json.dumps(response.json(), indent = 2))範例回應可能如下所示:
{ "@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 import requests import json endpoint = "{search_url}/knowledgebases/{knowledge_base_name}" params = {"api-version": "2025-11-01-preview"} headers = {"api-key": "{api_key}"} response = requests.get(endpoint, params = params, headers = headers) print(json.dumps(response.json(), indent = 2))範例回應可能如下所示:
{ "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.")刪除知識來源。
# 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.")
這很重要
Web Knowledge Source 採用 Grounding with Bing Search 和/或 Grounding with Bing 自訂搜尋,是一項第一 方消費服務 ,受 Grounding with Bing 使用條款 及 Microsoft 隱私聲明規範。
Microsoft 資料保護附錄不適用於傳送至 Web Knowledge Source 的資料。 當客戶使用網頁知識來源時,客戶資料會流出 Azure 合規與地理邊界。 這也意味著使用網路知識源(Web Knowledge Source)免除所有政府社群雲(Government Community Cloud)提升的安全與合規承諾,包括資料主權及篩選/公民身份支援(視情況而定)。
使用網路知識來源會產生成本;了解更多關於 定價的資訊。
了解更多 Azure 管理員如何 管理對 Web Knowledge Source 的存取。
備註
這項功能目前處於公開預覽狀態。 此預覽版在沒有服務等級協議的情況下提供,不建議用於生產工作負載。 可能不支援特定功能,或可能已經限制功能。 如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款。
Web Knowledge Source 允許透過代理式檢索管線從 Microsoft Bing 擷取即時網路資料。 知識來源 獨立建立,並在 知識庫中被引用,並作為代理或聊天機器人在查詢時呼叫 擷取動作 時的基礎資料。
Bing 自訂搜尋一直是 Web Knowledge Source 的搜尋服務提供者。 雖然你無法指定替代的搜尋服務提供者或引擎,但你可以包含或排除特定 網域,例如 https://learn.microsoft.com。 當未指定網域時,Web Knowledge Source 可不受限制地存取整個公共網際網路。
網路知識來源與其他知識來源搭配使用效果最佳。 當您的專有內容無法提供完整和最新的答案,或您希望使用商業搜尋引擎的資訊來補充結果時,請使用 Web 知識來源。
使用網路知識來源時,請記得以下幾點:
回應總是對查詢的單一且有組織的答案,而非來自網路的原始搜尋結果。
由於 Web Knowledge Source 不支援擷取資料,你的知識庫必須使用 答案綜合 和 低或中等推理努力。 你也無法定義答案指示。
先決條件
一個 Azure 訂閱,可以 存取 Web Knowledge Source。 預設情況下,存取權限是啟用的。 如果存取被停用,請聯絡你的管理員。
Azure AI 搜尋服務可在任何 地區提供主動檢索。 你必須 啟用語意排序器。 服務必須位於 Azure 公開區域,因為 Web Knowledge Source 在私有雲或主權雲中不被支援。
搜尋服務 REST API 的 2025-11-01 預覽 版。
在 Azure AI Search 上建立及使用物件的權限。 我們建議使用 基於角色的存取,但如果角色指派不可行,也可以使用 API 金鑰 。 欲了解更多資訊,請參閱 「連接搜尋服務」。
檢查現有的知識來源
知識來源是一個頂層、可重複使用的物件。 瞭解現有的知識來源有助於重複使用或命名新物件。
使用 知識來源 - 取得 (REST API) 依名稱和類型列出知識來源。
### List knowledge sources by name and type
GET {{search-url}}/knowledgesources?api-version=2025-11-01-preview&$select=name,kind
api-key: {{api-key}}
您也可以按名稱傳回單一知識來源以檢閱其 JSON 定義。
### Get a knowledge source definition
GET {{search-url}}/knowledgesources/{{knowledge-source-name}}?api-version=2025-11-01-preview
api-key: {{api-key}}
以下 JSON 是一個網頁知識來源資源的範例回應。
{
"name": "my-web-ks",
"kind": "web",
"description": "A sample Web Knowledge Source.",
"encryptionKey": null,
"webParameters": {
"domains": null
}
}
建立知識來源
使用 Knowledge Sources - Create 或 Update(REST API) 來建立網路知識來源資源。
PUT {{search-url}}/knowledgesources/my-web-ks?api-version=2025-11-01-preview
Content-Type: application/json
api-key: {{api-key}}
{
"name": "my-web-ks",
"kind": "web",
"description": "This knowledge source pulls content from the web.",
"encryptionKey": null,
"webParameters": {
"domains": {
"allowedDomains": [ { "address": "learn.microsoft.com", "includeSubpages": true } ],
"blockedDomains": [ { "address": "bing.com", "includeSubpages": false } ]
}
}
}
來源特異性特性
你可以傳遞以下屬性來建立網路知識來源資源。
| 名稱 | Description | 類型 | 可編輯 | 為必填項目 |
|---|---|---|---|---|
name |
知識來源的名稱必須在知識來源集合中唯一,並遵循 Azure AI 搜尋中物件 的命名指引 。 | 繩子 | Yes | Yes |
kind |
這種知識來源,在這個情況下是 web。 |
繩子 | 否 | Yes |
description |
這是知識來源的描述。 若未指定,Azure AI 搜尋會套用預設描述。 | 繩子 | Yes | 否 |
encryptionKey |
使用由客戶管理的金鑰來加密知識源中的敏感資訊。 | 物體 | Yes | 否 |
webParameters |
針對Web 知識來源的特定參數。 目前,這僅為domains。 |
物體 | Yes | 否 |
domains |
在搜尋空間中允許或封鎖的網域。 預設情況下,該知識來源會使用 Bing Search 的 Grounding 來搜尋整個公共網路。 當你指定網域時,知識來源會使用 Bing 自訂搜尋的 Grounding 功能,將結果限制在指定的網域範圍內。 在這兩種情況下,Bing 自訂搜尋都是搜尋服務提供者。 | 物體 | Yes | 否 |
allowedDomains |
搜尋空間中應包含的網域。 對於每個網域,您必須以 address 格式指定其 website.com。 你也可以透過設定includeSubpages為true或false,指定是否包含該網域的子頁面。 |
Array | Yes | 否 |
blockedDomains |
要排除在搜尋空間之外的網域。 對於每個網域,您必須以 address 格式指定其 website.com。 你也可以透過設定includeSubpages為true或false,指定是否包含該網域的子頁面。 |
Array | Yes | 否 |
指派到知識庫
如果你對知識來源感到滿意,就繼續下一步:在 知識庫中指定知識來源。
知識庫設定完成後,使用 擷取動作 查詢知識來源。
刪除知識來源
在刪除知識來源之前,必須刪除所有引用該來源的知識庫,或更新知識庫定義以移除該參考。 對於產生索引與索引管線的知識來源,所有 產生的物件 也會被刪除。 不過,如果你用現有的索引建立知識來源,你的索引不會被刪除。
如果你嘗試刪除正在使用的知識來源,該動作會失敗,並回傳一份受影響的知識庫清單。
刪除知識來源:
取得你搜尋服務中所有知識庫的清單。
### Get knowledge bases GET {{search-endpoint}}/knowledgebases?api-version=2025-11-01-preview&$select=name api-key: {{api-key}}範例回應可能如下所示:
{ "@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-endpoint}}/knowledgebases/{{knowledge-base-name}}?api-version=2025-11-01-preview api-key: {{api-key}}範例回應可能如下所示:
{ "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-endpoint}}/knowledgebases/{{knowledge-base-name}}?api-version=2025-11-01-preview api-key: {{api-key}}刪除知識來源。
### Delete a knowledge source DELETE {{search-endpoint}}/knowledgesources/{{knowledge-source-name}}?api-version=2025-11-01-preview api-key: {{api-key}}