Spaces:
Sleeping
Sleeping
abnerguzman
commited on
Commit
•
c9957c2
1
Parent(s):
31c985b
Update util.py
Browse files
util.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
-
from dotenv import load_dotenv
|
2 |
import os
|
3 |
-
load_dotenv()
|
4 |
|
5 |
import concurrent.futures
|
6 |
from collections import defaultdict
|
@@ -22,9 +20,8 @@ octoai_client = octoai.client.Client(token=os.getenv('OCTOML_KEY'))
|
|
22 |
|
23 |
from pinecone import Pinecone, ServerlessSpec
|
24 |
pc = Pinecone(api_key=os.getenv('PINECONE_API_KEY'))
|
25 |
-
|
26 |
-
|
27 |
-
pc_128 = pc.Index('prorata-postman-ds-128')
|
28 |
|
29 |
|
30 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
@@ -44,7 +41,7 @@ def get_embedding(text, model="text-embedding-3-small"):
|
|
44 |
text = text.replace("\n", " ")
|
45 |
return openai_client.embeddings.create(input = [text], model=model).data[0].embedding
|
46 |
|
47 |
-
|
48 |
def get_embedding_l(text_l, model="text-embedding-3-small"):
|
49 |
text_l = [text.replace("\n", " ") for text in text_l]
|
50 |
res = openai_client.embeddings.create(input=text_l, model=model)
|
|
|
|
|
1 |
import os
|
|
|
2 |
|
3 |
import concurrent.futures
|
4 |
from collections import defaultdict
|
|
|
20 |
|
21 |
from pinecone import Pinecone, ServerlessSpec
|
22 |
pc = Pinecone(api_key=os.getenv('PINECONE_API_KEY'))
|
23 |
+
pc_256 = pc.Index('prorata-postman-ds-256-v2')
|
24 |
+
pc_128 = pc.Index('prorata-postman-ds-128-v2')
|
|
|
25 |
|
26 |
|
27 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
41 |
text = text.replace("\n", " ")
|
42 |
return openai_client.embeddings.create(input = [text], model=model).data[0].embedding
|
43 |
|
44 |
+
|
45 |
def get_embedding_l(text_l, model="text-embedding-3-small"):
|
46 |
text_l = [text.replace("\n", " ") for text in text_l]
|
47 |
res = openai_client.embeddings.create(input=text_l, model=model)
|