Adds text documents to the vector store with optional metadata.
add_texts(
    texts: Iterable[str],
    metadatas: Optional[List[dict]] = None,
    ids: Optional[List[str]] = None,
    **kwargs
) -> List[str]

Parameters

ParameterTypeDescription
textsIterable[str]Iterable of text strings to add
metadatasOptional[List[dict]](Optional) List of metadata dictionaries for each text
idsOptional[List[str]](Optional) List of IDs for the texts (auto-generated if not provided)
**kwargsAnyAdditional keyword arguments (currently unused)

Returns

List[str]: List of IDs for the added texts

Exceptions

Example Usage

# Add texts with auto-generated IDs
texts = ["Document about AI", "Document about ML", "Document about NLP"]
ids = store.add_texts(texts)
print(f"Added {len(ids)} documents")

# Add texts with metadata and custom IDs
texts = ["Python tutorial", "JavaScript guide"]
metadatas = [
    {"language": "python", "level": "beginner"},
    {"language": "javascript", "level": "intermediate"}
]
custom_ids = ["doc1", "doc2"]
ids = store.add_texts(texts, metadatas=metadatas, ids=custom_ids)