synth-ai 0.2.8.dev4__py3-none-any.whl → 0.2.23.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- examples/README.md +1 -0
- examples/__init__.py +16 -0
- examples/analyze_semantic_words.sh +17 -0
- examples/baseline/banking77_baseline.py +243 -0
- examples/baseline/banking77_pipeline_baseline.py +294 -0
- examples/baseline/crafter_baseline.py +407 -0
- examples/baseline/pokemon_red_baseline.py +326 -0
- examples/baseline/simple_baseline.py +56 -0
- examples/baseline/warming_up_to_rl_baseline.py +239 -0
- examples/blog_posts/gepa/README.md +355 -0
- examples/blog_posts/gepa/configs/banking77_gepa_local.toml +95 -0
- examples/blog_posts/gepa/configs/banking77_gepa_test.toml +80 -0
- examples/blog_posts/gepa/configs/banking77_mipro_local.toml +50 -0
- examples/blog_posts/gepa/configs/banking77_pipeline_gepa_local.toml +101 -0
- examples/blog_posts/gepa/configs/banking77_pipeline_gepa_test.toml +96 -0
- examples/blog_posts/gepa/configs/hotpotqa_gepa_local.toml +57 -0
- examples/blog_posts/gepa/configs/hotpotqa_gepa_qwen.toml +35 -0
- examples/blog_posts/gepa/configs/hotpotqa_mipro_local.toml +51 -0
- examples/blog_posts/gepa/configs/hover_gepa_local.toml +57 -0
- examples/blog_posts/gepa/configs/hover_gepa_qwen.toml +35 -0
- examples/blog_posts/gepa/configs/hover_mipro_local.toml +51 -0
- examples/blog_posts/gepa/configs/ifbench_gepa_local.toml +57 -0
- examples/blog_posts/gepa/configs/ifbench_gepa_qwen.toml +35 -0
- examples/blog_posts/gepa/configs/ifbench_mipro_local.toml +51 -0
- examples/blog_posts/gepa/configs/pupa_gepa_local.toml +58 -0
- examples/blog_posts/gepa/configs/pupa_mipro_local.toml +52 -0
- examples/blog_posts/gepa/deploy_banking77_task_app.sh +54 -0
- examples/blog_posts/gepa/gepa_baseline.py +204 -0
- examples/blog_posts/gepa/query_prompts_example.py +97 -0
- examples/blog_posts/gepa/run_gepa_banking77.sh +112 -0
- examples/blog_posts/gepa/run_gepa_banking77_pipeline.sh +163 -0
- examples/blog_posts/gepa/task_apps.py +105 -0
- examples/blog_posts/gepa/test_gepa_local.sh +67 -0
- examples/blog_posts/gepa/verify_banking77_setup.sh +123 -0
- examples/blog_posts/mipro/README.md +415 -0
- examples/blog_posts/mipro/configs/banking77_mipro_local.toml +91 -0
- examples/blog_posts/mipro/configs/banking77_mipro_test.toml +87 -0
- examples/blog_posts/mipro/configs/banking77_pipeline_mipro_gemini_flash_lite_local.toml +98 -0
- examples/blog_posts/mipro/configs/banking77_pipeline_mipro_gpt41mini_local.toml +96 -0
- examples/blog_posts/mipro/configs/banking77_pipeline_mipro_local.toml +94 -0
- examples/blog_posts/mipro/configs/banking77_pipeline_mipro_test.toml +170 -0
- examples/blog_posts/mipro/deploy_banking77_pipeline_task_app.sh +59 -0
- examples/blog_posts/mipro/deploy_banking77_task_app.sh +41 -0
- examples/blog_posts/mipro/multi_step.md +79 -0
- examples/blog_posts/mipro/run_mipro_banking77.sh +191 -0
- examples/blog_posts/mipro/run_mipro_banking77_pipeline.sh +171 -0
- examples/blog_posts/mipro/run_mipro_banking77_pipeline_gemini_flash_lite.sh +177 -0
- examples/blog_posts/mipro/run_mipro_banking77_pipeline_gpt41mini.sh +173 -0
- examples/blog_posts/mipro/verify_banking77_setup.sh +117 -0
- examples/blog_posts/pokemon_vl/README.md +98 -0
- examples/blog_posts/pokemon_vl/configs/eval_gpt5nano.toml +26 -0
- examples/blog_posts/pokemon_vl/configs/eval_qwen3_vl.toml +27 -0
- examples/blog_posts/pokemon_vl/configs/eval_rl_final.toml +24 -0
- examples/blog_posts/pokemon_vl/configs/filter_high_reward.toml +10 -0
- examples/blog_posts/pokemon_vl/configs/train_rl_from_sft.toml +43 -0
- examples/blog_posts/pokemon_vl/configs/train_sft_qwen4b_vl.toml +40 -0
- examples/blog_posts/pokemon_vl/extract_images.py +239 -0
- examples/blog_posts/pokemon_vl/pokemon_vl_baseline.py +326 -0
- examples/blog_posts/pokemon_vl/run_eval_extract_images.py +209 -0
- examples/blog_posts/pokemon_vl/run_qwen_eval_extract_images.py +212 -0
- examples/blog_posts/pokemon_vl/text_box_analysis.md +106 -0
- examples/blog_posts/warming_up_to_rl/ARCHITECTURE.md +195 -0
- examples/blog_posts/warming_up_to_rl/FINAL_TEST_RESULTS.md +127 -0
- examples/blog_posts/warming_up_to_rl/INFERENCE_SUCCESS.md +132 -0
- examples/blog_posts/warming_up_to_rl/README.md +158 -0
- examples/blog_posts/warming_up_to_rl/SMOKE_TESTING.md +164 -0
- examples/blog_posts/warming_up_to_rl/SMOKE_TEST_COMPLETE.md +253 -0
- examples/blog_posts/warming_up_to_rl/configs/eval_baseline_qwen32b_10x20.toml +25 -0
- examples/blog_posts/warming_up_to_rl/configs/eval_ft_qwen4b.toml +25 -0
- examples/blog_posts/warming_up_to_rl/configs/eval_ft_qwen4b_10x20.toml +26 -0
- examples/blog_posts/warming_up_to_rl/configs/eval_groq_qwen32b.toml +25 -0
- examples/blog_posts/warming_up_to_rl/configs/eval_openai_gpt_oss_120b.toml +29 -0
- examples/blog_posts/warming_up_to_rl/configs/filter_high_reward_dataset.toml +10 -0
- examples/blog_posts/warming_up_to_rl/configs/smoke_test.toml +75 -0
- examples/blog_posts/warming_up_to_rl/configs/train_rl_from_sft.toml +91 -0
- examples/blog_posts/warming_up_to_rl/configs/train_sft_qwen4b.toml +40 -0
- examples/blog_posts/warming_up_to_rl/warming_up_to_rl_baseline.py +187 -0
- examples/crafter_debug_render.py +186 -0
- examples/dev/qwen3_32b_qlora_4xh100.toml +45 -0
- examples/gepa/banking77_pipeline_gepa.toml +96 -0
- examples/gepa/multi_stage_gepa_example.toml +84 -0
- examples/gepa/run_gepa_banking77_pipeline.sh +157 -0
- examples/multi_step/SFT_README.md +147 -0
- examples/multi_step/configs/README_verilog_rl.md +77 -0
- examples/multi_step/configs/VERILOG_REWARDS.md +103 -0
- examples/multi_step/configs/VERILOG_RL_CHECKLIST.md +196 -0
- examples/multi_step/configs/crafter_eval_synth_qwen4b.toml +35 -0
- examples/multi_step/configs/crafter_eval_text_only_groq_qwen32b.toml +36 -0
- examples/multi_step/configs/crafter_rl_outcome.toml +75 -0
- examples/multi_step/configs/crafter_rl_stepwise_hosted_judge.toml +145 -0
- examples/multi_step/configs/crafter_rl_stepwise_shaped.toml +84 -0
- examples/multi_step/configs/crafter_rl_stepwise_simple.toml +79 -0
- examples/multi_step/configs/crafter_rl_stepwise_simple_NEW_FORMAT.toml +105 -0
- examples/multi_step/configs/crafter_sft_qwen30b_lora.toml +62 -0
- examples/multi_step/configs/crafter_synth_backend.md +40 -0
- examples/multi_step/configs/verilog_eval_groq_qwen32b.toml +31 -0
- examples/multi_step/configs/verilog_eval_synth_qwen8b.toml +33 -0
- examples/multi_step/configs/verilog_rl_lora.toml +147 -0
- examples/multi_step/convert_traces_to_sft.py +84 -0
- examples/multi_step/crafter_rl_lora.md +70 -0
- examples/multi_step/judges/crafter_backend_judge.py +220 -0
- examples/multi_step/judges/verilog_backend_judge.py +234 -0
- examples/multi_step/readme.md +48 -0
- examples/multi_step/run_sft_qwen30b.sh +45 -0
- examples/multi_step/sse_metrics_streaming_notes.md +357 -0
- examples/multi_step/task_app_config_notes.md +494 -0
- examples/multi_step/verilog_rl_lora.md +218 -0
- examples/qwen_coder/README.md +102 -0
- examples/qwen_coder/_shared.py +113 -0
- examples/qwen_coder/configs/coder_lora_30b.toml +60 -0
- examples/qwen_coder/configs/coder_lora_4b.toml +61 -0
- examples/qwen_coder/configs/coder_lora_small.toml +57 -0
- examples/qwen_coder/generate_dataset.py +98 -0
- examples/qwen_coder/infer_ft_smoke.py +65 -0
- examples/qwen_coder/infer_prod_proxy.py +73 -0
- examples/qwen_coder/infer_via_synth.py +87 -0
- examples/qwen_coder/scripts/infer_coder.sh +19 -0
- examples/qwen_coder/scripts/train_coder_30b.sh +22 -0
- examples/qwen_coder/sft_full_17b.py +103 -0
- examples/qwen_coder/sft_lora_30b.py +110 -0
- examples/qwen_coder/subset_jsonl.py +39 -0
- examples/qwen_coder/todos.md +38 -0
- examples/qwen_coder/validate_jsonl.py +60 -0
- examples/qwen_vl/BUGS_AND_FIXES.md +232 -0
- examples/qwen_vl/IMAGE_VALIDATION_COMPLETE.md +271 -0
- examples/qwen_vl/IMAGE_VALIDATION_SUMMARY.md +260 -0
- examples/qwen_vl/INFERENCE_SFT_TESTS.md +412 -0
- examples/qwen_vl/NEXT_STEPS_2B.md +325 -0
- examples/qwen_vl/QUICKSTART.md +327 -0
- examples/qwen_vl/QUICKSTART_RL_VISION.md +110 -0
- examples/qwen_vl/README.md +152 -0
- examples/qwen_vl/RL_VISION_COMPLETE.md +475 -0
- examples/qwen_vl/RL_VISION_TESTING.md +333 -0
- examples/qwen_vl/SDK_VISION_INTEGRATION.md +328 -0
- examples/qwen_vl/SETUP_COMPLETE.md +274 -0
- examples/qwen_vl/VISION_TESTS_COMPLETE.md +489 -0
- examples/qwen_vl/VLM_PIPELINE_COMPLETE.md +242 -0
- examples/qwen_vl/__init__.py +2 -0
- examples/qwen_vl/collect_data_via_cli.md +415 -0
- examples/qwen_vl/collect_vision_traces.py +368 -0
- examples/qwen_vl/configs/crafter_rl_vision_qwen3vl4b.toml +110 -0
- examples/qwen_vl/configs/crafter_vlm_sft_example.toml +59 -0
- examples/qwen_vl/configs/eval_gpt4o_mini_vision.toml +26 -0
- examples/qwen_vl/configs/eval_gpt4o_vision_proper.toml +29 -0
- examples/qwen_vl/configs/eval_gpt5nano_vision.toml +26 -0
- examples/qwen_vl/configs/eval_qwen3vl_vision.toml +26 -0
- examples/qwen_vl/configs/filter_qwen3vl_sft.toml +49 -0
- examples/qwen_vl/configs/filter_vision_sft.toml +52 -0
- examples/qwen_vl/configs/filter_vision_test.toml +8 -0
- examples/qwen_vl/configs/sft_qwen3_vl_2b_test.toml +54 -0
- examples/qwen_vl/crafter_gpt5nano_agent.py +308 -0
- examples/qwen_vl/crafter_qwen_vl_agent.py +300 -0
- examples/qwen_vl/run_vision_comparison.sh +61 -0
- examples/qwen_vl/run_vision_sft_pipeline.sh +175 -0
- examples/qwen_vl/test_image_validation.py +201 -0
- examples/qwen_vl/test_sft_vision_data.py +110 -0
- examples/rl/README.md +169 -0
- examples/rl/configs/eval_base_qwen.toml +17 -0
- examples/rl/configs/eval_rl_qwen.toml +13 -0
- examples/rl/configs/rl_from_base_qwen.toml +62 -0
- examples/rl/configs/rl_from_base_qwen17.toml +80 -0
- examples/rl/configs/rl_from_ft_qwen.toml +37 -0
- examples/rl/download_dataset.py +80 -0
- examples/rl/run_eval.py +436 -0
- examples/rl/run_rl_and_save.py +111 -0
- examples/rl/task_app/README.md +21 -0
- examples/rl/task_app/math_single_step.py +990 -0
- examples/rl/task_app/math_task_app.py +111 -0
- examples/run_crafter_demo.sh +10 -0
- examples/sdk_prompt_learning_example.py +55 -0
- examples/sft/README.md +139 -0
- examples/sft/configs/crafter_fft_qwen0p6b.toml +49 -0
- examples/sft/configs/crafter_lora_qwen0p6b.toml +49 -0
- examples/sft/evaluate.py +117 -0
- examples/sft/export_dataset.py +120 -0
- examples/sft/generate_traces.py +164 -0
- examples/swe/__init__.py +12 -0
- examples/swe/task_app/README.md +135 -0
- examples/swe/task_app/__init__.py +2 -0
- examples/swe/task_app/grpo_swe_mini.py +604 -0
- examples/swe/task_app/grpo_swe_mini_task_app.py +124 -0
- examples/swe/task_app/hosted/README.md +173 -0
- examples/swe/task_app/hosted/__init__.py +5 -0
- examples/swe/task_app/hosted/branching.py +143 -0
- examples/swe/task_app/hosted/environment_routes.py +1289 -0
- examples/swe/task_app/hosted/envs/__init__.py +1 -0
- examples/swe/task_app/hosted/envs/crafter/__init__.py +6 -0
- examples/swe/task_app/hosted/envs/crafter/app.py +1 -0
- examples/swe/task_app/hosted/envs/crafter/environment.py +522 -0
- examples/swe/task_app/hosted/envs/crafter/policy.py +478 -0
- examples/swe/task_app/hosted/envs/crafter/react_agent.py +108 -0
- examples/swe/task_app/hosted/envs/crafter/shared.py +305 -0
- examples/swe/task_app/hosted/envs/crafter/tools.py +47 -0
- examples/swe/task_app/hosted/envs/mini_swe/__init__.py +8 -0
- examples/swe/task_app/hosted/envs/mini_swe/environment.py +1191 -0
- examples/swe/task_app/hosted/envs/mini_swe/policy.py +355 -0
- examples/swe/task_app/hosted/envs/mini_swe/shared.py +83 -0
- examples/swe/task_app/hosted/envs/mini_swe/tools.py +96 -0
- examples/swe/task_app/hosted/hosted_app.py +204 -0
- examples/swe/task_app/hosted/inference/__init__.py +5 -0
- examples/swe/task_app/hosted/inference/openai_client.py +584 -0
- examples/swe/task_app/hosted/main.py +100 -0
- examples/swe/task_app/hosted/policy_routes.py +1094 -0
- examples/swe/task_app/hosted/registry.py +195 -0
- examples/swe/task_app/hosted/rollout.py +1905 -0
- examples/swe/task_app/hosted/storage/__init__.py +5 -0
- examples/swe/task_app/hosted/storage/volume.py +211 -0
- examples/swe/task_app/hosted/test_agents.py +161 -0
- examples/swe/task_app/hosted/test_service.py +136 -0
- examples/swe/task_app/hosted/utils.py +62 -0
- examples/swe/task_app/morph_backend.py +178 -0
- examples/task_apps/IMAGE_ONLY_EVAL_QUICKSTART.md +258 -0
- examples/task_apps/TESTING.md +275 -0
- examples/task_apps/banking77/__init__.py +6 -0
- examples/task_apps/banking77/banking77_task_app.py +912 -0
- examples/task_apps/banking77/deploy_wrapper.py +46 -0
- examples/task_apps/banking77_pipeline/__init__.py +6 -0
- examples/task_apps/banking77_pipeline/banking77_pipeline_task_app.py +489 -0
- examples/task_apps/banking77_pipeline/deploy_wrapper.py +50 -0
- examples/task_apps/crafter/CREATE_SFT_DATASET.md +286 -0
- examples/task_apps/crafter/EVAL_IMAGE_ONLY_RESULTS.md +152 -0
- examples/task_apps/crafter/FILTER_COMMAND_STATUS.md +187 -0
- examples/task_apps/crafter/FILTER_COMMAND_SUCCESS.md +281 -0
- examples/task_apps/crafter/QUERY_EXAMPLES.md +203 -0
- examples/task_apps/crafter/README_IMAGE_ONLY_EVAL.md +316 -0
- examples/task_apps/crafter/eval_image_only_gpt4o.toml +28 -0
- examples/task_apps/crafter/eval_text_only_groq_llama.toml +36 -0
- examples/task_apps/crafter/filter_sft_dataset.toml +16 -0
- examples/task_apps/crafter/task_app/README.md +42 -0
- examples/task_apps/crafter/task_app/__init__.py +5 -0
- examples/task_apps/crafter/task_app/grpo_crafter.py +1055 -0
- examples/task_apps/crafter/task_app/grpo_crafter_task_app.py +146 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/README.md +173 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/__init__.py +5 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/branching.py +143 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/environment_routes.py +1226 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/__init__.py +1 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/__init__.py +6 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/app.py +1 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/environment.py +532 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/policy.py +583 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/react_agent.py +122 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/shared.py +305 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/envs/crafter/tools.py +47 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/hosted_app.py +253 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/inference/__init__.py +5 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/inference/openai_client.py +999 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/main.py +100 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/policy_routes.py +1252 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/registry.py +195 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/rollout.py +2233 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/storage/__init__.py +5 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/storage/volume.py +211 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/test_agents.py +161 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/test_service.py +136 -0
- examples/task_apps/crafter/task_app/synth_envs_hosted/utils.py +411 -0
- examples/task_apps/dev/pokemon_emerald/__init__.py +2 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/README.md +811 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/__init__.py +120 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/action.py +160 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/memory.py +155 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/perception.py +69 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/planning.py +96 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/simple.py +1502 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/system_prompt.py +4 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/grab_map.py +68 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/manual.py +216 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/__init__.py +35 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/emerald_utils.py +631 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/emulator.py +1544 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/enums.py +1428 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/memory_reader.py +4848 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/types.py +41 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/utils.py +298 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pyproject.toml +95 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/run.py +204 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/app.py +2152 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/client.py +429 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/frame_server.py +155 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/README.md +78 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/run_tests.py +122 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_agent_direct.py +76 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_agent_prompts.py +413 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_battle_state_formatting.py +204 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_dialogue_detection.py +133 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_dialogue_detection_comprehensive.py +229 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_direct_agent_emulator.py +300 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_fps_adjustment_pytest.py +205 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_house_to_outside_direct.py +200 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_house_to_outside_transition.py +284 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_map_ground_truth_comparison.py +468 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_memory_map.py +575 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_server_map_validation.py +311 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_torchic_state.py +259 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/anticheat.py +372 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/checkpoint.py +296 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/error_handler.py +275 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/get_local_ip.py +22 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/helpers.py +44 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/llm_logger.py +514 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_formatter.py +415 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_stitcher.py +1763 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_stitcher_singleton.py +33 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_trimmer.py +106 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_visualizer.py +334 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/ocr_dialogue.py +1020 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/recording.py +188 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/state_formatter.py +1481 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/vlm.py +862 -0
- examples/task_apps/dev/pokemon_emerald/modal_app.py +114 -0
- examples/task_apps/dev/pokemon_emerald/task_app/README.md +81 -0
- examples/task_apps/dev/pokemon_emerald/task_app/__init__.py +6 -0
- examples/task_apps/dev/pokemon_emerald/task_app/pokemon_emerald.py +685 -0
- examples/task_apps/enron/__init__.py +2 -0
- examples/task_apps/enron/eval_groq_qwen32.toml +16 -0
- examples/task_apps/enron/filter_sft.toml +5 -0
- examples/task_apps/enron/task_app/README.md +14 -0
- examples/task_apps/enron/task_app/__init__.py +1 -0
- examples/task_apps/enron/task_app/grpo_enron.py +906 -0
- examples/task_apps/enron/task_app/grpo_enron_task_app.py +146 -0
- examples/task_apps/enron/tests/__init__.py +4 -0
- examples/task_apps/enron/tests/conftest.py +115 -0
- examples/task_apps/enron/tests/integration/__init__.py +4 -0
- examples/task_apps/enron/tests/integration/test_enron_eval.py +179 -0
- examples/task_apps/enron/tests/integration/test_enron_rollout.py +135 -0
- examples/task_apps/enron/tests/unit/__init__.py +4 -0
- examples/task_apps/enron/tests/unit/test_enron_environment.py +126 -0
- examples/task_apps/gepa_benchmarks/__init__.py +7 -0
- examples/task_apps/gepa_benchmarks/common.py +260 -0
- examples/task_apps/gepa_benchmarks/hotpotqa_task_app.py +507 -0
- examples/task_apps/gepa_benchmarks/hover_task_app.py +436 -0
- examples/task_apps/gepa_benchmarks/ifbench_task_app.py +563 -0
- examples/task_apps/gepa_benchmarks/pupa_task_app.py +460 -0
- examples/task_apps/math/README.md +21 -0
- examples/task_apps/math/math_single_step.py +1000 -0
- examples/task_apps/math/math_task_app.py +115 -0
- examples/task_apps/pokemon_battle/__init__.py +2 -0
- examples/task_apps/pokemon_battle/modal_app.py +104 -0
- examples/task_apps/pokemon_battle/task_app/README.md +68 -0
- examples/task_apps/pokemon_battle/task_app/__init__.py +6 -0
- examples/task_apps/pokemon_battle/task_app/pokemon_showdown.py +932 -0
- examples/task_apps/pokemon_red/EVAL_IMAGE_ONLY_COMPLETE.md +283 -0
- examples/task_apps/pokemon_red/EVAL_IMAGE_ONLY_STATUS.md +155 -0
- examples/task_apps/pokemon_red/README.md +356 -0
- examples/task_apps/pokemon_red/README_IMAGE_ONLY_EVAL.md +428 -0
- examples/task_apps/pokemon_red/__init__.py +3 -0
- examples/task_apps/pokemon_red/eval_image_only_gpt4o.toml +30 -0
- examples/task_apps/pokemon_red/eval_pokemon_red_policy.py +224 -0
- examples/task_apps/pokemon_red/pallet_town_rl_config.toml +75 -0
- examples/task_apps/pokemon_red/task_app.py +1048 -0
- examples/task_apps/pokemon_red/test_pallet_town_rewards.py +193 -0
- examples/task_apps/sokoban/README.md +306 -0
- examples/task_apps/sokoban/__init__.py +3 -0
- examples/task_apps/sokoban/eval_groq_qwen32.toml +16 -0
- examples/task_apps/sokoban/eval_openai_gpt5.toml +16 -0
- examples/task_apps/sokoban/filter_sft.toml +5 -0
- examples/task_apps/sokoban/task_app.py +1058 -0
- examples/task_apps/sokoban/tests/__init__.py +4 -0
- examples/task_apps/sokoban/tests/conftest.py +113 -0
- examples/task_apps/sokoban/tests/integration/__init__.py +4 -0
- examples/task_apps/sokoban/tests/integration/test_sokoban_eval.py +57 -0
- examples/task_apps/sokoban/tests/integration/test_sokoban_rollout.py +198 -0
- examples/task_apps/sokoban/tests/unit/__init__.py +4 -0
- examples/task_apps/sokoban/tests/unit/test_sokoban_environment.py +114 -0
- examples/task_apps/verilog/__init__.py +1 -0
- examples/task_apps/verilog/eval_groq_qwen32b.toml +22 -0
- examples/task_apps/verilog/filter_sft.toml +5 -0
- examples/task_apps/verilog/task_app/README.md +12 -0
- examples/task_apps/verilog/task_app/__init__.py +1 -0
- examples/task_apps/verilog/task_app/grpo_verilog.py +1166 -0
- examples/task_apps/verilog/task_app/grpo_verilog_task_app.py +145 -0
- examples/task_apps/verilog/tests/__init__.py +4 -0
- examples/task_apps/verilog/tests/conftest.py +115 -0
- examples/task_apps/verilog/tests/integration/__init__.py +4 -0
- examples/task_apps/verilog/tests/integration/test_verilog_eval.py +181 -0
- examples/task_apps/verilog/tests/integration/test_verilog_rollout.py +55 -0
- examples/task_apps/verilog/tests/unit/__init__.py +4 -0
- examples/task_apps/verilog/tests/unit/test_verilog_scoring.py +118 -0
- examples/tunnel_gepa_banking77/README.md +106 -0
- examples/tunnel_gepa_banking77/banking77_gepa_tunnel.toml +95 -0
- examples/tunnel_gepa_banking77/keep_tunnel_running.py +60 -0
- examples/tunnel_gepa_banking77/run_gepa_with_tunnel.sh +226 -0
- examples/vlm/PROPOSAL.md +53 -0
- examples/vlm/README.md +68 -0
- examples/vlm/configs/crafter_vlm_gpt4o.toml +49 -0
- examples/vlm/crafter_image_only_agent.py +207 -0
- examples/vlm/crafter_openai_vlm_agent.py +275 -0
- examples/vlm/filter_image_rows.py +63 -0
- examples/vlm/run_crafter_vlm_benchmark.py +316 -0
- examples/warming_up_to_rl/_utils.py +92 -0
- examples/warming_up_to_rl/analyze_trace_db.py +422 -0
- examples/warming_up_to_rl/configs/crafter_fft.toml +53 -0
- examples/warming_up_to_rl/configs/crafter_fft_4b.toml +54 -0
- examples/warming_up_to_rl/configs/eval_fft_qwen4b.toml +22 -0
- examples/warming_up_to_rl/configs/eval_groq_qwen32b.toml +15 -0
- examples/warming_up_to_rl/configs/eval_modal_qwen4b.toml +24 -0
- examples/warming_up_to_rl/configs/eval_stepwise_complex.toml +35 -0
- examples/warming_up_to_rl/configs/eval_stepwise_consistent.toml +26 -0
- examples/warming_up_to_rl/configs/eval_stepwise_per_achievement.toml +36 -0
- examples/warming_up_to_rl/configs/eval_stepwise_simple.toml +32 -0
- examples/warming_up_to_rl/configs/rl_from_base_qwen4b.toml +85 -0
- examples/warming_up_to_rl/configs/rl_from_ft.toml +58 -0
- examples/warming_up_to_rl/export_trace_sft.py +837 -0
- examples/warming_up_to_rl/groq_test.py +97 -0
- examples/warming_up_to_rl/manage_secrets.py +131 -0
- examples/warming_up_to_rl/old/event_rewards.md +234 -0
- examples/warming_up_to_rl/old/notes.md +73 -0
- examples/warming_up_to_rl/readme.md +110 -0
- examples/warming_up_to_rl/run_eval.py +736 -0
- examples/warming_up_to_rl/run_fft_and_save.py +380 -0
- examples/warming_up_to_rl/run_local_rollout.py +239 -0
- examples/warming_up_to_rl/run_local_rollout_modal.py +248 -0
- examples/warming_up_to_rl/run_local_rollout_parallel.py +405 -0
- examples/warming_up_to_rl/run_local_rollout_traced.py +477 -0
- examples/warming_up_to_rl/run_rl_and_save.py +124 -0
- examples/warming_up_to_rl/run_rollout_remote.py +156 -0
- examples/warming_up_to_rl/task_app/README.md +42 -0
- examples/warming_up_to_rl/task_app/grpo_crafter.py +876 -0
- examples/warming_up_to_rl/task_app/grpo_crafter_task_app.py +135 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/README.md +173 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/__init__.py +5 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/branching.py +143 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/environment_routes.py +1226 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/__init__.py +1 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/__init__.py +6 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/app.py +1 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/environment.py +522 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/policy.py +454 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/react_agent.py +108 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/shared.py +305 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/tools.py +47 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/hosted_app.py +253 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/inference/__init__.py +5 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/inference/openai_client.py +729 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/main.py +100 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/policy_routes.py +1114 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/registry.py +195 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/rollout.py +1891 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/storage/__init__.py +5 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/storage/volume.py +211 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/test_agents.py +161 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/test_service.py +137 -0
- examples/warming_up_to_rl/task_app/synth_envs_hosted/utils.py +129 -0
- examples/workflows/math_rl/configs/eval_base_qwen.toml +15 -0
- examples/workflows/math_rl/configs/eval_rl_qwen.toml +11 -0
- examples/workflows/math_rl/configs/rl_from_base_qwen.toml +62 -0
- examples/workflows/math_rl/configs/rl_from_base_qwen17.toml +80 -0
- examples/workflows/math_rl/configs/rl_from_ft_qwen.toml +35 -0
- examples/workflows/math_rl/download_dataset.py +80 -0
- examples/workflows/math_rl/run_eval.py +436 -0
- examples/workflows/math_rl/run_rl_and_save.py +111 -0
- synth_ai/__init__.py +47 -23
- synth_ai/_utils/__init__.py +47 -0
- synth_ai/_utils/base_url.py +10 -0
- synth_ai/_utils/http.py +10 -0
- synth_ai/_utils/prompts.py +10 -0
- synth_ai/_utils/task_app_state.py +12 -0
- synth_ai/_utils/user_config.py +10 -0
- synth_ai/api/models/supported.py +514 -0
- synth_ai/api/train/__init__.py +63 -0
- synth_ai/api/train/builders.py +473 -0
- synth_ai/api/train/cli.py +1185 -0
- synth_ai/api/train/config_finder.py +246 -0
- synth_ai/api/train/configs/__init__.py +65 -0
- synth_ai/api/train/configs/prompt_learning.py +496 -0
- synth_ai/api/train/configs/rl.py +188 -0
- synth_ai/api/train/configs/sft.py +99 -0
- synth_ai/api/train/configs/shared.py +81 -0
- synth_ai/api/train/env_resolver.py +352 -0
- synth_ai/api/train/pollers.py +91 -0
- synth_ai/api/train/prompt_learning.py +425 -0
- synth_ai/api/train/sft.py +390 -0
- synth_ai/api/train/supported_algos.py +147 -0
- synth_ai/api/train/task_app.py +195 -0
- synth_ai/api/train/utils.py +244 -0
- synth_ai/api/train/validators.py +1117 -0
- synth_ai/api/tunnel.py +49 -0
- synth_ai/auth/credentials.py +94 -0
- synth_ai/baseline/__init__.py +25 -0
- synth_ai/baseline/config.py +209 -0
- synth_ai/baseline/discovery.py +214 -0
- synth_ai/baseline/execution.py +146 -0
- synth_ai/cfgs.py +227 -0
- synth_ai/cli/__init__.py +90 -45
- synth_ai/cli/_modal_wrapper.py +31 -0
- synth_ai/cli/_storage.py +20 -0
- synth_ai/cli/_typer_patch.py +47 -0
- synth_ai/cli/_validate_task_app.py +29 -0
- synth_ai/cli/balance.py +16 -4
- synth_ai/cli/calc.py +36 -21
- synth_ai/cli/claude.py +70 -0
- synth_ai/cli/codex.py +267 -0
- synth_ai/cli/commands/__init__.py +18 -0
- synth_ai/cli/commands/baseline/__init__.py +12 -0
- synth_ai/cli/commands/baseline/core.py +637 -0
- synth_ai/cli/commands/baseline/list.py +93 -0
- synth_ai/cli/commands/demo/__init__.py +6 -0
- synth_ai/cli/commands/demo/core.py +163 -0
- synth_ai/cli/commands/eval/__init__.py +19 -0
- synth_ai/cli/commands/eval/core.py +1112 -0
- synth_ai/cli/commands/eval/errors.py +81 -0
- synth_ai/cli/commands/eval/validation.py +133 -0
- synth_ai/cli/commands/filter/__init__.py +12 -0
- synth_ai/cli/commands/filter/core.py +424 -0
- synth_ai/cli/commands/filter/errors.py +55 -0
- synth_ai/cli/commands/filter/validation.py +77 -0
- synth_ai/cli/commands/help/__init__.py +185 -0
- synth_ai/cli/commands/help/core.py +72 -0
- synth_ai/cli/commands/smoke/__init__.py +7 -0
- synth_ai/cli/commands/smoke/core.py +1437 -0
- synth_ai/cli/commands/status/__init__.py +66 -0
- synth_ai/cli/commands/status/client.py +192 -0
- synth_ai/cli/commands/status/config.py +92 -0
- synth_ai/cli/commands/status/errors.py +20 -0
- synth_ai/cli/commands/status/formatters.py +164 -0
- synth_ai/cli/commands/status/subcommands/__init__.py +9 -0
- synth_ai/cli/commands/status/subcommands/files.py +79 -0
- synth_ai/cli/commands/status/subcommands/jobs.py +334 -0
- synth_ai/cli/commands/status/subcommands/models.py +79 -0
- synth_ai/cli/commands/status/subcommands/pricing.py +22 -0
- synth_ai/cli/commands/status/subcommands/runs.py +81 -0
- synth_ai/cli/commands/status/subcommands/session.py +183 -0
- synth_ai/cli/commands/status/subcommands/summary.py +47 -0
- synth_ai/cli/commands/status/subcommands/usage.py +203 -0
- synth_ai/cli/commands/status/utils.py +114 -0
- synth_ai/cli/commands/train/__init__.py +53 -0
- synth_ai/cli/commands/train/core.py +21 -0
- synth_ai/cli/commands/train/errors.py +117 -0
- synth_ai/cli/commands/train/judge_schemas.py +200 -0
- synth_ai/cli/commands/train/judge_validation.py +305 -0
- synth_ai/cli/commands/train/validation.py +386 -0
- synth_ai/cli/demo.py +32 -140
- synth_ai/cli/deploy.py +233 -0
- synth_ai/cli/eval/__init__.py +36 -0
- synth_ai/cli/eval/core.py +5 -0
- synth_ai/cli/eval/errors.py +31 -0
- synth_ai/cli/eval/validation.py +5 -0
- synth_ai/cli/filter/__init__.py +28 -0
- synth_ai/cli/filter/core.py +5 -0
- synth_ai/cli/filter/errors.py +23 -0
- synth_ai/cli/filter/validation.py +5 -0
- synth_ai/cli/legacy_root_backup.py +28 -22
- synth_ai/cli/lib/__init__.py +10 -0
- synth_ai/cli/lib/task_app_discovery.py +7 -0
- synth_ai/cli/lib/task_app_env.py +518 -0
- synth_ai/cli/mcp.py +34 -0
- synth_ai/cli/modal_serve/__init__.py +12 -0
- synth_ai/cli/modal_serve/core.py +14 -0
- synth_ai/cli/modal_serve/errors.py +8 -0
- synth_ai/cli/modal_serve/validation.py +11 -0
- synth_ai/cli/opencode.py +256 -0
- synth_ai/cli/recent.py +13 -7
- synth_ai/cli/rl_demo.py +166 -114
- synth_ai/cli/root.py +143 -112
- synth_ai/cli/serve/__init__.py +12 -0
- synth_ai/cli/serve/core.py +14 -0
- synth_ai/cli/serve/errors.py +8 -0
- synth_ai/cli/serve/validation.py +11 -0
- synth_ai/cli/setup.py +49 -0
- synth_ai/cli/status.py +7 -125
- synth_ai/cli/task_app_deploy.py +7 -0
- synth_ai/cli/task_app_list.py +25 -0
- synth_ai/cli/task_app_modal_serve.py +11 -0
- synth_ai/cli/task_app_serve.py +11 -0
- synth_ai/cli/task_apps.py +3134 -0
- synth_ai/cli/traces.py +9 -5
- synth_ai/cli/train/__init__.py +12 -0
- synth_ai/cli/train/core.py +21 -0
- synth_ai/cli/train/errors.py +8 -0
- synth_ai/cli/train/validation.py +24 -0
- synth_ai/cli/train.py +5 -0
- synth_ai/cli/turso.py +73 -0
- synth_ai/cli/watch.py +13 -18
- synth_ai/demos/__init__.py +10 -0
- synth_ai/demos/core/__init__.py +28 -1
- synth_ai/demos/core/cli.py +745 -416
- synth_ai/demos/crafter/__init__.py +1 -0
- synth_ai/demos/crafter/crafter_fft_4b.toml +55 -0
- synth_ai/demos/crafter/grpo_crafter_task_app.py +185 -0
- synth_ai/demos/crafter/rl_from_base_qwen4b.toml +74 -0
- synth_ai/demos/demo_registry.py +176 -0
- synth_ai/demos/demo_task_apps/__init__.py +7 -1
- synth_ai/demos/demo_task_apps/core.py +75 -37
- synth_ai/demos/demo_task_apps/crafter/__init__.py +1 -0
- synth_ai/demos/demo_task_apps/crafter/configs/crafter_fft_4b.toml +53 -0
- synth_ai/demos/demo_task_apps/crafter/configs/rl_from_base_qwen4b.toml +73 -0
- synth_ai/demos/demo_task_apps/crafter/grpo_crafter_task_app.py +184 -0
- synth_ai/demos/demo_task_apps/math/_common.py +1 -2
- synth_ai/demos/demo_task_apps/math/app.py +2 -1
- synth_ai/demos/demo_task_apps/math/config.toml +55 -110
- synth_ai/demos/demo_task_apps/math/deploy_modal.py +3 -6
- synth_ai/demos/demo_task_apps/math/modal_task_app.py +491 -166
- synth_ai/demos/demo_task_apps/math/task_app_entry.py +37 -0
- synth_ai/demos/math/__init__.py +1 -0
- synth_ai/demos/math/_common.py +16 -0
- synth_ai/demos/math/app.py +38 -0
- synth_ai/demos/math/config.toml +76 -0
- synth_ai/demos/math/deploy_modal.py +54 -0
- synth_ai/demos/math/modal_task_app.py +703 -0
- synth_ai/demos/math/task_app_entry.py +51 -0
- synth_ai/environments/environment/core.py +7 -1
- synth_ai/environments/examples/bandit/engine.py +12 -5
- synth_ai/environments/examples/bandit/environment.py +0 -1
- synth_ai/environments/examples/bandit/taskset.py +4 -4
- synth_ai/environments/examples/crafter_classic/engine_deterministic_patch.py +7 -4
- synth_ai/environments/examples/crafter_classic/engine_serialization_patch_v3.py +9 -5
- synth_ai/environments/examples/crafter_classic/environment.py +93 -2
- synth_ai/environments/examples/crafter_classic/world_config_patch_simple.py +4 -3
- synth_ai/environments/examples/enron/engine.py +7 -2
- synth_ai/environments/examples/enron/environment.py +68 -0
- synth_ai/environments/examples/red/engine.py +60 -12
- synth_ai/environments/examples/red/engine_helpers/memory_map.py +7 -0
- synth_ai/environments/examples/red/engine_helpers/reward_components.py +151 -179
- synth_ai/environments/examples/red/engine_helpers/reward_library/pallet_town_progression.py +477 -0
- synth_ai/environments/examples/red/engine_helpers/state_extraction.py +32 -0
- synth_ai/environments/examples/red/environment.py +86 -0
- synth_ai/environments/examples/red/trace_hooks_v3.py +168 -0
- synth_ai/environments/examples/sokoban/taskset.py +116 -0
- synth_ai/environments/examples/verilog/engine.py +104 -12
- synth_ai/environments/examples/wordle/environment.py +0 -1
- synth_ai/environments/reproducibility/tree.py +5 -6
- synth_ai/environments/service/app.py +11 -12
- synth_ai/environments/service/core_routes.py +10 -9
- synth_ai/environments/stateful/engine.py +1 -1
- synth_ai/environments/tasks/core.py +1 -0
- synth_ai/environments/tasks/filters.py +5 -6
- synth_ai/environments/tasks/utils.py +4 -5
- synth_ai/evals/__init__.py +15 -0
- synth_ai/evals/base.py +14 -5
- synth_ai/evals/client.py +82 -0
- synth_ai/evals/types.py +42 -0
- synth_ai/http.py +8 -22
- synth_ai/http_client.py +45 -12
- synth_ai/inference/__init__.py +0 -2
- synth_ai/inference/client.py +21 -7
- synth_ai/jobs/client.py +129 -80
- synth_ai/judge_schemas.py +127 -0
- synth_ai/learning/__init__.py +51 -6
- synth_ai/learning/algorithms.py +14 -0
- synth_ai/learning/client.py +122 -30
- synth_ai/learning/config.py +2 -40
- synth_ai/learning/constants.py +0 -2
- synth_ai/learning/ft_client.py +4 -56
- synth_ai/learning/health.py +14 -8
- synth_ai/learning/jobs.py +43 -47
- synth_ai/learning/prompt_learning_client.py +276 -0
- synth_ai/learning/prompt_learning_types.py +185 -0
- synth_ai/{rl → learning/rl}/__init__.py +14 -5
- synth_ai/learning/rl/client.py +269 -0
- synth_ai/learning/rl/config.py +31 -0
- synth_ai/{rl → learning/rl}/contracts.py +5 -10
- synth_ai/{rl → learning/rl}/env_keys.py +45 -16
- synth_ai/learning/rl/secrets.py +13 -0
- synth_ai/learning/rl_client.py +2 -253
- synth_ai/learning/sft/__init__.py +29 -0
- synth_ai/learning/sft/client.py +68 -0
- synth_ai/learning/sft/config.py +270 -0
- synth_ai/learning/sft/data.py +698 -0
- synth_ai/learning/sse.py +25 -26
- synth_ai/learning/validators.py +29 -25
- synth_ai/mcp/__init__.py +5 -0
- synth_ai/mcp/__main__.py +8 -0
- synth_ai/mcp/main.py +254 -0
- synth_ai/mcp/setup.py +100 -0
- synth_ai/modal.py +257 -0
- synth_ai/pricing/__init__.py +3 -0
- synth_ai/pricing/model_pricing.py +64 -0
- synth_ai/session/__init__.py +75 -0
- synth_ai/session/client.py +383 -0
- synth_ai/session/constants.py +63 -0
- synth_ai/session/exceptions.py +105 -0
- synth_ai/session/manager.py +139 -0
- synth_ai/session/models.py +89 -0
- synth_ai/session/query.py +110 -0
- synth_ai/spec/__init__.py +46 -0
- synth_ai/spec/dataclasses.py +149 -0
- synth_ai/spec/loader.py +144 -0
- synth_ai/spec/serializer.py +199 -0
- synth_ai/spec/validation.py +250 -0
- synth_ai/streaming/__init__.py +29 -0
- synth_ai/streaming/config.py +94 -0
- synth_ai/streaming/handlers.py +589 -0
- synth_ai/streaming/streamer.py +320 -0
- synth_ai/streaming/types.py +95 -0
- synth_ai/task/__init__.py +116 -3
- synth_ai/task/apps/__init__.py +132 -0
- synth_ai/task/auth.py +165 -0
- synth_ai/task/client.py +167 -0
- synth_ai/task/config.py +261 -0
- synth_ai/task/contracts.py +173 -57
- synth_ai/task/datasets.py +108 -0
- synth_ai/task/errors.py +50 -0
- synth_ai/task/health.py +17 -11
- synth_ai/task/inference_api.py +101 -0
- synth_ai/task/json.py +111 -0
- synth_ai/task/proxy.py +251 -0
- synth_ai/task/rubrics/__init__.py +55 -0
- synth_ai/task/rubrics/loaders.py +156 -0
- synth_ai/task/rubrics/models.py +57 -0
- synth_ai/task/rubrics/scoring.py +116 -0
- synth_ai/task/rubrics/strict.py +149 -0
- synth_ai/task/rubrics.py +219 -0
- synth_ai/task/server.py +432 -0
- synth_ai/task/trace_correlation_helpers.py +328 -0
- synth_ai/task/tracing_utils.py +95 -0
- synth_ai/task/validators.py +449 -6
- synth_ai/task/vendors.py +59 -0
- synth_ai/tracing_v3/__init__.py +4 -0
- synth_ai/tracing_v3/abstractions.py +21 -4
- synth_ai/tracing_v3/config.py +167 -22
- synth_ai/tracing_v3/constants.py +21 -0
- synth_ai/tracing_v3/db_config.py +42 -29
- synth_ai/tracing_v3/decorators.py +80 -45
- synth_ai/tracing_v3/examples/basic_usage.py +15 -9
- synth_ai/tracing_v3/hooks.py +6 -4
- synth_ai/tracing_v3/llm_call_record_helpers.py +161 -61
- synth_ai/tracing_v3/migration_helper.py +1 -2
- synth_ai/tracing_v3/replica_sync.py +12 -7
- synth_ai/tracing_v3/serialization.py +130 -0
- synth_ai/tracing_v3/session_tracer.py +86 -21
- synth_ai/tracing_v3/storage/base.py +98 -12
- synth_ai/tracing_v3/storage/config.py +63 -16
- synth_ai/tracing_v3/storage/factory.py +11 -9
- synth_ai/tracing_v3/storage/utils.py +15 -11
- synth_ai/tracing_v3/trace_utils.py +317 -0
- synth_ai/tracing_v3/turso/__init__.py +8 -21
- synth_ai/tracing_v3/turso/daemon.py +123 -15
- synth_ai/tracing_v3/turso/models.py +5 -2
- synth_ai/tracing_v3/turso/native_manager.py +1293 -0
- synth_ai/tracing_v3/utils.py +5 -4
- synth_ai/tunnel.py +143 -0
- synth_ai/tunnel_deploy.py +278 -0
- synth_ai/types.py +8 -0
- synth_ai/urls.py +11 -0
- synth_ai/utils/__init__.py +166 -0
- synth_ai/utils/agents.py +74 -0
- synth_ai/utils/apps.py +152 -0
- synth_ai/utils/base_url.py +94 -0
- synth_ai/utils/bin.py +39 -0
- synth_ai/utils/claude.py +36 -0
- synth_ai/utils/cli.py +284 -0
- synth_ai/utils/config.py +81 -0
- synth_ai/utils/env.py +346 -0
- synth_ai/utils/errors.py +85 -0
- synth_ai/utils/http.py +172 -0
- synth_ai/utils/json.py +72 -0
- synth_ai/utils/log_filter.py +99 -0
- synth_ai/utils/logging.py +198 -0
- synth_ai/utils/modal.py +299 -0
- synth_ai/utils/paths.py +95 -0
- synth_ai/utils/process.py +233 -0
- synth_ai/utils/prompts.py +39 -0
- synth_ai/utils/sqld.py +122 -0
- synth_ai/utils/ssl.py +25 -0
- synth_ai/utils/task_app_discovery.py +882 -0
- synth_ai/utils/task_app_env.py +186 -0
- synth_ai/utils/task_app_state.py +318 -0
- synth_ai/utils/tunnel/__init__.py +12 -0
- synth_ai/utils/tunnel/config.py +55 -0
- synth_ai/utils/user_config.py +137 -0
- synth_ai/uvicorn.py +77 -0
- synth_ai-0.2.23.dev3.dist-info/METADATA +357 -0
- synth_ai-0.2.23.dev3.dist-info/RECORD +983 -0
- {synth_ai-0.2.8.dev4.dist-info → synth_ai-0.2.23.dev3.dist-info}/entry_points.txt +0 -1
- {synth_ai-0.2.8.dev4.dist-info → synth_ai-0.2.23.dev3.dist-info}/top_level.txt +1 -0
- synth_ai/cli/man.py +0 -106
- synth_ai/core/experiment.py +0 -15
- synth_ai/core/system.py +0 -15
- synth_ai/environments/examples/sokoban/units/astar_common.py +0 -95
- synth_ai/experimental/synth_oss.py +0 -446
- synth_ai/handshake.py +0 -63
- synth_ai/install_sqld.sh +0 -40
- synth_ai/learning/offline/dpo.py +0 -0
- synth_ai/learning/offline/providers.py +0 -7
- synth_ai/learning/offline/sft.py +0 -0
- synth_ai/learning/offline/shared.py +0 -0
- synth_ai/learning/online/grpo.py +0 -0
- synth_ai/learning/online/irft.py +0 -0
- synth_ai/learning/prompts/banking77_injection_eval.py +0 -168
- synth_ai/learning/prompts/gepa.py +0 -0
- synth_ai/learning/prompts/hello_world_in_context_injection_ex.py +0 -213
- synth_ai/learning/prompts/mipro.py +0 -289
- synth_ai/learning/prompts/random_search.py +0 -246
- synth_ai/learning/prompts/run_mipro_banking77.py +0 -172
- synth_ai/learning/prompts/run_random_search_banking77.py +0 -324
- synth_ai/lm/__init__.py +0 -51
- synth_ai/lm/caching/constants.py +0 -6
- synth_ai/lm/caching/dbs.py +0 -0
- synth_ai/lm/caching/ephemeral.py +0 -102
- synth_ai/lm/caching/handler.py +0 -137
- synth_ai/lm/caching/initialize.py +0 -11
- synth_ai/lm/caching/persistent.py +0 -114
- synth_ai/lm/config.py +0 -110
- synth_ai/lm/constants.py +0 -32
- synth_ai/lm/core/__init__.py +0 -8
- synth_ai/lm/core/all.py +0 -73
- synth_ai/lm/core/exceptions.py +0 -7
- synth_ai/lm/core/main.py +0 -319
- synth_ai/lm/core/main_v3.py +0 -594
- synth_ai/lm/core/synth_models.py +0 -48
- synth_ai/lm/core/vendor_clients.py +0 -188
- synth_ai/lm/cost/monitor.py +0 -1
- synth_ai/lm/cost/statefulness.py +0 -1
- synth_ai/lm/injection.py +0 -80
- synth_ai/lm/overrides.py +0 -206
- synth_ai/lm/provider_support/__init__.py +0 -8
- synth_ai/lm/provider_support/anthropic.py +0 -972
- synth_ai/lm/provider_support/openai.py +0 -1139
- synth_ai/lm/provider_support/suppress_logging.py +0 -31
- synth_ai/lm/structured_outputs/handler.py +0 -440
- synth_ai/lm/structured_outputs/inject.py +0 -297
- synth_ai/lm/structured_outputs/rehabilitate.py +0 -185
- synth_ai/lm/tools/__init__.py +0 -3
- synth_ai/lm/tools/base.py +0 -172
- synth_ai/lm/unified_interface.py +0 -202
- synth_ai/lm/vendors/base.py +0 -81
- synth_ai/lm/vendors/core/anthropic_api.py +0 -387
- synth_ai/lm/vendors/core/gemini_api.py +0 -292
- synth_ai/lm/vendors/core/mistral_api.py +0 -322
- synth_ai/lm/vendors/core/openai_api.py +0 -225
- synth_ai/lm/vendors/core/synth_dev_api.py +0 -0
- synth_ai/lm/vendors/local/ollama.py +0 -0
- synth_ai/lm/vendors/openai_standard.py +0 -780
- synth_ai/lm/vendors/openai_standard_responses.py +0 -256
- synth_ai/lm/vendors/retries.py +0 -22
- synth_ai/lm/vendors/supported/custom_endpoint.py +0 -417
- synth_ai/lm/vendors/supported/deepseek.py +0 -69
- synth_ai/lm/vendors/supported/grok.py +0 -75
- synth_ai/lm/vendors/supported/groq.py +0 -16
- synth_ai/lm/vendors/supported/ollama.py +0 -15
- synth_ai/lm/vendors/supported/openrouter.py +0 -74
- synth_ai/lm/vendors/supported/together.py +0 -11
- synth_ai/lm/vendors/synth_client.py +0 -808
- synth_ai/lm/warmup.py +0 -186
- synth_ai/rl/secrets.py +0 -19
- synth_ai/scripts/verify_rewards.py +0 -100
- synth_ai/tracing/__init__.py +0 -30
- synth_ai/tracing_v1/__init__.py +0 -33
- synth_ai/tracing_v3/turso/manager.py +0 -760
- synth_ai/v0/tracing/abstractions.py +0 -224
- synth_ai/v0/tracing/base_client.py +0 -91
- synth_ai/v0/tracing/client_manager.py +0 -131
- synth_ai/v0/tracing/config.py +0 -142
- synth_ai/v0/tracing/context.py +0 -146
- synth_ai/v0/tracing/decorators.py +0 -682
- synth_ai/v0/tracing/events/__init__.py +0 -0
- synth_ai/v0/tracing/events/manage.py +0 -147
- synth_ai/v0/tracing/events/scope.py +0 -86
- synth_ai/v0/tracing/events/store.py +0 -228
- synth_ai/v0/tracing/immediate_client.py +0 -151
- synth_ai/v0/tracing/local.py +0 -18
- synth_ai/v0/tracing/log_client_base.py +0 -73
- synth_ai/v0/tracing/retry_queue.py +0 -186
- synth_ai/v0/tracing/trackers.py +0 -515
- synth_ai/v0/tracing/upload.py +0 -512
- synth_ai/v0/tracing/utils.py +0 -9
- synth_ai/v0/tracing_v1/__init__.py +0 -16
- synth_ai/v0/tracing_v1/abstractions.py +0 -224
- synth_ai/v0/tracing_v1/base_client.py +0 -91
- synth_ai/v0/tracing_v1/client_manager.py +0 -131
- synth_ai/v0/tracing_v1/config.py +0 -142
- synth_ai/v0/tracing_v1/context.py +0 -146
- synth_ai/v0/tracing_v1/decorators.py +0 -703
- synth_ai/v0/tracing_v1/events/__init__.py +0 -0
- synth_ai/v0/tracing_v1/events/manage.py +0 -147
- synth_ai/v0/tracing_v1/events/scope.py +0 -86
- synth_ai/v0/tracing_v1/events/store.py +0 -228
- synth_ai/v0/tracing_v1/immediate_client.py +0 -151
- synth_ai/v0/tracing_v1/local.py +0 -18
- synth_ai/v0/tracing_v1/log_client_base.py +0 -73
- synth_ai/v0/tracing_v1/retry_queue.py +0 -186
- synth_ai/v0/tracing_v1/trackers.py +0 -515
- synth_ai/v0/tracing_v1/upload.py +0 -527
- synth_ai/v0/tracing_v1/utils.py +0 -9
- synth_ai/zyk/__init__.py +0 -30
- synth_ai-0.2.8.dev4.dist-info/METADATA +0 -129
- synth_ai-0.2.8.dev4.dist-info/RECORD +0 -420
- {synth_ai/lm/caching → examples/task_apps}/__init__.py +0 -0
- {synth_ai/lm/cost → examples/task_apps/crafter}/__init__.py +0 -0
- {synth_ai/lm/structured_outputs → examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server}/__init__.py +0 -0
- {synth_ai/lm/vendors → examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests}/__init__.py +0 -0
- {synth_ai/lm/vendors/core → examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils}/__init__.py +0 -0
- {synth_ai/lm/vendors/local → examples/task_apps/math}/__init__.py +0 -0
- {synth_ai/lm/vendors/supported → examples/workflows}/__init__.py +0 -0
- {synth_ai/v0/tracing → examples/workflows/math_rl}/__init__.py +0 -0
- /synth_ai/{compound/cais.py → cli/__main__.py} +0 -0
- /synth_ai/{learning/filtering.py → py.typed} +0 -0
- {synth_ai-0.2.8.dev4.dist-info → synth_ai-0.2.23.dev3.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.8.dev4.dist-info → synth_ai-0.2.23.dev3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
"""CLI command for baseline evaluation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import json
|
|
7
|
+
import time
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any, Optional, Sequence
|
|
11
|
+
|
|
12
|
+
import click
|
|
13
|
+
from synth_ai.baseline.config import BaselineResults
|
|
14
|
+
from synth_ai.baseline.discovery import (
|
|
15
|
+
BASELINE_FILE_PATTERNS,
|
|
16
|
+
BaselineChoice,
|
|
17
|
+
discover_baseline_files,
|
|
18
|
+
load_baseline_config_from_file,
|
|
19
|
+
)
|
|
20
|
+
from synth_ai.baseline.execution import aggregate_results, run_baseline_evaluation
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BaselineGroup(click.Group):
|
|
24
|
+
"""Custom group that allows positional arguments (baseline_id) even when subcommands exist."""
|
|
25
|
+
|
|
26
|
+
def make_context(
|
|
27
|
+
self,
|
|
28
|
+
info_name: str | None,
|
|
29
|
+
args: list[str],
|
|
30
|
+
parent: click.Context | None = None,
|
|
31
|
+
**extra,
|
|
32
|
+
) -> click.Context:
|
|
33
|
+
"""Override make_context to store original args before Click parses them."""
|
|
34
|
+
# Store original args in the context's meta
|
|
35
|
+
ctx = super().make_context(info_name, args, parent, **extra)
|
|
36
|
+
ctx.meta['_original_args'] = args.copy() if isinstance(args, list) else list(args)
|
|
37
|
+
return ctx
|
|
38
|
+
|
|
39
|
+
def resolve_command(self, ctx: click.Context, args: list[str]) -> tuple[click.Command | None, str, list[str]]:
|
|
40
|
+
"""Resolve command, checking if first arg is a subcommand or baseline_id."""
|
|
41
|
+
|
|
42
|
+
# Check if first arg is a known subcommand
|
|
43
|
+
if args and not args[0].startswith('--'):
|
|
44
|
+
first_arg = args[0]
|
|
45
|
+
if first_arg in self.commands:
|
|
46
|
+
# It's a known subcommand, let Click handle it normally
|
|
47
|
+
cmd_name, cmd, remaining = super().resolve_command(ctx, args)
|
|
48
|
+
# Click returns (name, cmd, args) but type checker expects (cmd, name, args)
|
|
49
|
+
return cmd, cmd_name or "", remaining
|
|
50
|
+
|
|
51
|
+
# Not a subcommand - this means baseline_id is a positional argument
|
|
52
|
+
# Store baseline_id in ctx for the callback to access
|
|
53
|
+
if args and not args[0].startswith('--'):
|
|
54
|
+
baseline_id = args[0]
|
|
55
|
+
ctx.meta['baseline_id'] = baseline_id
|
|
56
|
+
# Remove baseline_id from args so Click doesn't try to parse it
|
|
57
|
+
remaining_args = args[1:]
|
|
58
|
+
|
|
59
|
+
# Create a wrapper function that injects baseline_id into the callback
|
|
60
|
+
original_callback = self.callback
|
|
61
|
+
if original_callback is None:
|
|
62
|
+
raise click.ClickException("Command callback is None")
|
|
63
|
+
def wrapper_callback(ctx, **kwargs):
|
|
64
|
+
# Inject baseline_id into kwargs
|
|
65
|
+
kwargs['baseline_id'] = baseline_id
|
|
66
|
+
return original_callback(ctx, **kwargs)
|
|
67
|
+
|
|
68
|
+
# Create a wrapper command with the modified callback
|
|
69
|
+
# Filter out baseline_id from params since we're injecting it manually
|
|
70
|
+
filtered_params = [p for p in self.params if getattr(p, 'name', None) != 'baseline_id']
|
|
71
|
+
wrapper_cmd = click.Command(
|
|
72
|
+
name="_baseline_wrapper", # Use a different name to avoid confusion
|
|
73
|
+
callback=wrapper_callback,
|
|
74
|
+
params=filtered_params,
|
|
75
|
+
context_settings=self.context_settings,
|
|
76
|
+
)
|
|
77
|
+
return wrapper_cmd, "_baseline_wrapper", remaining_args
|
|
78
|
+
|
|
79
|
+
# No args or args start with --, so no baseline_id
|
|
80
|
+
# Let Click handle it normally (will invoke main callback if invoke_without_command=True)
|
|
81
|
+
cmd_name, cmd, remaining = super().resolve_command(ctx, args)
|
|
82
|
+
# Click returns (name, cmd, args) but type checker expects (cmd, name, args)
|
|
83
|
+
return cmd, cmd_name or "", remaining
|
|
84
|
+
|
|
85
|
+
def invoke(self, ctx: click.Context) -> Any:
|
|
86
|
+
"""Invoke command, handling baseline_id as positional arg."""
|
|
87
|
+
# Check if baseline_id is in ctx.params (Click might have parsed it)
|
|
88
|
+
if 'baseline_id' in ctx.params and ctx.params['baseline_id']:
|
|
89
|
+
baseline_id = ctx.params['baseline_id']
|
|
90
|
+
# Invoke callback with baseline_id from params
|
|
91
|
+
if self.callback is None:
|
|
92
|
+
raise click.ClickException("Command callback is None")
|
|
93
|
+
return self.callback(ctx, **ctx.params)
|
|
94
|
+
|
|
95
|
+
# Manually call resolve_command with full args (including baseline_id if present)
|
|
96
|
+
# Try to get the original args from ctx.meta (stored in make_context())
|
|
97
|
+
full_args = ctx.meta.get('_original_args', ctx.args)
|
|
98
|
+
|
|
99
|
+
# If no args, invoke callback directly (invoke_without_command=True behavior)
|
|
100
|
+
if not full_args:
|
|
101
|
+
if self.callback is None:
|
|
102
|
+
raise click.ClickException("Command callback is None")
|
|
103
|
+
return ctx.invoke(self.callback, **ctx.params)
|
|
104
|
+
|
|
105
|
+
cmd, cmd_name, resolved_args = self.resolve_command(ctx, full_args)
|
|
106
|
+
|
|
107
|
+
# Check if baseline_id was detected
|
|
108
|
+
if 'baseline_id' in ctx.meta:
|
|
109
|
+
baseline_id = ctx.meta['baseline_id']
|
|
110
|
+
# Parse options from resolved_args - don't use OptionParser, just use Click's make_context
|
|
111
|
+
# Create a temporary context to parse the options
|
|
112
|
+
temp_ctx = self.make_context(self.name, resolved_args, parent=ctx.parent, allow_extra_args=True, allow_interspersed_args=False)
|
|
113
|
+
params = temp_ctx.params.copy()
|
|
114
|
+
params['baseline_id'] = baseline_id
|
|
115
|
+
# Don't pass ctx explicitly - Click's @click.pass_context decorator injects it
|
|
116
|
+
# Use ctx.invoke to properly call the callback with the right context
|
|
117
|
+
if self.callback is None:
|
|
118
|
+
raise click.ClickException("Command callback is None")
|
|
119
|
+
return ctx.invoke(self.callback, **params)
|
|
120
|
+
|
|
121
|
+
# Normal flow - if it's a subcommand, invoke it
|
|
122
|
+
if cmd and cmd is not self and isinstance(cmd, click.Command):
|
|
123
|
+
with cmd.make_context(cmd_name, resolved_args, parent=ctx) as sub_ctx:
|
|
124
|
+
return cmd.invoke(sub_ctx)
|
|
125
|
+
|
|
126
|
+
# No baseline_id and no subcommand - invoke callback if invoke_without_command=True
|
|
127
|
+
if self.callback is None:
|
|
128
|
+
raise click.ClickException("Command callback is None")
|
|
129
|
+
return self.callback(ctx)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
__all__ = ["command"]
|
|
133
|
+
|
|
134
|
+
def _select_baseline_interactive(choices: list[BaselineChoice]) -> Optional[str]:
|
|
135
|
+
"""Prompt user to select a baseline interactively."""
|
|
136
|
+
if not choices:
|
|
137
|
+
return None
|
|
138
|
+
|
|
139
|
+
if len(choices) == 1:
|
|
140
|
+
return choices[0].baseline_id
|
|
141
|
+
|
|
142
|
+
click.echo("\nFound multiple baseline files:")
|
|
143
|
+
for i, choice in enumerate(choices, 1):
|
|
144
|
+
click.echo(f" {i}. {choice.baseline_id} ({choice.path})")
|
|
145
|
+
|
|
146
|
+
while True:
|
|
147
|
+
try:
|
|
148
|
+
selection = click.prompt("Select baseline", type=int)
|
|
149
|
+
if 1 <= selection <= len(choices):
|
|
150
|
+
return choices[selection - 1].baseline_id
|
|
151
|
+
click.echo(f"Please enter a number between 1 and {len(choices)}")
|
|
152
|
+
except (click.Abort, KeyboardInterrupt):
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
def _parse_seeds(seeds_str: Optional[str]) -> Optional[list[int]]:
|
|
156
|
+
"""Parse comma-separated seeds string."""
|
|
157
|
+
if not seeds_str:
|
|
158
|
+
return None
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
return [int(s.strip()) for s in seeds_str.split(",") if s.strip()]
|
|
162
|
+
except ValueError as e:
|
|
163
|
+
raise click.ClickException(f"Invalid seeds format: {seeds_str}. Expected comma-separated integers.") from e
|
|
164
|
+
|
|
165
|
+
def _parse_splits(splits_str: str) -> list[str]:
|
|
166
|
+
"""Parse comma-separated splits string."""
|
|
167
|
+
return [s.strip() for s in splits_str.split(",") if s.strip()]
|
|
168
|
+
|
|
169
|
+
@click.group(
|
|
170
|
+
"baseline",
|
|
171
|
+
help="Run self-contained task evaluation using a baseline file.",
|
|
172
|
+
invoke_without_command=True,
|
|
173
|
+
cls=BaselineGroup,
|
|
174
|
+
)
|
|
175
|
+
@click.pass_context
|
|
176
|
+
# DON'T define baseline_id as an argument here - it will be consumed before resolve_command()
|
|
177
|
+
# @click.argument("baseline_id", type=str, required=False)
|
|
178
|
+
@click.option(
|
|
179
|
+
"--split",
|
|
180
|
+
default="train",
|
|
181
|
+
help="Data split(s) to evaluate (comma-separated). Default: train",
|
|
182
|
+
)
|
|
183
|
+
@click.option(
|
|
184
|
+
"--seeds",
|
|
185
|
+
default=None,
|
|
186
|
+
help="Comma-separated seeds to evaluate (overrides split defaults)",
|
|
187
|
+
)
|
|
188
|
+
@click.option(
|
|
189
|
+
"--model",
|
|
190
|
+
default=None,
|
|
191
|
+
help="Model identifier (overrides default_policy_config)",
|
|
192
|
+
)
|
|
193
|
+
@click.option(
|
|
194
|
+
"--temperature",
|
|
195
|
+
type=float,
|
|
196
|
+
default=None,
|
|
197
|
+
help="Sampling temperature (overrides default_policy_config)",
|
|
198
|
+
)
|
|
199
|
+
@click.option(
|
|
200
|
+
"--policy-config",
|
|
201
|
+
type=str,
|
|
202
|
+
default=None,
|
|
203
|
+
help="JSON string with policy config overrides",
|
|
204
|
+
)
|
|
205
|
+
@click.option(
|
|
206
|
+
"--env-config",
|
|
207
|
+
type=str,
|
|
208
|
+
default=None,
|
|
209
|
+
help="JSON string with env config overrides",
|
|
210
|
+
)
|
|
211
|
+
@click.option(
|
|
212
|
+
"--output",
|
|
213
|
+
type=click.Path(),
|
|
214
|
+
default=None,
|
|
215
|
+
help="Save results to JSON file",
|
|
216
|
+
)
|
|
217
|
+
@click.option(
|
|
218
|
+
"--trace-db",
|
|
219
|
+
default=None,
|
|
220
|
+
help="SQLite/Turso URL for storing traces (set to 'none' to disable)",
|
|
221
|
+
)
|
|
222
|
+
@click.option(
|
|
223
|
+
"--concurrency",
|
|
224
|
+
type=int,
|
|
225
|
+
default=4,
|
|
226
|
+
help="Maximum concurrent task executions",
|
|
227
|
+
)
|
|
228
|
+
@click.option(
|
|
229
|
+
"--env-file",
|
|
230
|
+
multiple=True,
|
|
231
|
+
type=click.Path(),
|
|
232
|
+
help="Environment file(s) to load (for API keys, etc.)",
|
|
233
|
+
)
|
|
234
|
+
@click.option(
|
|
235
|
+
"--verbose",
|
|
236
|
+
is_flag=True,
|
|
237
|
+
help="Enable verbose output",
|
|
238
|
+
)
|
|
239
|
+
def command(
|
|
240
|
+
ctx: click.Context,
|
|
241
|
+
baseline_id: str | None = None,
|
|
242
|
+
split: str = "train",
|
|
243
|
+
seeds: str | None = None,
|
|
244
|
+
model: str | None = None,
|
|
245
|
+
temperature: float | None = None,
|
|
246
|
+
policy_config: str | None = None,
|
|
247
|
+
env_config: str | None = None,
|
|
248
|
+
output: str | None = None,
|
|
249
|
+
trace_db: str | None = None,
|
|
250
|
+
concurrency: int = 4,
|
|
251
|
+
env_file: Sequence[str] = (),
|
|
252
|
+
verbose: bool = False,
|
|
253
|
+
) -> None:
|
|
254
|
+
"""Run baseline evaluation."""
|
|
255
|
+
# If a subcommand was invoked, don't run the default command
|
|
256
|
+
if ctx.invoked_subcommand is not None:
|
|
257
|
+
return
|
|
258
|
+
|
|
259
|
+
# Check if baseline_id is actually a subcommand (shouldn't happen, but handle gracefully)
|
|
260
|
+
if baseline_id and isinstance(ctx.command, click.Group) and baseline_id in ctx.command.commands:
|
|
261
|
+
# It's a subcommand, re-invoke with that subcommand
|
|
262
|
+
subcmd = ctx.command.get_command(ctx, baseline_id)
|
|
263
|
+
if subcmd:
|
|
264
|
+
return ctx.invoke(subcmd, **ctx.params)
|
|
265
|
+
|
|
266
|
+
# baseline_id should be parsed by Click as a positional argument
|
|
267
|
+
# No need to extract from meta since resolve_command returns None for non-subcommands
|
|
268
|
+
|
|
269
|
+
# Run the evaluation
|
|
270
|
+
asyncio.run(
|
|
271
|
+
_baseline_command_impl(
|
|
272
|
+
baseline_id=baseline_id,
|
|
273
|
+
split=split,
|
|
274
|
+
seeds=seeds,
|
|
275
|
+
model=model,
|
|
276
|
+
temperature=temperature,
|
|
277
|
+
policy_config_json=policy_config,
|
|
278
|
+
env_config_json=env_config,
|
|
279
|
+
output_path=Path(output) if output else None,
|
|
280
|
+
trace_db_url=trace_db,
|
|
281
|
+
concurrency=concurrency,
|
|
282
|
+
env_files=env_file,
|
|
283
|
+
verbose=verbose,
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
@command.command("run")
|
|
288
|
+
@click.argument("baseline_id", type=str, required=False)
|
|
289
|
+
@click.option(
|
|
290
|
+
"--split",
|
|
291
|
+
default="train",
|
|
292
|
+
help="Data split(s) to evaluate (comma-separated). Default: train",
|
|
293
|
+
)
|
|
294
|
+
@click.option(
|
|
295
|
+
"--seeds",
|
|
296
|
+
default=None,
|
|
297
|
+
help="Comma-separated seeds to evaluate (overrides split defaults)",
|
|
298
|
+
)
|
|
299
|
+
@click.option(
|
|
300
|
+
"--model",
|
|
301
|
+
default=None,
|
|
302
|
+
help="Model identifier (overrides default_policy_config)",
|
|
303
|
+
)
|
|
304
|
+
@click.option(
|
|
305
|
+
"--temperature",
|
|
306
|
+
type=float,
|
|
307
|
+
default=None,
|
|
308
|
+
help="Sampling temperature (overrides default_policy_config)",
|
|
309
|
+
)
|
|
310
|
+
@click.option(
|
|
311
|
+
"--policy-config",
|
|
312
|
+
type=str,
|
|
313
|
+
default=None,
|
|
314
|
+
help="JSON string with policy config overrides",
|
|
315
|
+
)
|
|
316
|
+
@click.option(
|
|
317
|
+
"--env-config",
|
|
318
|
+
type=str,
|
|
319
|
+
default=None,
|
|
320
|
+
help="JSON string with env config overrides",
|
|
321
|
+
)
|
|
322
|
+
@click.option(
|
|
323
|
+
"--output",
|
|
324
|
+
type=click.Path(),
|
|
325
|
+
default=None,
|
|
326
|
+
help="Save results to JSON file",
|
|
327
|
+
)
|
|
328
|
+
@click.option(
|
|
329
|
+
"--trace-db",
|
|
330
|
+
default=None,
|
|
331
|
+
help="SQLite/Turso URL for storing traces (set to 'none' to disable)",
|
|
332
|
+
)
|
|
333
|
+
@click.option(
|
|
334
|
+
"--concurrency",
|
|
335
|
+
type=int,
|
|
336
|
+
default=4,
|
|
337
|
+
help="Maximum concurrent task executions",
|
|
338
|
+
)
|
|
339
|
+
@click.option(
|
|
340
|
+
"--env-file",
|
|
341
|
+
multiple=True,
|
|
342
|
+
type=click.Path(),
|
|
343
|
+
help="Environment file(s) to load (for API keys, etc.)",
|
|
344
|
+
)
|
|
345
|
+
@click.option(
|
|
346
|
+
"--verbose",
|
|
347
|
+
is_flag=True,
|
|
348
|
+
help="Enable verbose output",
|
|
349
|
+
)
|
|
350
|
+
def run_command(
|
|
351
|
+
baseline_id: str | None,
|
|
352
|
+
split: str,
|
|
353
|
+
seeds: str | None,
|
|
354
|
+
model: str | None,
|
|
355
|
+
temperature: float | None,
|
|
356
|
+
policy_config: str | None,
|
|
357
|
+
env_config: str | None,
|
|
358
|
+
output: str | None,
|
|
359
|
+
trace_db: str | None,
|
|
360
|
+
concurrency: int,
|
|
361
|
+
env_file: Sequence[str],
|
|
362
|
+
verbose: bool,
|
|
363
|
+
) -> None:
|
|
364
|
+
"""Run baseline evaluation."""
|
|
365
|
+
asyncio.run(
|
|
366
|
+
_baseline_command_impl(
|
|
367
|
+
baseline_id=baseline_id,
|
|
368
|
+
split=split,
|
|
369
|
+
seeds=seeds,
|
|
370
|
+
model=model,
|
|
371
|
+
temperature=temperature,
|
|
372
|
+
policy_config_json=policy_config,
|
|
373
|
+
env_config_json=env_config,
|
|
374
|
+
output_path=Path(output) if output else None,
|
|
375
|
+
trace_db_url=trace_db,
|
|
376
|
+
concurrency=concurrency,
|
|
377
|
+
env_files=env_file,
|
|
378
|
+
verbose=verbose,
|
|
379
|
+
)
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
async def _baseline_command_impl(
|
|
383
|
+
baseline_id: str | None,
|
|
384
|
+
split: str,
|
|
385
|
+
seeds: str | None,
|
|
386
|
+
model: str | None,
|
|
387
|
+
temperature: float | None,
|
|
388
|
+
policy_config_json: str | None,
|
|
389
|
+
env_config_json: str | None,
|
|
390
|
+
output_path: Path | None,
|
|
391
|
+
trace_db_url: str | None,
|
|
392
|
+
concurrency: int,
|
|
393
|
+
env_files: Sequence[str],
|
|
394
|
+
verbose: bool,
|
|
395
|
+
) -> None:
|
|
396
|
+
"""Implementation of baseline command."""
|
|
397
|
+
|
|
398
|
+
# Load environment files if provided
|
|
399
|
+
if env_files:
|
|
400
|
+
try:
|
|
401
|
+
from dotenv import load_dotenv
|
|
402
|
+
for env_file in env_files:
|
|
403
|
+
load_dotenv(env_file, override=False)
|
|
404
|
+
except ImportError:
|
|
405
|
+
click.echo("Warning: python-dotenv not installed, skipping --env-file", err=True)
|
|
406
|
+
|
|
407
|
+
# 1. Discovery
|
|
408
|
+
search_roots = [Path.cwd()]
|
|
409
|
+
choices = discover_baseline_files(search_roots)
|
|
410
|
+
|
|
411
|
+
if not choices:
|
|
412
|
+
search_dirs = [str(root) for root in search_roots]
|
|
413
|
+
raise click.ClickException(
|
|
414
|
+
f"❌ No baseline files found\n"
|
|
415
|
+
f" Searched in: {', '.join(search_dirs)}\n"
|
|
416
|
+
f" Patterns: {', '.join(BASELINE_FILE_PATTERNS)}\n"
|
|
417
|
+
f" Create baseline files in:\n"
|
|
418
|
+
f" - examples/baseline/*.py\n"
|
|
419
|
+
f" - **/*_baseline.py (anywhere in the tree)\n"
|
|
420
|
+
f" Example: Create examples/baseline/my_task_baseline.py\n"
|
|
421
|
+
f" See: https://docs.usesynth.ai/baseline for more info"
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
if baseline_id is None:
|
|
425
|
+
selected_id = _select_baseline_interactive(choices)
|
|
426
|
+
if selected_id is None:
|
|
427
|
+
raise click.ClickException(
|
|
428
|
+
"❌ No baseline selected\n"
|
|
429
|
+
" Run with a baseline ID: synth-ai baseline <baseline_id>\n"
|
|
430
|
+
" Or use: synth-ai baseline list to see available baselines"
|
|
431
|
+
)
|
|
432
|
+
baseline_id = selected_id
|
|
433
|
+
|
|
434
|
+
# Find matching baseline
|
|
435
|
+
matching = [c for c in choices if c.baseline_id == baseline_id]
|
|
436
|
+
if not matching:
|
|
437
|
+
available = sorted({c.baseline_id for c in choices})
|
|
438
|
+
# Find close matches (fuzzy matching)
|
|
439
|
+
close_matches = [
|
|
440
|
+
bid for bid in available
|
|
441
|
+
if baseline_id.lower() in bid.lower() or bid.lower() in baseline_id.lower()
|
|
442
|
+
]
|
|
443
|
+
|
|
444
|
+
error_msg = (
|
|
445
|
+
f"❌ Baseline '{baseline_id}' not found\n"
|
|
446
|
+
f" Available baselines ({len(available)}): {', '.join(available)}"
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
if close_matches:
|
|
450
|
+
error_msg += f"\n Did you mean: {', '.join(close_matches[:3])}?"
|
|
451
|
+
|
|
452
|
+
error_msg += "\n Use 'synth-ai baseline list' to see all baselines with details"
|
|
453
|
+
|
|
454
|
+
raise click.ClickException(error_msg)
|
|
455
|
+
|
|
456
|
+
choice = matching[0]
|
|
457
|
+
|
|
458
|
+
# 2. Load config
|
|
459
|
+
try:
|
|
460
|
+
config = load_baseline_config_from_file(baseline_id, choice.path)
|
|
461
|
+
except ImportError as e:
|
|
462
|
+
# ImportError already has good formatting from discovery.py
|
|
463
|
+
raise click.ClickException(str(e)) from e
|
|
464
|
+
except ValueError as e:
|
|
465
|
+
# ValueError already has good formatting from discovery.py
|
|
466
|
+
raise click.ClickException(str(e)) from e
|
|
467
|
+
except Exception as e:
|
|
468
|
+
error_type = type(e).__name__
|
|
469
|
+
raise click.ClickException(
|
|
470
|
+
f"❌ Unexpected error loading baseline '{baseline_id}'\n"
|
|
471
|
+
f" File: {choice.path}\n"
|
|
472
|
+
f" Error: {error_type}: {str(e)}\n"
|
|
473
|
+
f" Tip: Run with --verbose for more details"
|
|
474
|
+
) from e
|
|
475
|
+
|
|
476
|
+
# 3. Validate split
|
|
477
|
+
split_names = _parse_splits(split)
|
|
478
|
+
for split_name in split_names:
|
|
479
|
+
if split_name not in config.splits:
|
|
480
|
+
available_splits = sorted(config.splits.keys())
|
|
481
|
+
raise click.ClickException(
|
|
482
|
+
f"❌ Invalid split '{split_name}' for baseline '{baseline_id}'\n"
|
|
483
|
+
f" Available splits: {', '.join(available_splits)}\n"
|
|
484
|
+
f" Use: --split {available_splits[0]} (or comma-separated: --split {','.join(available_splits)})"
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
# 4. Determine seeds
|
|
488
|
+
if seeds:
|
|
489
|
+
try:
|
|
490
|
+
seed_list = _parse_seeds(seeds)
|
|
491
|
+
if not seed_list:
|
|
492
|
+
raise click.ClickException(
|
|
493
|
+
f"❌ No valid seeds provided\n"
|
|
494
|
+
f" Provided: '{seeds}'\n"
|
|
495
|
+
f" Expected: comma-separated integers (e.g., '0,1,2')"
|
|
496
|
+
)
|
|
497
|
+
except ValueError as e:
|
|
498
|
+
raise click.ClickException(
|
|
499
|
+
f"❌ Invalid seeds format\n"
|
|
500
|
+
f" Provided: '{seeds}'\n"
|
|
501
|
+
f" Expected: comma-separated integers (e.g., '0,1,2' or '10,20,30')\n"
|
|
502
|
+
f" Error: {str(e)}"
|
|
503
|
+
) from e
|
|
504
|
+
else:
|
|
505
|
+
# Use all seeds from specified splits
|
|
506
|
+
seed_list = []
|
|
507
|
+
for split_name in split_names:
|
|
508
|
+
seed_list.extend(config.splits[split_name].seeds)
|
|
509
|
+
|
|
510
|
+
if not seed_list:
|
|
511
|
+
split_info = []
|
|
512
|
+
for split_name in split_names:
|
|
513
|
+
num_seeds = len(config.splits[split_name].seeds)
|
|
514
|
+
split_info.append(f"{split_name} ({num_seeds} seeds)")
|
|
515
|
+
|
|
516
|
+
raise click.ClickException(
|
|
517
|
+
f"❌ No seeds found for split(s): {', '.join(split_names)}\n"
|
|
518
|
+
f" Split details: {', '.join(split_info)}\n"
|
|
519
|
+
f" This may indicate an empty split configuration\n"
|
|
520
|
+
f" Fix: Use --seeds to specify seeds manually (e.g., --seeds 0,1,2)"
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
# 5. Merge configs
|
|
524
|
+
policy_config = {**config.default_policy_config}
|
|
525
|
+
if model:
|
|
526
|
+
policy_config["model"] = model
|
|
527
|
+
if temperature is not None:
|
|
528
|
+
policy_config["temperature"] = temperature
|
|
529
|
+
if policy_config_json:
|
|
530
|
+
try:
|
|
531
|
+
policy_overrides = json.loads(policy_config_json)
|
|
532
|
+
policy_config.update(policy_overrides)
|
|
533
|
+
except json.JSONDecodeError as e:
|
|
534
|
+
raise click.ClickException(
|
|
535
|
+
f"❌ Invalid --policy-config JSON\n"
|
|
536
|
+
f" Provided: {policy_config_json[:100]}...\n"
|
|
537
|
+
f" Error: {str(e)}\n"
|
|
538
|
+
f" Expected: Valid JSON object (e.g., '{{\"model\": \"gpt-4o\", \"temperature\": 0.7}}')"
|
|
539
|
+
) from e
|
|
540
|
+
|
|
541
|
+
env_config = {**config.default_env_config}
|
|
542
|
+
if env_config_json:
|
|
543
|
+
try:
|
|
544
|
+
env_overrides = json.loads(env_config_json)
|
|
545
|
+
env_config.update(env_overrides)
|
|
546
|
+
except json.JSONDecodeError as e:
|
|
547
|
+
raise click.ClickException(
|
|
548
|
+
f"❌ Invalid --env-config JSON\n"
|
|
549
|
+
f" Provided: {env_config_json[:100]}...\n"
|
|
550
|
+
f" Error: {str(e)}\n"
|
|
551
|
+
f" Expected: Valid JSON object (e.g., '{{\"max_steps\": 1000}}')"
|
|
552
|
+
) from e
|
|
553
|
+
|
|
554
|
+
# Handle split-specific env config
|
|
555
|
+
for split_name in split_names:
|
|
556
|
+
split_config = config.splits[split_name]
|
|
557
|
+
if split_config.metadata:
|
|
558
|
+
env_config.update(split_config.metadata)
|
|
559
|
+
|
|
560
|
+
# 6. Setup trace storage (if requested)
|
|
561
|
+
tracer = None
|
|
562
|
+
if trace_db_url and trace_db_url.lower() not in {"none", "off"}:
|
|
563
|
+
from synth_ai.tracing_v3.session_tracer import SessionTracer
|
|
564
|
+
tracer = SessionTracer(db_url=trace_db_url, auto_save=True)
|
|
565
|
+
await tracer.initialize()
|
|
566
|
+
|
|
567
|
+
# 7. Execute tasks
|
|
568
|
+
click.echo(f"Running {len(seed_list)} tasks across {len(split_names)} split(s)...")
|
|
569
|
+
click.echo(f"Model: {policy_config.get('model', 'default')}")
|
|
570
|
+
click.echo(f"Concurrency: {concurrency}")
|
|
571
|
+
|
|
572
|
+
start_time = time.perf_counter()
|
|
573
|
+
try:
|
|
574
|
+
results = await run_baseline_evaluation(
|
|
575
|
+
config=config,
|
|
576
|
+
seeds=seed_list,
|
|
577
|
+
policy_config=policy_config,
|
|
578
|
+
env_config=env_config,
|
|
579
|
+
concurrency=concurrency,
|
|
580
|
+
)
|
|
581
|
+
except Exception as e:
|
|
582
|
+
error_type = type(e).__name__
|
|
583
|
+
raise click.ClickException(
|
|
584
|
+
f"❌ Error running baseline evaluation\n"
|
|
585
|
+
f" Baseline: {baseline_id}\n"
|
|
586
|
+
f" Tasks: {len(seed_list)} seeds\n"
|
|
587
|
+
f" Error: {error_type}: {str(e)}\n"
|
|
588
|
+
f" Common causes:\n"
|
|
589
|
+
f" - Missing dependencies (check baseline file imports)\n"
|
|
590
|
+
f" - API key not set (check environment variables)\n"
|
|
591
|
+
f" - Model/inference configuration issues\n"
|
|
592
|
+
f" Tip: Run with --verbose for detailed error output"
|
|
593
|
+
) from e
|
|
594
|
+
|
|
595
|
+
elapsed = time.perf_counter() - start_time
|
|
596
|
+
|
|
597
|
+
# Store traces if requested
|
|
598
|
+
if tracer:
|
|
599
|
+
for result in results:
|
|
600
|
+
if result.trace:
|
|
601
|
+
# Store trace (simplified - would need proper trace storage logic)
|
|
602
|
+
pass
|
|
603
|
+
|
|
604
|
+
# 8. Aggregate results
|
|
605
|
+
aggregate_metrics = aggregate_results(config, results)
|
|
606
|
+
|
|
607
|
+
# 9. Create output
|
|
608
|
+
baseline_results = BaselineResults(
|
|
609
|
+
config=config,
|
|
610
|
+
split_name=",".join(split_names),
|
|
611
|
+
results=results,
|
|
612
|
+
aggregate_metrics=aggregate_metrics,
|
|
613
|
+
execution_time_seconds=elapsed,
|
|
614
|
+
model_name=policy_config.get("model", "unknown"),
|
|
615
|
+
timestamp=datetime.now().isoformat(),
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
# 10. Display summary
|
|
619
|
+
click.echo("\n" + "=" * 60)
|
|
620
|
+
click.echo(f"Baseline Evaluation: {config.name}")
|
|
621
|
+
click.echo("=" * 60)
|
|
622
|
+
click.echo(f"Split(s): {baseline_results.split_name}")
|
|
623
|
+
click.echo(f"Tasks: {len(results)}")
|
|
624
|
+
click.echo(f"Success: {sum(1 for r in results if r.success)}/{len(results)}")
|
|
625
|
+
click.echo(f"Execution time: {elapsed:.2f}s")
|
|
626
|
+
click.echo("\nAggregate Metrics:")
|
|
627
|
+
for key, value in aggregate_metrics.items():
|
|
628
|
+
if isinstance(value, float):
|
|
629
|
+
click.echo(f" {key}: {value:.4f}")
|
|
630
|
+
else:
|
|
631
|
+
click.echo(f" {key}: {value}")
|
|
632
|
+
|
|
633
|
+
# 11. Save output if requested
|
|
634
|
+
if output_path:
|
|
635
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
636
|
+
output_path.write_text(json.dumps(baseline_results.to_dict(), indent=2))
|
|
637
|
+
click.echo(f"\nResults saved to: {output_path}")
|