Chat-PDF / core /vector_store.py
Salahin's picture
Initial commit
642d32b
Raw History Blame Contribute Delete
470 Bytes
import streamlit as st
from langchain_google_genai import GoogleGenerativeAIEmbeddings
from langchain_community.vectorstores import FAISS
def get_vector_store(text_chunks):
try:
embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
vector_store = FAISS.from_texts(text_chunks, embedding=embeddings)
vector_store.save_local("data/faiss_index")
except Exception as e:
st.error(f"Error creating FAISS index: {e}")