VectorstoreIndexCreator#

class langchain.indexes.vectorstore.VectorstoreIndexCreator[source]#

Bases: BaseModel

Logic for creating indexes.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param embedding: Embeddings [Required]#
param text_splitter: TextSplitter [Optional]#
param vectorstore_cls: Type[VectorStore] [Optional]#
param vectorstore_kwargs: dict [Optional]#
async afrom_documents(documents: List[Document]) VectorStoreIndexWrapper[source]#

Asynchronously create a vectorstore index from a list of documents.

Parameters:

documents (List[Document]) – A list of Document objects.

Returns:

A VectorStoreIndexWrapper containing the constructed vectorstore.

Return type:

VectorStoreIndexWrapper

async afrom_loaders(loaders: List[BaseLoader]) VectorStoreIndexWrapper[source]#

Asynchronously create a vectorstore index from a list of loaders.

Parameters:

loaders (List[BaseLoader]) – A list of BaseLoader instances to load documents.

Returns:

A VectorStoreIndexWrapper containing the constructed vectorstore.

Return type:

VectorStoreIndexWrapper

from_documents(documents: List[Document]) VectorStoreIndexWrapper[source]#

Create a vectorstore index from a list of documents.

Parameters:

documents (List[Document]) – A list of Document objects.

Returns:

A VectorStoreIndexWrapper containing the constructed vectorstore.

Return type:

VectorStoreIndexWrapper

from_loaders(loaders: List[BaseLoader]) VectorStoreIndexWrapper[source]#

Create a vectorstore index from a list of loaders.

Parameters:

loaders (List[BaseLoader]) – A list of BaseLoader instances to load documents.

Returns:

A VectorStoreIndexWrapper containing the constructed vectorstore.

Return type:

VectorStoreIndexWrapper

Examples using VectorstoreIndexCreator