Zack Saadioui
8/26/2024
1
text-embedding-ada-002
1
similarity_top_k
1
2
3
4
5
6
7
python
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex, Settings
documents = SimpleDirectoryReader("./data").load_data()
Settings.chunk_size = 512
Settings.chunk_overlap = 50
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine(similarity_top_k=4)
1
2
3
4
5
6
python
from llama_index.core import VectorStoreIndex, Document
from llama_index.core.vector_stores import MetadataFilters, ExactMatchFilter
documents = [Document(text="text", metadata={"author": "LlamaIndex"}), ...]
filters = MetadataFilters(filters=[ExactMatchFilter(key="author", value="John Doe")])
index = VectorStoreIndex.from_documents(documents)
1
VectorStoreIndex
1
VectorDB
Copyright © Arsturn 2024