Create a Cassandra vector store from raw texts.
afrom_texts(
cls: Type[CVST],
texts: List[str],
embedding: Embeddings,
metadatas: Optional[List[dict]] = None,
*,
session: Optional[Session] = None,
keyspace: Optional[str] = None,
table_name: str = '',
ids: Optional[List[str]] = None,
ttl_seconds: Optional[int] = None,
body_index_options: Optional[List[Tuple[str, Any]]] = None,
metadata_indexing: Union[Tuple[str, Iterable[str]], str] = 'all',
**kwargs: Any = {}
) -> CVST| Name | Type | Description |
|---|---|---|
texts* | List[str] | Texts to add to the vectorstore. |
embedding* | Embeddings | Embedding function to use. |
metadatas | Optional[List[dict]] | Default: NoneOptional list of metadatas associated with the texts. |
session | Optional[Session] | Default: NoneCassandra driver session. If not provided, it is resolved from cassio. |
keyspace | Optional[str] | Default: NoneCassandra key space. If not provided, it is resolved from cassio. |
table_name | str | Default: ''Cassandra table (required). |
ids | Optional[List[str]] | Default: NoneOptional list of IDs associated with the texts. |
ttl_seconds | Optional[int] | Default: NoneOptional time-to-live for the added texts. |
body_index_options | Optional[List[Tuple[str, Any]]] | Default: NoneOptional options used to create the body index. Eg. body_index_options = [cassio.table.cql.STANDARD_ANALYZER] |
metadata_indexing | Union[Tuple[str, Iterable[str]], str] | Default: 'all'Optional specification of a metadata indexing policy, i.e. to fine-tune which of the metadata fields are indexed. It can be a string ("all" or "none"), or a 2-tuple. The following means that all fields except 'f1', 'f2' ... are NOT indexed: metadata_indexing=("allowlist", ["f1", "f2", ...]) The following means all fields EXCEPT 'g1', 'g2', ... are indexed: metadata_indexing("denylist", ["g1", "g2", ...]) The default is to index every metadata field. Note: if you plan to have massive unique text metadata entries, consider not indexing them for performance (and to overcome max-length limitations). |