Aroy1997 commited on
Commit
78b4e34
·
verified ·
1 Parent(s): 922242c

Update llm_utils.py

Browse files
Files changed (1) hide show
  1. llm_utils.py +15 -0
llm_utils.py CHANGED
@@ -14,7 +14,22 @@ def load_theorem_db(path="theorems.yaml"):
14
  raise ValueError("Invalid theorems.yaml structure")
15
 
16
  return data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
 
18
 
19
  def generate_context(theorems, equation_type):
20
  context = f"# Theorem Reference Context for Solving {equation_type.capitalize()} Equations\n\n"
 
14
  raise ValueError("Invalid theorems.yaml structure")
15
 
16
  return data
17
+ def load_theorem_context(yaml_path="theorems.yaml"):
18
+ with open(yaml_path, 'r') as f:
19
+ data = yaml.safe_load(f)
20
+
21
+ context_lines = []
22
+ for idx, th in enumerate(data.get('theorems', []), 1):
23
+ context_lines.append(
24
+ f"**Theorem {idx}: {th['name']}**\n"
25
+ f"- **Statement**: {th['statement']}\n"
26
+ f"- **Tags**: {', '.join(th['tags'])}\n"
27
+ f"- **When to Use**: {th['when_to_use']}\n"
28
+ f"- **Short Explanation**: {th['short_explanation']}\n"
29
+ )
30
+ context_lines.append('---')
31
 
32
+ return "\n".join(context_lines)
33
 
34
  def generate_context(theorems, equation_type):
35
  context = f"# Theorem Reference Context for Solving {equation_type.capitalize()} Equations\n\n"