Construct TileDB index from embeddings.
from_embeddings(
cls,
text_embeddings: List[Tuple[str, List[float]]],
embedding: Embeddings,
index_uri: str,
*,
metadatas: Optional[List[dict]] = None,
ids: Optional[List[str]] = None,
metric: str = DEFAULT_METRIC,
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() text_embeddings = embeddings.embed_documents(texts) text_embedding_pairs = list(zip(texts, text_embeddings)) db = TileDB.from_embeddings(text_embedding_pairs, embeddings)
| Name | Type | Description |
|---|---|---|
text_embeddings* | List[Tuple[str, List[float]]] | List of tuples of (text, embedding) |
embedding* | Embeddings | Embedding function to use. |
index_uri* | str | The URI to write the TileDB arrays |
metadatas | Optional[List[dict]] | Default: NoneList of metadata dictionaries to associate with documents. |
metric | str | Default: DEFAULT_METRICOptional, Metric to use for indexing. Defaults to "euclidean". |
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. |