Mbonea commited on
Commit
0bbe0b5
·
1 Parent(s): a31da9c

Reshuffed the config

Browse files
Files changed (1) hide show
  1. App/Embedding/utils/Initialize.py +28 -11
App/Embedding/utils/Initialize.py CHANGED
@@ -4,23 +4,25 @@ from langchain.vectorstores import Pinecone
4
  import pinecone
5
  import os
6
 
7
- # get api key from app.pinecone.io
8
- PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY")
9
- # find your environment next to the api key in pinecone console
10
- PINECONE_ENV = os.environ.get("PINECONE_ENVIRONMENT")
11
 
12
 
13
- index_name = "transcript-bits"
14
- model_name = "thenlper/gte-base"
15
- embeddings = HuggingFaceEmbeddings(model_name=model_name)
16
 
 
 
 
 
 
17
 
18
- pinecone.init(api_key=PINECONE_API_KEY, environment=PINECONE_ENV)
19
- vector_index = pinecone.Index(index_name=index_name)
20
- docsearch = Pinecone.from_existing_index(index_name, embeddings)
21
 
 
 
 
 
 
 
 
 
22
 
23
- async def delete_documents(task_id):
24
  docsearch.delete(
25
  filter={
26
  "task_id": {"$eq": "task_id"},
@@ -50,6 +52,21 @@ def generateChunks(chunks, task_id, n=100):
50
 
51
 
52
  def search(query: str, task_id: str):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  filtering_conditions = {
54
  "task_id": {"$eq": "task_id"},
55
  }
 
4
  import pinecone
5
  import os
6
 
 
 
 
 
7
 
8
 
 
 
 
9
 
10
+ async def delete_documents(task_id):
11
+ # get api key from app.pinecone.io
12
+ PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY")
13
+ # find your environment next to the api key in pinecone console
14
+ PINECONE_ENV = os.environ.get("PINECONE_ENVIRONMENT")
15
 
 
 
 
16
 
17
+ index_name = "transcript-bits"
18
+ model_name = "thenlper/gte-base"
19
+ embeddings = HuggingFaceEmbeddings(model_name=model_name)
20
+
21
+
22
+ pinecone.init(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
 
 
26
  docsearch.delete(
27
  filter={
28
  "task_id": {"$eq": "task_id"},
 
52
 
53
 
54
  def search(query: str, task_id: str):
55
+ # get api key from app.pinecone.io
56
+ PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY")
57
+ # find your environment next to the api key in pinecone console
58
+ PINECONE_ENV = os.environ.get("PINECONE_ENVIRONMENT")
59
+
60
+
61
+ index_name = "transcript-bits"
62
+ model_name = "thenlper/gte-base"
63
+ embeddings = HuggingFaceEmbeddings(model_name=model_name)
64
+
65
+
66
+ pinecone.init(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
+
70
  filtering_conditions = {
71
  "task_id": {"$eq": "task_id"},
72
  }