Spaces:
Sleeping
Sleeping
abnerguzman
commited on
Commit
•
0cf3c20
1
Parent(s):
b6a853f
Update util.py
Browse files
util.py
CHANGED
@@ -23,7 +23,7 @@ octoai_client = octoai.client.Client(token=os.getenv('OCTOML_KEY'))
|
|
23 |
from pinecone import Pinecone, ServerlessSpec
|
24 |
pc = Pinecone(api_key=os.getenv('PINECONE_API_KEY'))
|
25 |
pc_512 = pc.Index('prorata-postman-ds')
|
26 |
-
pc_256 = pc.Index('prorata-postman-ds-256')
|
27 |
pc_128 = pc.Index('prorata-postman-ds-128-v2')
|
28 |
|
29 |
|
@@ -88,6 +88,18 @@ def get_atoms_list(answer, file=None):
|
|
88 |
response, atoms_l = None, []
|
89 |
for _ in range(5):
|
90 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
response = octoai_client.chat.completions.create(
|
92 |
model="meta-llama-3-70b-instruct",
|
93 |
messages=[
|
@@ -114,7 +126,7 @@ def get_atoms_list(answer, file=None):
|
|
114 |
time.sleep(2)
|
115 |
return atoms_l
|
116 |
|
117 |
-
def get_topk_matches(atom, k=5, pc_index=
|
118 |
embed_atom = get_embedding(atom)
|
119 |
res = pc_index.query(vector=embed_atom, top_k=k, include_metadata=True)
|
120 |
return res['matches']
|
|
|
23 |
from pinecone import Pinecone, ServerlessSpec
|
24 |
pc = Pinecone(api_key=os.getenv('PINECONE_API_KEY'))
|
25 |
pc_512 = pc.Index('prorata-postman-ds')
|
26 |
+
pc_256 = pc.Index('prorata-postman-ds-256-v2')
|
27 |
pc_128 = pc.Index('prorata-postman-ds-128-v2')
|
28 |
|
29 |
|
|
|
88 |
response, atoms_l = None, []
|
89 |
for _ in range(5):
|
90 |
try:
|
91 |
+
# response = octoai_client.chat.completions.create(
|
92 |
+
# model="meta-llama-3-70b-instruct",
|
93 |
+
# messages=[
|
94 |
+
# {"role": "system", "content": "You are a helpful assistant."},
|
95 |
+
# {"role": "user", "content": prompt_af}
|
96 |
+
# ],
|
97 |
+
# # response_format={"type": "json_object"},
|
98 |
+
# max_tokens=512,
|
99 |
+
# presence_penalty=0,
|
100 |
+
# temperature=0.1,
|
101 |
+
# top_p=0.9,
|
102 |
+
# )
|
103 |
response = octoai_client.chat.completions.create(
|
104 |
model="meta-llama-3-70b-instruct",
|
105 |
messages=[
|
|
|
126 |
time.sleep(2)
|
127 |
return atoms_l
|
128 |
|
129 |
+
def get_topk_matches(atom, k=5, pc_index=pc_256):
|
130 |
embed_atom = get_embedding(atom)
|
131 |
res = pc_index.query(vector=embed_atom, top_k=k, include_metadata=True)
|
132 |
return res['matches']
|