Update App/Embedding/utils/Initialize.py
Browse files
App/Embedding/utils/Initialize.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from langchain.embeddings import HuggingFaceEmbeddings
|
2 |
from langchain.docstore.document import Document
|
3 |
from langchain.vectorstores import Pinecone
|
|
|
4 |
import pinecone
|
5 |
import os
|
6 |
|
@@ -19,7 +20,7 @@ async def delete_documents(task_id):
|
|
19 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
20 |
|
21 |
|
22 |
-
pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
23 |
vector_index = pinecone.Index(index_name=index_name)
|
24 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
25 |
|
@@ -63,7 +64,7 @@ def search(query: str, task_id: str):
|
|
63 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
64 |
|
65 |
|
66 |
-
pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
67 |
vector_index = pinecone.Index(index_name=index_name)
|
68 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
69 |
|
@@ -89,7 +90,7 @@ def encode(temp: list[Document]):
|
|
89 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
90 |
|
91 |
|
92 |
-
pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
93 |
vector_index = pinecone.Index(index_name=index_name)
|
94 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
95 |
docsearch.add_documents(temp)
|
|
|
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 |
|
|
|
20 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
21 |
|
22 |
|
23 |
+
pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
24 |
vector_index = pinecone.Index(index_name=index_name)
|
25 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
26 |
|
|
|
64 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
65 |
|
66 |
|
67 |
+
pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
68 |
vector_index = pinecone.Index(index_name=index_name)
|
69 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
70 |
|
|
|
90 |
embeddings = HuggingFaceEmbeddings(model_name=model_name)
|
91 |
|
92 |
|
93 |
+
pinecone.Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
|
94 |
vector_index = pinecone.Index(index_name=index_name)
|
95 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
96 |
docsearch.add_documents(temp)
|