gavinzli's picture
Refactor email handling: remove mail module, update service routes, and enhance EmailQuery model with additional parameters
af61c79
raw
history blame
752 Bytes
"""This module is responsible for initializing the database connection and creating the necessary tables."""
from pinecone import Pinecone, ServerlessSpec
from langchain_pinecone import PineconeVectorStore
# from torch import embedding
from models.llm import GPTEmbeddings
# embeddings = EmbeddingsModel("all-MiniLM-L6-v2")
embeddings = GPTEmbeddings()
pc = Pinecone()
INDEX_NAME = "gmails"
if not pc.has_index(INDEX_NAME):
pc.create_index(
name=INDEX_NAME,
dimension=len(embeddings.embed_query("hello")),
metric="cosine",
spec=ServerlessSpec(
cloud="aws",
region="us-east-1"
)
)
index = pc.Index(INDEX_NAME)
vectorstore = PineconeVectorStore(index=index, embedding=embeddings)