Skip to main content

Cassandra

Bundles 包含支援特定第三方整合的自訂Components,與 AgentBuilder 搭配使用。

此頁面描述 Cassandra bundle 中可用的Components,包括讀取和寫入 Apache Cassandra 叢集的Components,例如 OSS Cassandra 和 Astra DB 資料庫。

Cassandra 向量儲存

使用 Cassandra Components透過 CassandraVectorStore 實例讀取或寫入基於 Cassandra 的向量儲存。

關於向量儲存實例

Because AgentBuilder is based on LangChain, vector store components use an instance of LangChain vector store to drive the underlying read and write functions. These instances are provider-specific and configured according to the component's parameters, such as the connection string, index name, and schema.

In component code, this is often instantiated as vector_store, but some vector store components use a different name, such as the provider name.

Some LangChain classes don't expose all possible options as component parameters. Depending on the provider, these options might use default values or allow modification through environment variables, if they are supported in AgentBuilder. For information about specific options, see the LangChain API reference and vector store provider's documentation.

如果您使用向量儲存Components查詢您的向量資料庫,它會產生搜尋結果,您可以將其作為 Data 物件清單或表格 DataFrame 傳遞給FLOW中的下游Components。 如果支援兩種類型,您可以在視覺編輯器中向量儲存Components的輸出連接埠附近設定格式。

tip

如需在 Flow中使用向量資料庫的教學,請參閱建立向量 RAG 聊天機器人

Cassandra 參數

您可以檢查向量儲存Components的參數,以了解它接受的輸入、支援的功能以及如何配置它。

某些參數在視覺編輯器中預設為隱藏。 您可以透過 Components的標頭選單 中的 Controls 修改所有參數。

某些參數是條件性的,只有在您設定其他參數或為其他參數選取特定選項後才可用。 條件參數在您設定所需的依賴項之前,可能不會在 Controls 窗格中顯示。

如需接受值和功能的資訊,請參閱 Cassandra 中的向量搜尋 或檢查Components程式碼

NameTypeDescription
database_refString輸入參數。資料庫的聯絡點或 Astra 資料庫 ID。
usernameString輸入參數。資料庫的使用者名稱。Astra DB 請留空。
tokenSecretString輸入參數。資料庫的使用者密碼或 Astra 應用程式權杖。
keyspaceString輸入參數。包含 Table Name (table_name) 中指定向量儲存的金鑰空間名稱。
table_nameString輸入參數。作為向量儲存的資料表或集合名稱。
ttl_secondsInteger輸入參數。新增文字的存活時間(如果叢集支援)。僅與寫入相關。
batch_sizeInteger輸入參數。在單一批次中處理的記錄數量。
setup_modeString輸入參數。設定 Cassandra 資料表的配置模式。
cluster_kwargsDict輸入參數。Cassandra 叢集的額外關鍵字引數。
search_queryString輸入參數。相似性搜尋的查詢字串。僅與讀取相關。
ingest_dataData輸入參數。要作為原始區塊和嵌入載入到向量儲存的資料。僅與寫入相關。
embeddingEmbeddings輸入參數。要使用的嵌入函數。
number_of_resultsInteger輸入參數。搜尋中要返回的結果數量。僅與讀取相關。
search_typeString輸入參數。要執行的搜尋類型。僅與讀取相關。
search_score_thresholdFloat輸入參數。搜尋結果的最小相似性分數。僅與讀取相關。
search_filterDict輸入參數。除了向量搜尋之外要套用的可選中繼資料搜尋篩選器字典。僅與讀取相關。
body_searchString輸入參數。文件文字搜尋詞彙。僅與讀取相關。
enable_body_searchBoolean輸入參數。啟用本文搜尋的旗標。僅與讀取相關。

Cassandra Chat Memory

Cassandra Chat Memory Components使用基於 Apache Cassandra 的資料庫檢索和儲存聊天訊息。

聊天記憶體作為 Memory 資料類型在記憶體儲存Components之間傳遞。 具體來說,此Components建立 CassandraChatMessageHistory 的實例,這是一個使用 Cassandra 資料庫進行儲存的 LangChain 聊天訊息歷史記錄類別。

如需在 Flow中使用外部聊天記憶體的詳細資訊,請參閱 Message History Components

Cassandra Chat Memory 參數

某些參數在視覺編輯器中預設為隱藏。 您可以透過 Components的標頭選單 中的 Controls 修改所有參數。

NameTypeDescription
database_refMessageText輸入參數。Cassandra 資料庫的聯絡點或 Astra DB 資料庫 ID。必要。
usernameMessageText輸入參數。Cassandra 的使用者名稱。Astra DB 請留空。
tokenSecretString輸入參數。Cassandra 的密碼或 Astra DB 的權杖。必要。
keyspaceMessageText輸入參數。Cassandra 中的金鑰空間或 Astra DB 中的命名空間。必要。
table_nameMessageText輸入參數。儲存訊息的資料表或集合名稱。必要。
session_idMessageText輸入參數。聊天工作階段的唯一識別碼。可選。
cluster_kwargsDictionary輸入參數。Cassandra 叢集配置的額外關鍵字引數。可選。

Cassandra Graph

Cassandra Graph Components使用 CassandraGraphVectorStoreLangChain 圖形向量儲存的實例),用於在相容的基於 Cassandra 的叢集中進行圖形遍歷和基於圖形的文件檢索。 它也支援寫入向量儲存。

如果您使用向量儲存Components查詢您的向量資料庫,它會產生搜尋結果,您可以將其作為 Data 物件清單或表格 DataFrame 傳遞給FLOW中的下游Components。 如果支援兩種類型,您可以在視覺編輯器中向量儲存Components的輸出連接埠附近設定格式。

Cassandra Graph 參數

某些參數在視覺編輯器中預設為隱藏。 您可以透過 Components的標頭選單 中的 Controls 修改所有參數。

NameDisplay NameInfo
database_refContact Points / Astra Database ID輸入參數。資料庫的聯絡點或 Astra 資料庫 ID。必要。
usernameUsername輸入參數。資料庫的使用者名稱。Astra DB 請留空。
tokenPassword / Astra DB Token輸入參數。資料庫的使用者密碼或 Astra 應用程式權杖。必要。
keyspaceKeyspace輸入參數。包含 Table Name (table_name) 中指定向量儲存的金鑰空間名稱。必要。
table_nameTable Name輸入參數。作為向量儲存的資料表或集合名稱。必要。
setup_modeSetup Mode輸入參數。設定 Cassandra 資料表的配置模式。選項為 Sync(預設)或 Off
cluster_kwargsCluster arguments輸入參數。Cassandra 叢集的額外關鍵字引數的可選字典。
search_querySearch Query輸入參數。相似性搜尋的查詢字串。僅與讀取相關。
ingest_dataIngest Data輸入參數。要作為原始區塊和嵌入載入到向量儲存的資料。僅與寫入相關。
embeddingEmbedding輸入參數。要使用的嵌入模型。
number_of_resultsNumber of Results輸入參數。相似性搜尋中要返回的結果數量。僅與讀取相關。預設:4。
search_typeSearch Type輸入參數。要使用的搜尋類型。選項為 Traversal(預設)、MMR TraversalSimilaritySimilarity with score thresholdMMR (Max Marginal Relevance)
depthDepth of traversal輸入參數。要遍歷的邊緣的最大深度。僅當 Search Type (search_type) 為 TraversalMMR Traversal 時相關。預設:1。
search_score_thresholdSearch Score Threshold輸入參數。搜尋結果的最小相似性分數閾值。僅與使用 Similarity with score threshold 搜尋類型的讀取相關。
search_filterSearch Metadata Filter輸入參數。除了圖形遍歷和相似性搜尋之外要套用的可選中繼資料搜尋篩選器字典。

另請參閱

Search