tinycodinglm / agentic /aiagent-0105.jsonl
winapiadmin's picture
Upload folder using huggingface_hub
1f3a244 verified
|
Raw History Blame Contribute Delete
2.64 kB
{"type": "session", "harness": "opencode", "id": "aiagent-0105", "name": "evaluation"}
{"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}}
{"type": "message", "message": {"role": "user", "content": "How do I evaluate AI agents on task completion, tool accuracy, efficiency and safety, and which benchmarks exist (GAIA, AgentBench, ToolBench, HumanEval)? Show a runnable metrics harness. Include code examples."}}
{"type": "message", "message": {"role": "assistant", "content": "**Evaluate completion, tool use, efficiency, safety.**\n\n- **GAIA** (General AI Assistants, Mialon et al.): real-world web/code/file tasks\n- **AgentBench:** multi-environment agent tasks\n- **ToolBench:** tool-invocation correctness\n- **HumanEval:** code generation pass@k\n\n```python\nimport time\nfrom dataclasses import dataclass\n\n@dataclass\nclass AgentMetrics:\n task_completed: bool\n steps_taken: int\n tokens_used: int\n errors: int\n tool_accuracy: float\n seconds: float\n\n def score(self) -> float:\n steps = max(self.steps_taken, 1)\n toks = max(self.tokens_used, 1)\n return ((1.0 if self.task_completed else 0.0) * 0.4\n + self.tool_accuracy * 0.3\n + min(1.0, 10 / steps) * 0.15\n + min(1.0, 1000 / toks) * 0.15)\n\ndef check_answer(answer: str, expected: str) -> bool:\n return (answer or \"\").strip().lower() == (expected or \"\").strip().lower()\n\ndef evaluate_agent(agent, tasks: list[dict]) -> list[AgentMetrics]:\n results: list[AgentMetrics] = []\n for task in tasks:\n start = time.time()\n answer = agent.run(task[\"question\"])\n elapsed = time.time() - start\n total_calls = max(getattr(agent, \"total_tool_calls\", 0), 1)\n correct_calls = getattr(agent, \"correct_tool_calls\", 0)\n results.append(AgentMetrics(\n task_completed=check_answer(answer, task.get(\"expected\", \"\")),\n steps_taken=max(getattr(agent, \"step_count\", 1), 1),\n tokens_used=max(getattr(agent, \"token_count\", 1), 1),\n errors=getattr(agent, \"error_count\", 0),\n tool_accuracy=correct_calls / total_calls,\n seconds=elapsed,\n ))\n return results\n```"}}