Update App/Embedding/utils/Initialize.py
Browse files
App/Embedding/utils/Initialize.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from langchain.embeddings import HuggingFaceEmbeddings
|
2 |
from langchain.docstore.document import Document
|
3 |
from langchain.vectorstores import Pinecone
|
4 |
-
|
5 |
import pinecone
|
6 |
import os
|
7 |
|
@@ -18,10 +18,11 @@ async def delete_documents(task_id):
|
|
18 |
index_name = "transcript-bits"
|
19 |
model_name = "thenlper/gte-base"
|
20 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
|
|
21 |
|
22 |
|
23 |
-
pc=pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
24 |
-
vector_index = pc.Index(index_name
|
25 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
26 |
|
27 |
docsearch.delete(
|
@@ -65,7 +66,7 @@ def search(query: str, task_id: str):
|
|
65 |
|
66 |
|
67 |
pc=pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
68 |
-
vector_index = pc.Index(index_name
|
69 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
70 |
|
71 |
filtering_conditions = {
|
@@ -91,7 +92,7 @@ def encode(temp: list[Document]):
|
|
91 |
|
92 |
|
93 |
pc=pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
94 |
-
vector_index = pc.Index(index_name
|
95 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
96 |
docsearch.add_documents(temp)
|
97 |
# return embeddings.embed_documents(texts = [d.page_content for d in temp])
|
|
|
1 |
from langchain.embeddings import HuggingFaceEmbeddings
|
2 |
from langchain.docstore.document import Document
|
3 |
from langchain.vectorstores import Pinecone
|
4 |
+
from pinecone import PodSpec
|
5 |
import pinecone
|
6 |
import os
|
7 |
|
|
|
18 |
index_name = "transcript-bits"
|
19 |
model_name = "thenlper/gte-base"
|
20 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
21 |
+
spec = PodSpec()
|
22 |
|
23 |
|
24 |
+
pc=pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV,spec=spec)
|
25 |
+
vector_index = pc.Index(index_name)
|
26 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
27 |
|
28 |
docsearch.delete(
|
|
|
66 |
|
67 |
|
68 |
pc=pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
69 |
+
vector_index = pc.Index(index_name)
|
70 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
71 |
|
72 |
filtering_conditions = {
|
|
|
92 |
|
93 |
|
94 |
pc=pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
95 |
+
vector_index = pc.Index(index_name)
|
96 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
97 |
docsearch.add_documents(temp)
|
98 |
# return embeddings.embed_documents(texts = [d.page_content for d in temp])
|