FelixPhilip commited on
Commit
3ca27e7
·
1 Parent(s): 274692a

Oracle weight assigning update

Browse files
Files changed (1) hide show
  1. Oracle/deepfundingoracle.py +3 -1
Oracle/deepfundingoracle.py CHANGED
@@ -256,10 +256,12 @@ def assign_base_weight(df, max_workers=32):
256
  "- Contributors\n\n"
257
  "Assign a weight (0-1) to each feature based on its importance in determining "
258
  "the influence of a repository. Provide the weights as a JSON object with "
259
- "keys as feature names and values as their weights."
260
  )
261
  try:
262
  response = llama.predict(prompt)
 
 
263
  feature_weights = json.loads(response) # Safely parse JSON
264
  print(f"[INFO] Feature weights from LLM: {feature_weights}", flush=True)
265
  except (json.JSONDecodeError, Exception) as e:
 
256
  "- Contributors\n\n"
257
  "Assign a weight (0-1) to each feature based on its importance in determining "
258
  "the influence of a repository. Provide the weights as a JSON object with "
259
+ "keys as feature names and values as their weights. Ensure the response is strictly in valid JSON format."
260
  )
261
  try:
262
  response = llama.predict(prompt)
263
+ if not response.strip():
264
+ raise ValueError("Empty response from LLM.")
265
  feature_weights = json.loads(response) # Safely parse JSON
266
  print(f"[INFO] Feature weights from LLM: {feature_weights}", flush=True)
267
  except (json.JSONDecodeError, Exception) as e: