MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / query

Method query

codeclash/agents/mini_anthropic_model.py:184–206  ·  view source on GitHub ↗
(self, messages: list[dict[str, str]], **kwargs)

Source from the content-addressed store, hash-verified

182 )
183
184 def query(self, messages: list[dict[str, str]], **kwargs) -> dict:
185 for attempt in retry(logger=logger, abort_exceptions=self.abort_exceptions):
186 with attempt:
187 response = self._query(messages, **kwargs)
188 actions = self._parse_actions(response)
189 cost_output = self._calculate_cost(response)
190 GLOBAL_MODEL_STATS.add(cost_output["cost"])
191 content = []
192 for block in response.content:
193 d = block.model_dump()
194 if block.type == "tool_use":
195 d["text"] = f"```\n{block.input.get('command', json.dumps(block.input))}\n```"
196 content.append(d)
197 return {
198 "role": "assistant",
199 "content": content,
200 "extra": {
201 "actions": actions,
202 "response": response.model_dump(),
203 **cost_output,
204 "timestamp": time.time(),
205 },
206 }
207
208 def _parse_actions(self, response: anthropic.types.Message) -> list[dict]:
209 tool_calls = [

Callers 6

evaluateMethod · 0.80
mainFunction · 0.80
evaluateMethod · 0.80
visualize.ipynb.pyFile · 0.80
mainFunction · 0.80
evaluateMethod · 0.80

Calls 4

_queryMethod · 0.95
_parse_actionsMethod · 0.95
_calculate_costMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected