Skip to content

Commit 5cd17d6

Browse files
committed
update
1 parent 138af6d commit 5cd17d6

File tree

6 files changed

+1135
-47
lines changed

6 files changed

+1135
-47
lines changed

optillm/mars/agent.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def generate_solution(self, problem: str, request_id: str = None) -> Tuple[Agent
5353

5454
# Configure reasoning parameters - simplified with effort only
5555
reasoning_effort = self._get_reasoning_effort()
56-
max_tokens = self.config['max_tokens'] # Fixed 30k
56+
max_tokens = self.config['max_tokens']
5757

5858
reasoning_config = {
5959
"effort": reasoning_effort
@@ -104,34 +104,31 @@ def generate_solution(self, problem: str, request_id: str = None) -> Tuple[Agent
104104

105105
# Create agent solution object with enhanced metadata
106106
agent_solution = AgentSolution(
107-
agent_id=self.agent_id,
108-
temperature=self.temperature,
107+
agent_id=str(self.agent_id), # Convert to str for compatibility
109108
solution=solution_text,
110109
confidence=confidence,
111110
reasoning_tokens=reasoning_tokens,
112-
timestamp=datetime.now()
111+
total_tokens=total_tokens,
112+
solution_length=solution_length,
113+
temperature=self.temperature
113114
)
114115

115-
# Add metadata to solution object
116-
agent_solution.solution_length = solution_length
117-
agent_solution.total_tokens = total_tokens
118-
119116
logger.info(f"Agent {self.agent_id} generated solution with {reasoning_tokens} reasoning tokens")
120117
return agent_solution, reasoning_tokens
121118

122119
except Exception as e:
123120
logger.error(f"Agent {self.agent_id} error generating solution: {str(e)}")
124121
# Return empty solution with error indication
122+
error_message = f"Error generating solution: {str(e)}"
125123
error_solution = AgentSolution(
126-
agent_id=self.agent_id,
127-
temperature=self.temperature,
128-
solution=f"Error generating solution: {str(e)}",
124+
agent_id=str(self.agent_id), # Convert to str for compatibility
125+
solution=error_message,
129126
confidence=0.0,
130127
reasoning_tokens=0,
131-
timestamp=datetime.now()
128+
total_tokens=0,
129+
solution_length=len(error_message),
130+
temperature=self.temperature
132131
)
133-
error_solution.solution_length = len(error_solution.solution)
134-
error_solution.total_tokens = 0
135132
return error_solution, 0
136133

137134
def verify_solution(self, problem: str, solution: str, verifier_id: int, solution_agent_id: int, request_id: str = None) -> VerificationResult:
@@ -144,7 +141,7 @@ def verify_solution(self, problem: str, solution: str, verifier_id: int, solutio
144141
)
145142

146143
# Use simplified verification with effort parameter
147-
max_tokens = self.config['max_tokens'] # Fixed 30k
144+
max_tokens = self.config['max_tokens']
148145

149146
try:
150147
response = self.client.chat.completions.create(
@@ -204,7 +201,7 @@ def improve_solution(self, problem: str, current_solution: str, feedback: str, i
204201
)
205202

206203
# Use simplified improvement with high effort
207-
max_tokens = self.config['max_tokens'] # Fixed 30k
204+
max_tokens = self.config['max_tokens']
208205

209206
try:
210207
response = self.client.chat.completions.create(

0 commit comments

Comments
 (0)