-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaseline.py
More file actions
37 lines (26 loc) · 777 Bytes
/
baseline.py
File metadata and controls
37 lines (26 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from env.env import CodeEnv
from env.models import Action
from agent.llm_agent import LLMAgent
env = CodeEnv()
agent = LLMAgent()
# reset env
state = env.reset()
print("\n📌 Problem:", state.problem)
print("Difficulty:", state.difficulty)
best_reward = 0
best_code = ""
# retry system
for i in range(3):
print(f"\n--- Attempt {i+1} ---")
# IMPORTANT: state.problem pass karna
code = agent.act(state)
# wrap in Action model
action = Action(code=code)
# env step
result = env.step(action)
print("Reward:", result.reward)
if result.reward > best_reward:
best_reward = result.reward
best_code = code
print("\n🔥 BEST CODE:\n", best_code)
print("🏆 FINAL REWARD:", best_reward)