abnerguzman commited on
Commit
c8fc26b
1 Parent(s): 84b9cf4

Update util.py

Browse files
Files changed (1) hide show
  1. util.py +3 -4
util.py CHANGED
@@ -22,8 +22,7 @@ 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
- 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
 
@@ -85,7 +84,7 @@ prompt_tf_template = "Given the context below, anwer the question that follows.
85
 
86
  def get_atoms_list(answer, file=None):
87
  prompt_af = prompt_af_template_llama3.format(answer)
88
- response = None
89
  for _ in range(5):
90
  try:
91
  # response = octoai_client.chat.completions.create(
@@ -126,7 +125,7 @@ def get_atoms_list(answer, file=None):
126
  time.sleep(2)
127
  return atoms_l
128
 
129
- def get_topk_matches(atom, k=5, pc_index=pc_128):
130
  embed_atom = get_embedding(atom)
131
  res = pc_index.query(vector=embed_atom, top_k=k, include_metadata=True)
132
  return res['matches']
 
22
 
23
  from pinecone import Pinecone, ServerlessSpec
24
  pc = Pinecone(api_key=os.getenv('PINECONE_API_KEY'))
25
+ pc_256 = pc.Index('prorata-postman-ds-256-v2')
 
26
  pc_128 = pc.Index('prorata-postman-ds-128-v2')
27
 
28
 
 
84
 
85
  def get_atoms_list(answer, file=None):
86
  prompt_af = prompt_af_template_llama3.format(answer)
87
+ response, atoms_l = None, []
88
  for _ in range(5):
89
  try:
90
  # response = octoai_client.chat.completions.create(
 
125
  time.sleep(2)
126
  return atoms_l
127
 
128
+ def get_topk_matches(atom, k=5, pc_index=pc_256):
129
  embed_atom = get_embedding(atom)
130
  res = pc_index.query(vector=embed_atom, top_k=k, include_metadata=True)
131
  return res['matches']