Construct a TileDB index from raw documents.
from_texts(
cls,
texts: List[str],
embedding: Embeddings,
metadatas: Optional[List[dict]] = None,
ids: Optional[List[str]] = None,
metric: str = DEFAULT_METRIC,
index_uri: str = '/tmp/tiledb_array',
index_type: str = 'FLAT',
config: Optional[Mapping[str, Any]] = None,
index_timestamp: int = 0,
**kwargs: Any = {}
) -> TileDBExample:
.. code-block:: python
from langchain_community import TileDB from langchain_community.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings() index = TileDB.from_texts(texts, embeddings)
| Name | Type | Description |
|---|---|---|
texts* | List[str] | List of documents to index. |
embedding* | Embeddings | Embedding function to use. |
metadatas | Optional[List[dict]] | Default: NoneList of metadata dictionaries to associate with documents. |
ids | Optional[List[str]] | Default: NoneOptional ids of each text object. |
metric | str | Default: DEFAULT_METRICMetric to use for indexing. Defaults to "euclidean". |
index_uri | str | Default: '/tmp/tiledb_array'The URI to write the TileDB arrays |
index_type | str | Default: 'FLAT'Optional, Vector index type ("FLAT", IVF_FLAT") |
config | Optional[Mapping[str, Any]] | Default: NoneOptional, TileDB config |
index_timestamp | int | Default: 0Optional, timestamp to write new texts with. |