跳到主要内容

Cassandra

捆绑包 (Bundles) 包含支持 Langflow 与特定第三方集成自定义组件。

本页面介绍了 Cassandra 捆绑包中可用的组件,包括读写 Apache Cassandra 集群(如 OSS Cassandra 和 Astra DB 数据库)的组件。

Cassandra 向量存储 (Cassandra vector store)

使用 Cassandra 组件,通过 CassandraVectorStore 实例读写基于 Cassandra 的向量存储。

关于向量存储实例

Because Langflow 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 Langflow. For information about specific options, see the LangChain API reference and vector store provider's documentation.

If you use a vector store component to query your vector database, it produces search results that you can pass to downstream components in your flow as a list of Data objects or a tabular DataFrame. If both types are supported, you can set the format near the vector store component's output port in the visual editor.

提示

有关在流中使用向量数据库的教程,请参阅 创建向量 RAG 聊天机器人

Cassandra 参数

您可以检查向量存储组件的参数,以了解更多关于它接受的输入、支持的功能以及如何配置它的信息。

Some parameters are hidden by default in the visual editor. You can modify all parameters through the Controls in the component's header menu.

Some parameters are conditional, and they are only available after you set other parameters or select specific options for other parameters. Conditional parameters may not be visible on the Controls pane until you set the required dependencies.

有关接受的值和功能的信息,请参阅 Cassandra 中的向量搜索 或检查 组件代码

名称类型描述
database_refString输入参数。数据库的联系点或 Astra 数据库 ID。
usernameString输入参数。数据库的用户名。Astra DB 请留空。
tokenSecretString输入参数。数据库的用户密码或 Astra 应用程序令牌。
keyspaceString输入参数。包含在 表名 (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 聊天记忆 (Cassandra Chat Memory)

Cassandra 聊天记忆 组件使用基于 Apache Cassandra 的数据库检索和存储聊天消息。

聊天记忆以 Memory 数据类型在内存存储组件之间传递。 具体来说,该组件创建 CassandraChatMessageHistory 实例,这是一个 LangChain 聊天消息历史类,它使用 Cassandra 数据库进行存储。

有关在流中使用外部聊天记忆的更多信息,请参阅 消息历史 (Message History) 组件

Cassandra 聊天记忆参数

Some parameters are hidden by default in the visual editor. You can modify all parameters through the Controls in the component's header menu.

名称类型描述
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 图 (Cassandra Graph)

Cassandra 图 组件使用 CassandraGraphVectorStoreLangChain 图向量存储 的一个实例),在兼容的基于 Cassandra 的集群中进行图遍历和基于图的文档检索。 它还支持写入向量存储。

If you use a vector store component to query your vector database, it produces search results that you can pass to downstream components in your flow as a list of Data objects or a tabular DataFrame. If both types are supported, you can set the format near the vector store component's output port in the visual editor.

Cassandra 图参数

Some parameters are hidden by default in the visual editor. You can modify all parameters through the Controls in the component's header menu.

名称显示名称信息
database_ref联系点 / Astra 数据库 ID输入参数。数据库的联系点或 Astra 数据库 ID。必填。
username用户名输入参数。数据库的用户名。Astra DB 请留空。
token密码 / Astra DB 令牌输入参数。数据库的用户密码或 Astra 应用程序令牌。必填。
keyspace键空间输入参数。包含在 表名 (table_name) 中指定的向量存储的键空间名称。必填。
table_name表名输入参数。作为向量存储的表或集合的名称。必填。
setup_mode设置模式输入参数。设置 Cassandra 表的配置模式。选项为 Sync(默认)或 Off
cluster_kwargs集群参数输入参数。Cassandra 集群的可选额外关键字参数字典。
search_query搜索查询输入参数。相似性搜索的查询字符串。仅与读取相关。
ingest_data摄取数据输入参数。要作为原始块和嵌入加载到向量存储中的数据。仅与写入相关。
embedding嵌入输入参数。要使用的嵌入模型。
number_of_results结果数量输入参数。相似性搜索中要返回的结果数量。仅与读取相关。默认值:4。
search_type搜索类型输入参数。要使用的搜索类型。选项为 Traversal(默认)、MMR TraversalSimilaritySimilarity with score thresholdMMR (Max Marginal Relevance)
depth遍历深度输入参数。要遍历的边的最大深度。仅在 搜索类型 (search_type) 为 TraversalMMR Traversal 时相关。默认值:1。
search_score_threshold搜索得分阈值输入参数。搜索结果的最小相似性得分阈值。仅在使用 Similarity with score threshold 搜索类型的读取中相关。
search_filter搜索元数据过滤器输入参数。除了图遍历和相似性搜索之外要应用的可选元数据搜索过滤器字典。

另请参阅

Search