RoyLee1224 commented on code in PR #69308: URL: https://github.com/apache/airflow/pull/69308#discussion_r3523237496
########## dev/skill-evals/eval.py: ########## @@ -0,0 +1,350 @@ +#!/usr/bin/env python3 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# /// script +# requires-python = ">=3.9" +# /// +"""Airflow skill-eval harness. + +Test whether AGENTS.md guidance affects agent decisions by comparing +arms with and without the guidance. Each arm is a git worktree of the +real repo — the agent sees actual source files. + +Usage: + uv run dev/skill-evals/eval.py Test AGENTS.md changes + uv run dev/skill-evals/eval.py --full Add baseline arm (no AGENTS.md) + uv run dev/skill-evals/eval.py --repeat 3 Reduce nondeterminism + +Authentication: Claude Code session (claude /login) or ANTHROPIC_API_KEY. +""" + +from __future__ import annotations + +import os +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +PROMPTFOO_VERSION = "0.121.17" + +REPO_ROOT = Path(__file__).resolve().parent.parent.parent +SCRIPT_DIR = Path(__file__).resolve().parent +AGENTS_SRC = REPO_ROOT / "AGENTS.md" + +OUTPUT_SCHEMA = """\ + output_format: + type: json_schema + schema: + type: object + required: [should_create, rationale] + additionalProperties: false + properties: + should_create: + type: boolean + type: + type: string + enum: [bugfix, feature, improvement, doc, misc, significant] + rationale: + type: string""" + + +def run(cmd: list[str], **kwargs) -> subprocess.CompletedProcess[str]: + return subprocess.run(cmd, capture_output=True, text=True, check=False, **kwargs) + + +def check_prerequisites() -> None: + if not shutil.which("node"): + print("Error: Node.js not found. Install Node.js >=22.22.0", file=sys.stderr) + sys.exit(1) + if not shutil.which("npx"): + print("Error: npx not found.", file=sys.stderr) + sys.exit(1) + + sdk_dir = Path.home() / ".promptfoo-sdk" / "node_modules" / "@anthropic-ai" / "claude-agent-sdk" + if not sdk_dir.is_dir(): + print("Error: Claude Agent SDK not found. Run:", file=sys.stderr) + print( + " mkdir -p ~/.promptfoo-sdk && cd ~/.promptfoo-sdk" Review Comment: Good point, addressed in f88372973736808a31dd970d4782b4f81d526d89: eval results now go to `files/skill-evals/` per the convention, and tool state (promptfoo db/cache, the SDK) moved to `.build/` like the mypy venvs. Nothing lands in the home dir anymore. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
