Spaces:
Sleeping
Sleeping
Prasham.Jain Claude Sonnet 4.6 commited on
Commit ·
9fa7302
1
Parent(s): ba93ec0
fix(trajectory_gen): add --scenarios-dir flag for server-free generation
Browse filesAllows pointing trajectory_gen directly at a scenarios/ directory,
using MockEnvClient in-process. No running env server required.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
src/ci_triage_env/training/trajectory_gen.py
CHANGED
|
@@ -291,12 +291,17 @@ def main(argv: list[str] | None = None) -> None:
|
|
| 291 |
parser.add_argument("--count", type=int, default=600, help="Trajectories to attempt")
|
| 292 |
parser.add_argument("--model", default="gpt-4o-mini", help="OpenAI model name")
|
| 293 |
parser.add_argument("--budget", type=float, default=25.0, help="USD spend cap")
|
| 294 |
-
parser.add_argument("--env-url", default="http://localhost:8000", help="Env server URL")
|
| 295 |
parser.add_argument("--output", default="data_artifacts/sft_dataset/", help="Output dir")
|
| 296 |
parser.add_argument("--top-fraction", type=float, default=0.30, help="Keep top N%")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
parser.add_argument(
|
| 298 |
"--mock", action="store_true",
|
| 299 |
-
help="Use MockEnvClient (no
|
| 300 |
)
|
| 301 |
args = parser.parse_args(argv)
|
| 302 |
|
|
@@ -304,7 +309,11 @@ def main(argv: list[str] | None = None) -> None:
|
|
| 304 |
if not api_key:
|
| 305 |
print("warning: OPENAI_API_KEY not set — generation will fail on first call")
|
| 306 |
|
| 307 |
-
if args.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
from ci_triage_env.training.mock_env_client import MockEnvClient
|
| 309 |
env = MockEnvClient()
|
| 310 |
else:
|
|
|
|
| 291 |
parser.add_argument("--count", type=int, default=600, help="Trajectories to attempt")
|
| 292 |
parser.add_argument("--model", default="gpt-4o-mini", help="OpenAI model name")
|
| 293 |
parser.add_argument("--budget", type=float, default=25.0, help="USD spend cap")
|
| 294 |
+
parser.add_argument("--env-url", default="http://localhost:8000", help="Env server URL (ignored when --scenarios-dir is set)")
|
| 295 |
parser.add_argument("--output", default="data_artifacts/sft_dataset/", help="Output dir")
|
| 296 |
parser.add_argument("--top-fraction", type=float, default=0.30, help="Keep top N%")
|
| 297 |
+
parser.add_argument(
|
| 298 |
+
"--scenarios-dir", default=None,
|
| 299 |
+
help="Path to a directory of scenario JSON files. Uses MockEnvClient in-process — no server needed. "
|
| 300 |
+
"Recommended for local generation."
|
| 301 |
+
)
|
| 302 |
parser.add_argument(
|
| 303 |
"--mock", action="store_true",
|
| 304 |
+
help="Use synthetic MockEnvClient (no scenarios-dir, no server; for smoke-testing only)"
|
| 305 |
)
|
| 306 |
args = parser.parse_args(argv)
|
| 307 |
|
|
|
|
| 309 |
if not api_key:
|
| 310 |
print("warning: OPENAI_API_KEY not set — generation will fail on first call")
|
| 311 |
|
| 312 |
+
if args.scenarios_dir:
|
| 313 |
+
from ci_triage_env.training.mock_env_client import MockEnvClient
|
| 314 |
+
env = MockEnvClient(scenarios_dir=args.scenarios_dir)
|
| 315 |
+
print(f"Using MockEnvClient with {len(env.scenario_ids)} real scenarios from {args.scenarios_dir}")
|
| 316 |
+
elif args.mock:
|
| 317 |
from ci_triage_env.training.mock_env_client import MockEnvClient
|
| 318 |
env = MockEnvClient()
|
| 319 |
else:
|