FaissVectorStore#
- pydantic model llama_index.vector_stores.FaissVectorStore#
Faiss Vector Store.
Embeddings are stored within a Faiss index.
During query time, the index uses Faiss to query for the top k embeddings, and returns the corresponding indices.
- Parameters
faiss_index (faiss.Index) – Faiss index instance
Show JSON schema
{ "title": "FaissVectorStore", "description": "Faiss Vector Store.\n\nEmbeddings are stored within a Faiss index.\n\nDuring query time, the index uses Faiss to query for the top\nk embeddings, and returns the corresponding indices.\n\nArgs:\n faiss_index (faiss.Index): Faiss index instance", "type": "object", "properties": { "stores_text": { "title": "Stores Text", "default": false, "type": "boolean" }, "is_embedding_query": { "title": "Is Embedding Query", "default": true, "type": "boolean" }, "class_name": { "title": "Class Name", "type": "string", "default": "base_component" } } }
- Config
schema_extra: function = <function BaseComponent.Config.schema_extra at 0x7ff1e41e53a0>
- Fields
stores_text (bool)
- field stores_text: bool = False#
- add(nodes: List[BaseNode], **add_kwargs: Any) List[str] #
Add nodes to index.
NOTE: in the Faiss vector store, we do not store text in Faiss.
- Parameters
nodes – List[BaseNode]: list of nodes with embeddings
- delete(ref_doc_id: str, **delete_kwargs: Any) None #
Delete nodes using with ref_doc_id.
- Parameters
ref_doc_id (str) – The doc_id of the document to delete.
- classmethod from_persist_dir(persist_dir: str = './storage', fs: Optional[AbstractFileSystem] = None) FaissVectorStore #
- classmethod from_persist_path(persist_path: str, fs: Optional[AbstractFileSystem] = None) FaissVectorStore #
- persist(persist_path: str = './storage/default__vector_store.json', fs: Optional[AbstractFileSystem] = None) None #
Save to file.
This method saves the vector store to disk.
- Parameters
persist_path (str) – The save_path of the file.
- query(query: VectorStoreQuery, **kwargs: Any) VectorStoreQueryResult #
Query index for top k most similar nodes.
- Parameters
query_embedding (List[float]) – query embedding
similarity_top_k (int) – top k most similar nodes
- property client: Any#
Return the faiss index.