Cortex Knowledge Extension¶
Cortex Knowledge Extensions (CKEs) are Cortex Search Services that can be shared on the Snowflake Marketplace or via private listings or organizational listings. They can be used in a retrieval-augmented generation (RAG) architecture to integrate licensed and proprietary content into Cortex AI applications. For example, CKEs can be used to integrate knowledge from unstructured content, such as articles, market research, books, or forum posts, into Cortex AI applications, such as chatbots and agentic systems.
CKE 的工作原理¶
以下是它的工作原理:
提供商将其文本数据上传到其账户中的表中,并在表上创建 Cortex Search Service。然后,Cortex Search Service 将在 Snowflake Marketplace 上共享。在 Snowflake Marketplace 上共享的 Cortex Search Service 称为 Cortex Knowledge Extension (CKE)。
A Consumer builds an application leveraging Cortex AI, such as a chatbot, using Cortex AI Functions or the Cortex Agent API with the CKE.
当向集成了 CKE 的 Cortex AI 应用程序提供提示时,该提示将传递给 CKE,以通过执行语义搜索来获取相关知识。相关知识将返回给 Cortex AI 应用程序的 LLM 并进行推理,然后再向用户返回带有引用来源和归因的答案。
CKE 功能¶
Cortex Knowledge Extensions 的一些主要功能包括:
下文将对这些功能进行更详细的描述。
内容保护¶
提供商可以限制其 CKE 中在 24 小时内可返回给使用者的索引内容的百分比。这可以通过使用以下命令设置阈值来实现。该阈值并非应用于单个文档级别,而是应用于整个索引内容库。使用者只能访问 CKE 中阈值百分比的索引内容。
有关 cke_content_protection 字段的更多信息,请参阅 列表清单参考。
-- Use CREATE to create a new CKE listing with content protection.
-- Use ALTER to update an existing listing with content protection.
-- This example creates a CKE listing targeting to two accounts.
CREATE EXTERNAL LISTING cke_listing
SHARE cke_share AS
$$
title: "CKE Listing Title"
description: "Cortex Knowledge Extension Listing Description"
listing_terms:
type: "STANDARD"
auto_fulfillment:
refresh_type: "SUB_DATABASE"
refresh_schedule: "1440 MINUTE"
targets:
accounts:
- "ORG1.ACCOUNT1"
- "ORG2.ACCOUNT2"
cke_content_protection:
enable: true,
threshold: 0.2
$$
-- DESCRIBE LISTING cke_listing
-- See the manifest_yaml column for the cke_content_protection setting
当使用者达到阈值时,对 CKE 的查询将被阻止执行,并且使用者会收到以下错误:
You have reached the content protection threshold. Please try again later.
阈值刷新后,使用者可以重新查询数据。
管理¶
To see the number of queries that the CKE executed, sign in to Snowsight. In the navigation menu, select Data sharing » Provider Studio » Home. The Analytics section shows the number of queries executed.
试用支持¶
As a provider, you can offer customers a limited trial of your CKE so that they can try your product before they commit to paying for it.
获利¶
Cortex Knowledge Extensions can be monetized using the on-platform Snowflake Marketplace Monetization capability via subscriptions or through off-platform monetization.
区域可用性¶
Cortex Knowledge Extensions 可在任何提供 Cortex Search 的区域使用。
主要注意事项¶
When customers use your Cortex Knowledge Extension, be careful when disabling serving of the Cortex Search Service, as that will break customers' applications.
有关 Cortex Knowledge Extensions 的高级调整,请参阅 Cortex Search 文档。
CKE 的费用¶
Providers:
Providers pay to host the Cortex Search Service in their account, including indexing, servicing, and replication to other regions. For more information about costs associated with Cortex Search Services, providers can refer to 了解 Cortex Search 服务的成本.
Consumers:
If the CKE isn't free, consumers pay the provider to access the CKE.
If the CKE leverages a Cortex Agent, consumers pay for the Cortex Agent. For more information, see 成本注意事项 for Cortex Agents.
引用来源¶
为确保 CKE 提供引用来源,在配置 Cortex Search Service 时,请确保在索引列中包含指向文档来源的 SOURCE_URL 列。LLMs 或 Snowflake Intelligence 可以使用它来提供明确的归属信息以及指向源材料的超链接。
将 CKE 发布到 Snowflake Marketplace¶
After you create a Cortex Search Service that you want to publish to the Marketplace, create a listing. Make sure that you point to the Cortex Search Service object that you created as an object that you want to publish.
与 CKE 对话¶
您可以使用以下方法来向 CKE 提问。
使用 Cortex Search Playground:
In Snowsight, in the navigation menu, select AI & ML » Cortex Search.
从 Database/Schema 下拉菜单中选择 CKE。
点击右上角的 Playground。
输入搜索查询并查看结果
使用 Snowflake Intelligence:
按照 教程 3:将 CKE 添加到 Snowflake Intelligence 中概述的步骤进行操作。
使用 Cortex Agent API:
使用 Cortex Agent API,并在 CREATE CORTEX SEARCH 参数中指定共享的 CKE。有关更多信息,请参阅 :doc:` Cortex Agent API</user-guide/snowflake-cortex/cortex-agents>` 文档。
更新 CKE¶
对于定期推出新内容或更新内容的提供商来说,让 CKE 保持最新状态是一个常见用例。为确保您的 Cortex Knowledge Extension 保持最新状态,请执行以下操作:
确保已通过将新的/更新的文档插入 Snowflake 账户的某些独立过程更新了包含内容的基础表。
查看 Cortex Search Service 目标延迟。Cortex Search Service 配置为刷新数据并让数据新鲜度保持在特定
target_lag水平。有关target_lag的更多信息,请参阅 Cortex Search 使用 SQL 主题。运行以下命令,确保 Cortex Search Service 正在编制索引。
-- Get the status of the search service DESCRIBE CORTEX SEARCH SERVICE cke_simple_cortex_search_service; -- If the indexing status is suspended, you can resume it with the following command ALTER CORTEX SEARCH SERVICE cke_simple_cortex_search_service RESUME INDEXING;
CKE 和自动履行¶
Consumers can only access a Cortex Knowledge Extension made available in their region. Providers can automatically replicate their Cortex Search Service to remote consumer regions by enabling auto-fulfillment on their Cortex Knowledge Extension listing in Provider Studio.
限制¶
Usage-based billing with CKEs isn't supported.
CKEs are not supported in listings that have Egress Cost Optimizer (ECO) enabled.
Providers should be aware of the cost implications for replication with listings that have a CKE.
Adding a CKE to a listing that has ECO enabled will automatically turn off ECO. With ECO turned off, costs associated with the listing can increase. An email notification will also be sent to the provider indicating that ECO was turned off.
Similarly, if a CKE is added to a listing that's part of a replication group, then ECO will be turned off for all listings within that replication group. An email notification will be sent to the provider indicating that the ECO was turned off.