synth-ai 0.2.8.dev2__py3-none-any.whl → 0.4.3__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.
- synth_ai/__init__.py +44 -24
- synth_ai/__main__.py +30 -3
- synth_ai/cli/__init__.py +103 -48
- synth_ai/cli/__main__.py +42 -0
- synth_ai/cli/_internal/__init__.py +5 -0
- synth_ai/cli/_internal/modal_wrapper.py +31 -0
- synth_ai/cli/_internal/storage.py +20 -0
- synth_ai/cli/_internal/typer_patch.py +47 -0
- synth_ai/cli/_internal/validate_task_app.py +29 -0
- synth_ai/cli/agents/__init__.py +17 -0
- synth_ai/cli/agents/claude.py +77 -0
- synth_ai/cli/agents/codex.py +265 -0
- synth_ai/cli/agents/opencode.py +253 -0
- synth_ai/cli/commands/__init__.py +18 -0
- synth_ai/cli/commands/artifacts/__init__.py +13 -0
- synth_ai/cli/commands/artifacts/client.py +119 -0
- synth_ai/cli/commands/artifacts/config.py +57 -0
- synth_ai/cli/commands/artifacts/core.py +24 -0
- synth_ai/cli/commands/artifacts/download.py +188 -0
- synth_ai/cli/commands/artifacts/export.py +186 -0
- synth_ai/cli/commands/artifacts/list.py +156 -0
- synth_ai/cli/commands/artifacts/parsing.py +250 -0
- synth_ai/cli/commands/artifacts/show.py +336 -0
- synth_ai/cli/commands/demo/__init__.py +3 -0
- synth_ai/cli/commands/demo/core.py +153 -0
- synth_ai/cli/commands/eval/__init__.py +10 -0
- synth_ai/cli/commands/eval/config.py +338 -0
- synth_ai/cli/commands/eval/core.py +256 -0
- synth_ai/cli/commands/eval/runner.py +704 -0
- synth_ai/cli/commands/eval/validation.py +60 -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/scan/__init__.py +19 -0
- synth_ai/cli/commands/scan/cloudflare_scanner.py +403 -0
- synth_ai/cli/commands/scan/core.py +344 -0
- synth_ai/cli/commands/scan/health_checker.py +242 -0
- synth_ai/cli/commands/scan/local_scanner.py +278 -0
- synth_ai/cli/commands/scan/models.py +83 -0
- synth_ai/cli/commands/smoke/__init__.py +7 -0
- synth_ai/cli/commands/smoke/core.py +1428 -0
- synth_ai/cli/commands/status/__init__.py +3 -0
- synth_ai/cli/commands/status/client.py +91 -0
- synth_ai/cli/commands/status/config.py +12 -0
- synth_ai/cli/commands/status/errors.py +11 -0
- synth_ai/cli/commands/status/subcommands/__init__.py +3 -0
- synth_ai/cli/commands/status/subcommands/config.py +13 -0
- synth_ai/cli/commands/status/subcommands/files.py +34 -0
- synth_ai/cli/commands/status/subcommands/jobs.py +51 -0
- synth_ai/cli/commands/status/subcommands/models.py +35 -0
- synth_ai/cli/commands/status/subcommands/runs.py +34 -0
- synth_ai/cli/commands/status/subcommands/session.py +77 -0
- synth_ai/cli/commands/status/subcommands/summary.py +39 -0
- synth_ai/cli/commands/status/subcommands/utils.py +41 -0
- synth_ai/cli/commands/status/utils.py +23 -0
- synth_ai/cli/commands/train/__init__.py +53 -0
- synth_ai/cli/commands/train/core.py +22 -0
- synth_ai/cli/commands/train/errors.py +117 -0
- synth_ai/cli/commands/train/judge_schemas.py +201 -0
- synth_ai/cli/commands/train/judge_validation.py +305 -0
- synth_ai/cli/commands/train/prompt_learning_validation.py +633 -0
- synth_ai/cli/commands/train/validation.py +392 -0
- synth_ai/cli/demo_apps/__init__.py +10 -0
- synth_ai/cli/demo_apps/core/__init__.py +28 -0
- synth_ai/{demos → cli/demo_apps}/core/cli.py +783 -441
- synth_ai/cli/demo_apps/crafter/__init__.py +1 -0
- synth_ai/cli/demo_apps/crafter/crafter_fft_4b.toml +55 -0
- synth_ai/cli/demo_apps/crafter/grpo_crafter_task_app.py +186 -0
- synth_ai/cli/demo_apps/crafter/rl_from_base_qwen4b.toml +74 -0
- synth_ai/cli/demo_apps/demo_registry.py +176 -0
- synth_ai/cli/demo_apps/demo_task_apps/__init__.py +7 -0
- synth_ai/{demos → cli/demo_apps}/demo_task_apps/core.py +75 -37
- synth_ai/cli/demo_apps/demo_task_apps/crafter/__init__.py +1 -0
- synth_ai/cli/demo_apps/demo_task_apps/crafter/configs/crafter_fft_4b.toml +53 -0
- synth_ai/cli/demo_apps/demo_task_apps/crafter/configs/rl_from_base_qwen4b.toml +73 -0
- synth_ai/cli/demo_apps/demo_task_apps/crafter/grpo_crafter_task_app.py +185 -0
- synth_ai/{demos → cli/demo_apps}/demo_task_apps/math/_common.py +1 -2
- synth_ai/{demos → cli/demo_apps}/demo_task_apps/math/app.py +2 -1
- synth_ai/cli/demo_apps/demo_task_apps/math/config.toml +73 -0
- synth_ai/{demos → cli/demo_apps}/demo_task_apps/math/deploy_modal.py +3 -6
- synth_ai/cli/demo_apps/demo_task_apps/math/modal_task_app.py +738 -0
- synth_ai/cli/demo_apps/demo_task_apps/math/task_app_entry.py +39 -0
- synth_ai/cli/demo_apps/math/__init__.py +1 -0
- synth_ai/cli/demo_apps/math/_common.py +16 -0
- synth_ai/cli/demo_apps/math/app.py +38 -0
- synth_ai/cli/demo_apps/math/config.toml +75 -0
- synth_ai/cli/demo_apps/math/deploy_modal.py +54 -0
- synth_ai/cli/demo_apps/math/modal_task_app.py +698 -0
- synth_ai/cli/demo_apps/math/task_app_entry.py +53 -0
- synth_ai/cli/demo_apps/mipro/main.py +271 -0
- synth_ai/cli/demo_apps/mipro/task_app.py +922 -0
- synth_ai/cli/demo_apps/mipro/train_cfg.toml +92 -0
- synth_ai/cli/demos/__init__.py +12 -0
- synth_ai/cli/demos/demo.py +32 -0
- synth_ai/cli/demos/rl_demo.py +254 -0
- synth_ai/cli/deploy.py +216 -0
- synth_ai/cli/infra/__init__.py +14 -0
- synth_ai/cli/{balance.py → infra/balance.py} +16 -4
- synth_ai/cli/infra/mcp.py +35 -0
- synth_ai/cli/infra/modal_app.py +36 -0
- synth_ai/cli/infra/setup.py +69 -0
- synth_ai/cli/infra/status.py +16 -0
- synth_ai/cli/infra/turso.py +77 -0
- synth_ai/cli/lib/__init__.py +10 -0
- synth_ai/cli/lib/agents.py +76 -0
- synth_ai/cli/lib/apps/modal_app.py +101 -0
- synth_ai/cli/lib/apps/task_app.py +642 -0
- synth_ai/cli/lib/bin.py +39 -0
- synth_ai/cli/lib/env.py +375 -0
- synth_ai/cli/lib/errors.py +85 -0
- synth_ai/cli/lib/modal.py +315 -0
- synth_ai/cli/lib/plotting.py +126 -0
- synth_ai/cli/lib/prompt_args.py +39 -0
- synth_ai/cli/lib/prompts.py +284 -0
- synth_ai/cli/lib/sqld.py +122 -0
- synth_ai/cli/lib/task_app_discovery.py +884 -0
- synth_ai/cli/lib/task_app_env.py +295 -0
- synth_ai/cli/lib/train_cfgs.py +300 -0
- synth_ai/cli/lib/tunnel_records.py +207 -0
- synth_ai/cli/local/__init__.py +14 -0
- synth_ai/cli/local/experiment_queue/__init__.py +72 -0
- synth_ai/cli/local/experiment_queue/api_schemas.py +221 -0
- synth_ai/cli/local/experiment_queue/celery_app.py +208 -0
- synth_ai/cli/local/experiment_queue/config.py +128 -0
- synth_ai/cli/local/experiment_queue/config_utils.py +272 -0
- synth_ai/cli/local/experiment_queue/database.py +175 -0
- synth_ai/cli/local/experiment_queue/dispatcher.py +119 -0
- synth_ai/cli/local/experiment_queue/models.py +231 -0
- synth_ai/cli/local/experiment_queue/progress_info.py +160 -0
- synth_ai/cli/local/experiment_queue/results.py +373 -0
- synth_ai/cli/local/experiment_queue/schemas.py +131 -0
- synth_ai/cli/local/experiment_queue/service.py +344 -0
- synth_ai/cli/local/experiment_queue/status.py +372 -0
- synth_ai/cli/local/experiment_queue/status_tracker.py +360 -0
- synth_ai/cli/local/experiment_queue/tasks.py +1984 -0
- synth_ai/cli/local/experiment_queue/trace_storage.py +65 -0
- synth_ai/cli/local/experiment_queue/validation.py +157 -0
- synth_ai/cli/local/session/__init__.py +92 -0
- synth_ai/cli/local/session/client.py +383 -0
- synth_ai/cli/local/session/constants.py +63 -0
- synth_ai/cli/local/session/exceptions.py +105 -0
- synth_ai/cli/local/session/manager.py +139 -0
- synth_ai/cli/local/session/models.py +89 -0
- synth_ai/cli/local/session/query.py +110 -0
- synth_ai/cli/root.py +150 -108
- synth_ai/cli/task_apps/__init__.py +37 -0
- synth_ai/cli/task_apps/commands.py +3145 -0
- synth_ai/cli/task_apps/deploy.py +7 -0
- synth_ai/cli/task_apps/list.py +26 -0
- synth_ai/cli/task_apps/main.py +36 -0
- synth_ai/cli/task_apps/modal_serve.py +11 -0
- synth_ai/cli/task_apps/serve.py +11 -0
- synth_ai/cli/training/__init__.py +8 -0
- synth_ai/cli/training/train.py +5 -0
- synth_ai/cli/training/train_cfg.py +34 -0
- synth_ai/cli/{watch.py → training/watch.py} +13 -18
- synth_ai/cli/turso.py +52 -0
- synth_ai/cli/utils/__init__.py +8 -0
- synth_ai/cli/utils/experiments.py +235 -0
- synth_ai/cli/utils/queue.py +504 -0
- synth_ai/cli/{recent.py → utils/recent.py} +13 -7
- synth_ai/cli/{traces.py → utils/traces.py} +9 -5
- synth_ai/contracts/__init__.py +67 -0
- synth_ai/core/__init__.py +100 -0
- synth_ai/core/_utils/__init__.py +54 -0
- synth_ai/core/_utils/base_url.py +10 -0
- synth_ai/core/_utils/http.py +10 -0
- synth_ai/core/_utils/prompts.py +14 -0
- synth_ai/core/_utils/task_app_state.py +12 -0
- synth_ai/core/_utils/user_config.py +10 -0
- synth_ai/core/apps/common.py +116 -0
- synth_ai/core/auth.py +95 -0
- synth_ai/core/cfgs.py +240 -0
- synth_ai/core/config/__init__.py +16 -0
- synth_ai/core/config/base.py +168 -0
- synth_ai/core/config/resolver.py +89 -0
- synth_ai/core/env.py +231 -0
- synth_ai/core/errors.py +126 -0
- synth_ai/core/http.py +230 -0
- synth_ai/core/integrations/__init__.py +11 -0
- synth_ai/core/integrations/cloudflare.py +1710 -0
- synth_ai/core/integrations/mcp/__init__.py +6 -0
- synth_ai/core/integrations/mcp/__main__.py +8 -0
- synth_ai/core/integrations/mcp/claude.py +36 -0
- synth_ai/core/integrations/mcp/main.py +254 -0
- synth_ai/core/integrations/mcp/setup.py +100 -0
- synth_ai/core/integrations/modal.py +277 -0
- synth_ai/core/json.py +72 -0
- synth_ai/core/log_filter.py +99 -0
- synth_ai/core/logging.py +82 -0
- synth_ai/core/paths.py +107 -0
- synth_ai/core/pricing.py +109 -0
- synth_ai/core/process.py +233 -0
- synth_ai/core/ssl.py +25 -0
- synth_ai/core/storage/__init__.py +71 -0
- synth_ai/core/task_app_state.py +318 -0
- synth_ai/core/telemetry.py +282 -0
- synth_ai/{tracing_v3 → core/tracing_v3}/__init__.py +5 -1
- synth_ai/{tracing_v3 → core/tracing_v3}/abstractions.py +21 -4
- synth_ai/core/tracing_v3/config.py +229 -0
- synth_ai/core/tracing_v3/constants.py +21 -0
- synth_ai/{tracing_v3 → core/tracing_v3}/db_config.py +42 -29
- synth_ai/{tracing_v3 → core/tracing_v3}/decorators.py +80 -45
- synth_ai/{tracing_v3 → core/tracing_v3}/examples/basic_usage.py +15 -9
- synth_ai/{tracing_v3 → core/tracing_v3}/hooks.py +6 -4
- synth_ai/{tracing_v3 → core/tracing_v3}/llm_call_record_helpers.py +161 -61
- synth_ai/{tracing_v3 → core/tracing_v3}/migration_helper.py +1 -2
- synth_ai/{tracing_v3 → core/tracing_v3}/replica_sync.py +12 -7
- synth_ai/core/tracing_v3/serialization.py +130 -0
- synth_ai/{tracing_v3 → core/tracing_v3}/session_tracer.py +88 -21
- synth_ai/{tracing_v3 → core/tracing_v3}/storage/base.py +99 -12
- synth_ai/core/tracing_v3/storage/config.py +109 -0
- synth_ai/{tracing_v3 → core/tracing_v3}/storage/factory.py +11 -9
- synth_ai/{tracing_v3 → core/tracing_v3}/storage/utils.py +15 -11
- synth_ai/core/tracing_v3/trace_utils.py +326 -0
- synth_ai/core/tracing_v3/turso/__init__.py +12 -0
- synth_ai/core/tracing_v3/turso/daemon.py +278 -0
- synth_ai/{tracing_v3 → core/tracing_v3}/turso/models.py +7 -3
- synth_ai/core/tracing_v3/turso/native_manager.py +1385 -0
- synth_ai/{tracing_v3 → core/tracing_v3}/utils.py +5 -4
- synth_ai/core/urls.py +18 -0
- synth_ai/core/user_config.py +137 -0
- synth_ai/core/uvicorn.py +222 -0
- synth_ai/data/__init__.py +83 -0
- synth_ai/data/enums.py +123 -0
- synth_ai/data/rewards.py +152 -0
- synth_ai/data/traces.py +35 -0
- synth_ai/products/__init__.py +6 -0
- synth_ai/products/graph_evolve/__init__.py +46 -0
- synth_ai/products/graph_evolve/client.py +226 -0
- synth_ai/products/graph_evolve/config.py +591 -0
- synth_ai/products/graph_evolve/converters/__init__.py +42 -0
- synth_ai/products/graph_evolve/converters/openai_sft.py +484 -0
- synth_ai/products/graph_evolve/examples/hotpotqa/config.toml +109 -0
- synth_ai/products/graph_evolve/run.py +222 -0
- synth_ai/products/graph_gepa/__init__.py +23 -0
- synth_ai/products/graph_gepa/converters/__init__.py +19 -0
- synth_ai/products/graph_gepa/converters/openai_sft.py +29 -0
- synth_ai/sdk/__init__.py +123 -0
- synth_ai/sdk/api/__init__.py +1 -0
- synth_ai/sdk/api/models/supported.py +514 -0
- synth_ai/sdk/api/research_agent/__init__.py +296 -0
- synth_ai/sdk/api/train/__init__.py +85 -0
- synth_ai/sdk/api/train/builders.py +895 -0
- synth_ai/sdk/api/train/cli.py +2199 -0
- synth_ai/sdk/api/train/config_finder.py +267 -0
- synth_ai/sdk/api/train/configs/__init__.py +65 -0
- synth_ai/sdk/api/train/configs/prompt_learning.py +1706 -0
- synth_ai/sdk/api/train/configs/rl.py +187 -0
- synth_ai/sdk/api/train/configs/sft.py +99 -0
- synth_ai/sdk/api/train/configs/shared.py +81 -0
- synth_ai/sdk/api/train/context_learning.py +312 -0
- synth_ai/sdk/api/train/env_resolver.py +418 -0
- synth_ai/sdk/api/train/graph_validators.py +216 -0
- synth_ai/sdk/api/train/graphgen.py +984 -0
- synth_ai/sdk/api/train/graphgen_models.py +823 -0
- synth_ai/sdk/api/train/graphgen_validators.py +109 -0
- synth_ai/sdk/api/train/local_api.py +10 -0
- synth_ai/sdk/api/train/pollers.py +124 -0
- synth_ai/sdk/api/train/progress/__init__.py +97 -0
- synth_ai/sdk/api/train/progress/dataclasses.py +569 -0
- synth_ai/sdk/api/train/progress/events.py +326 -0
- synth_ai/sdk/api/train/progress/results.py +428 -0
- synth_ai/sdk/api/train/progress/tracker.py +641 -0
- synth_ai/sdk/api/train/prompt_learning.py +469 -0
- synth_ai/sdk/api/train/rl.py +441 -0
- synth_ai/sdk/api/train/sft.py +396 -0
- synth_ai/sdk/api/train/summary.py +522 -0
- synth_ai/sdk/api/train/supported_algos.py +147 -0
- synth_ai/sdk/api/train/task_app.py +351 -0
- synth_ai/sdk/api/train/utils.py +279 -0
- synth_ai/sdk/api/train/validators.py +2424 -0
- synth_ai/sdk/graphs/__init__.py +15 -0
- synth_ai/sdk/graphs/completions.py +570 -0
- synth_ai/{inference → sdk/inference}/__init__.py +0 -1
- synth_ai/sdk/inference/client.py +128 -0
- synth_ai/sdk/jobs/__init__.py +16 -0
- synth_ai/sdk/jobs/client.py +371 -0
- synth_ai/sdk/judging/__init__.py +14 -0
- synth_ai/sdk/judging/base.py +24 -0
- synth_ai/sdk/judging/client.py +40 -0
- synth_ai/sdk/judging/schemas.py +222 -0
- synth_ai/sdk/judging/types.py +42 -0
- synth_ai/sdk/learning/__init__.py +99 -0
- synth_ai/sdk/learning/algorithms.py +14 -0
- synth_ai/{learning → sdk/learning}/client.py +121 -30
- synth_ai/sdk/learning/config.py +5 -0
- synth_ai/{learning → sdk/learning}/constants.py +0 -2
- synth_ai/sdk/learning/context_learning_client.py +531 -0
- synth_ai/sdk/learning/context_learning_types.py +292 -0
- synth_ai/sdk/learning/ft_client.py +7 -0
- synth_ai/{learning → sdk/learning}/health.py +15 -9
- synth_ai/{learning → sdk/learning}/jobs.py +44 -47
- synth_ai/sdk/learning/prompt_extraction.py +334 -0
- synth_ai/sdk/learning/prompt_learning_client.py +455 -0
- synth_ai/sdk/learning/prompt_learning_types.py +186 -0
- synth_ai/{rl → sdk/learning/rl}/__init__.py +13 -8
- synth_ai/{learning/rl_client.py → sdk/learning/rl/client.py} +89 -77
- synth_ai/sdk/learning/rl/config.py +31 -0
- synth_ai/{rl → sdk/learning/rl}/contracts.py +5 -14
- synth_ai/{rl → sdk/learning/rl}/env_keys.py +45 -16
- synth_ai/sdk/learning/rl/secrets.py +13 -0
- synth_ai/sdk/learning/rl_client.py +5 -0
- synth_ai/sdk/learning/sft/__init__.py +29 -0
- synth_ai/sdk/learning/sft/client.py +95 -0
- synth_ai/sdk/learning/sft/config.py +270 -0
- synth_ai/sdk/learning/sft/data.py +698 -0
- synth_ai/sdk/learning/sse.py +57 -0
- synth_ai/sdk/learning/validators.py +52 -0
- synth_ai/sdk/localapi/__init__.py +40 -0
- synth_ai/sdk/localapi/apps/__init__.py +28 -0
- synth_ai/sdk/localapi/client.py +10 -0
- synth_ai/sdk/localapi/contracts.py +10 -0
- synth_ai/sdk/localapi/helpers.py +519 -0
- synth_ai/sdk/localapi/rollouts.py +87 -0
- synth_ai/sdk/localapi/server.py +29 -0
- synth_ai/sdk/localapi/template.py +70 -0
- synth_ai/sdk/streaming/__init__.py +35 -0
- synth_ai/sdk/streaming/config.py +94 -0
- synth_ai/sdk/streaming/handlers.py +1997 -0
- synth_ai/sdk/streaming/streamer.py +713 -0
- synth_ai/sdk/streaming/types.py +112 -0
- synth_ai/sdk/task/__init__.py +164 -0
- synth_ai/sdk/task/apps/__init__.py +169 -0
- synth_ai/sdk/task/auth.py +165 -0
- synth_ai/sdk/task/client.py +175 -0
- synth_ai/sdk/task/config.py +257 -0
- synth_ai/sdk/task/contracts.py +219 -0
- synth_ai/sdk/task/datasets.py +108 -0
- synth_ai/sdk/task/errors.py +50 -0
- synth_ai/sdk/task/health.py +34 -0
- synth_ai/sdk/task/in_process.py +1190 -0
- synth_ai/sdk/task/in_process_runner.py +314 -0
- synth_ai/sdk/task/inference_api.py +299 -0
- synth_ai/sdk/task/json.py +111 -0
- synth_ai/sdk/task/proxy.py +287 -0
- synth_ai/sdk/task/rubrics/__init__.py +55 -0
- synth_ai/sdk/task/rubrics/loaders.py +156 -0
- synth_ai/sdk/task/rubrics/models.py +57 -0
- synth_ai/sdk/task/rubrics/scoring.py +116 -0
- synth_ai/sdk/task/rubrics/strict.py +149 -0
- synth_ai/sdk/task/rubrics.py +219 -0
- synth_ai/sdk/task/server.py +631 -0
- synth_ai/sdk/task/trace_correlation_helpers.py +539 -0
- synth_ai/sdk/task/tracing_utils.py +95 -0
- synth_ai/sdk/task/validators.py +441 -0
- synth_ai/sdk/task/vendors.py +59 -0
- synth_ai/sdk/training/__init__.py +102 -0
- synth_ai/sdk/tunnels/__init__.py +83 -0
- synth_ai/sdk/tunnels/cleanup.py +83 -0
- synth_ai/sdk/tunnels/ports.py +120 -0
- synth_ai/utils/__init__.py +213 -0
- synth_ai-0.4.3.dist-info/METADATA +262 -0
- synth_ai-0.4.3.dist-info/RECORD +370 -0
- {synth_ai-0.2.8.dev2.dist-info → synth_ai-0.4.3.dist-info}/entry_points.txt +0 -1
- synth_ai/cli/calc.py +0 -69
- synth_ai/cli/demo.py +0 -144
- synth_ai/cli/legacy_root_backup.py +0 -470
- synth_ai/cli/man.py +0 -106
- synth_ai/cli/rl_demo.py +0 -202
- synth_ai/cli/status.py +0 -133
- synth_ai/config/base_url.py +0 -107
- synth_ai/core/experiment.py +0 -15
- synth_ai/core/system.py +0 -15
- synth_ai/demos/core/__init__.py +0 -1
- synth_ai/demos/demo_task_apps/__init__.py +0 -1
- synth_ai/demos/demo_task_apps/math/config.toml +0 -129
- synth_ai/demos/demo_task_apps/math/deploy_task_app.sh +0 -22
- synth_ai/demos/demo_task_apps/math/modal_task_app.py +0 -415
- synth_ai/environments/__init__.py +0 -31
- synth_ai/environments/environment/__init__.py +0 -1
- synth_ai/environments/environment/artifacts/__init__.py +0 -1
- synth_ai/environments/environment/artifacts/base.py +0 -52
- synth_ai/environments/environment/core.py +0 -67
- synth_ai/environments/environment/db/__init__.py +0 -1
- synth_ai/environments/environment/db/sqlite.py +0 -45
- synth_ai/environments/environment/registry.py +0 -233
- synth_ai/environments/environment/resources/sqlite.py +0 -45
- synth_ai/environments/environment/results.py +0 -1
- synth_ai/environments/environment/rewards/__init__.py +0 -1
- synth_ai/environments/environment/rewards/core.py +0 -29
- synth_ai/environments/environment/shared_engine.py +0 -26
- synth_ai/environments/environment/tools/__init__.py +0 -200
- synth_ai/environments/examples/__init__.py +0 -1
- synth_ai/environments/examples/bandit/__init__.py +0 -33
- synth_ai/environments/examples/bandit/engine.py +0 -294
- synth_ai/environments/examples/bandit/environment.py +0 -194
- synth_ai/environments/examples/bandit/taskset.py +0 -200
- synth_ai/environments/examples/crafter_classic/__init__.py +0 -8
- synth_ai/environments/examples/crafter_classic/agent_demos/analyze_semantic_words_markdown.py +0 -250
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_comprehensive_evaluation.py +0 -59
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_evaluation_browser.py +0 -152
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_evaluation_config.toml +0 -24
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_evaluation_framework.py +0 -1194
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/crafter_synth_config.toml +0 -56
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/filter_config_modal.toml +0 -32
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/filter_traces_sft_turso.py +0 -738
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/kick_off_ft_modal.py +0 -384
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/analyze_action_results.py +0 -53
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/analyze_agent_actions.py +0 -178
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/analyze_latest_run.py +0 -222
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/analyze_lm_traces.py +0 -183
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/analyze_no_rewards.py +0 -210
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/analyze_trace_issue.py +0 -206
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/check_db_schema.py +0 -49
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/check_latest_results.py +0 -64
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/debug_agent_responses.py +0 -88
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_modal_ft/old/quick_trace_check.py +0 -77
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/compare_experiments.py +0 -324
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/filter_traces_sft_turso.py +0 -580
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/kick_off_ft_oai.py +0 -362
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/multi_model_config.toml +0 -49
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/analyze_enhanced_hooks.py +0 -332
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/analyze_hook_events.py +0 -97
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/analyze_hook_results.py +0 -217
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/check_hook_storage.py +0 -87
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/check_seeds.py +0 -88
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/compare_seed_performance.py +0 -195
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/custom_eval_pipelines.py +0 -400
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/plot_hook_frequency.py +0 -195
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/old/seed_analysis_summary.py +0 -56
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_openai_ft/run_rollouts_for_models_and_compare_v3.py +0 -858
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_quick_evaluation.py +0 -52
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_react_agent.py +0 -874
- synth_ai/environments/examples/crafter_classic/agent_demos/crafter_trace_evaluation.py +0 -1412
- synth_ai/environments/examples/crafter_classic/agent_demos/example_v3_usage.py +0 -216
- synth_ai/environments/examples/crafter_classic/agent_demos/old/compare_traces.py +0 -296
- synth_ai/environments/examples/crafter_classic/agent_demos/old/crafter_comprehensive_evaluation.py +0 -58
- synth_ai/environments/examples/crafter_classic/agent_demos/old/crafter_env_serialization.py +0 -464
- synth_ai/environments/examples/crafter_classic/agent_demos/old/crafter_evaluation_browser.py +0 -152
- synth_ai/environments/examples/crafter_classic/agent_demos/old/crafter_quick_evaluation.py +0 -51
- synth_ai/environments/examples/crafter_classic/agent_demos/old/crafter_trace_evaluation.py +0 -1412
- synth_ai/environments/examples/crafter_classic/agent_demos/old/debug_player_loss.py +0 -112
- synth_ai/environments/examples/crafter_classic/agent_demos/old/diagnose_service.py +0 -203
- synth_ai/environments/examples/crafter_classic/agent_demos/old/diagnose_slowness.py +0 -305
- synth_ai/environments/examples/crafter_classic/agent_demos/old/eval_by_difficulty.py +0 -126
- synth_ai/environments/examples/crafter_classic/agent_demos/old/eval_example.py +0 -94
- synth_ai/environments/examples/crafter_classic/agent_demos/old/explore_saved_states.py +0 -142
- synth_ai/environments/examples/crafter_classic/agent_demos/old/filter_traces_sft.py +0 -26
- synth_ai/environments/examples/crafter_classic/agent_demos/old/filter_traces_sft_OLD.py +0 -984
- synth_ai/environments/examples/crafter_classic/agent_demos/old/generate_ft_data_gemini.py +0 -724
- synth_ai/environments/examples/crafter_classic/agent_demos/old/generate_ft_data_modal.py +0 -386
- synth_ai/environments/examples/crafter_classic/agent_demos/old/generate_ft_metadata.py +0 -205
- synth_ai/environments/examples/crafter_classic/agent_demos/old/kick_off_ft_gemini.py +0 -150
- synth_ai/environments/examples/crafter_classic/agent_demos/old/kick_off_ft_modal.py +0 -283
- synth_ai/environments/examples/crafter_classic/agent_demos/old/prepare_vertex_ft.py +0 -280
- synth_ai/environments/examples/crafter_classic/agent_demos/old/profile_env_slowness.py +0 -456
- synth_ai/environments/examples/crafter_classic/agent_demos/old/replicate_issue.py +0 -166
- synth_ai/environments/examples/crafter_classic/agent_demos/old/run_and_eval.py +0 -102
- synth_ai/environments/examples/crafter_classic/agent_demos/old/run_comparison.py +0 -128
- synth_ai/environments/examples/crafter_classic/agent_demos/old/run_qwen_rollouts.py +0 -655
- synth_ai/environments/examples/crafter_classic/agent_demos/old/trace_eval_OLD.py +0 -202
- synth_ai/environments/examples/crafter_classic/agent_demos/old/validate_openai_format.py +0 -166
- synth_ai/environments/examples/crafter_classic/config_logging.py +0 -111
- synth_ai/environments/examples/crafter_classic/debug_translation.py +0 -0
- synth_ai/environments/examples/crafter_classic/engine.py +0 -579
- synth_ai/environments/examples/crafter_classic/engine_deterministic_patch.py +0 -64
- synth_ai/environments/examples/crafter_classic/engine_helpers/action_map.py +0 -6
- synth_ai/environments/examples/crafter_classic/engine_helpers/serialization.py +0 -75
- synth_ai/environments/examples/crafter_classic/engine_serialization_patch_v3.py +0 -267
- synth_ai/environments/examples/crafter_classic/environment.py +0 -404
- synth_ai/environments/examples/crafter_classic/taskset.py +0 -233
- synth_ai/environments/examples/crafter_classic/trace_hooks_v3.py +0 -228
- synth_ai/environments/examples/crafter_classic/world_config_patch_simple.py +0 -299
- synth_ai/environments/examples/crafter_custom/__init__.py +0 -4
- synth_ai/environments/examples/crafter_custom/agent_demos/__init__.py +0 -1
- synth_ai/environments/examples/crafter_custom/agent_demos/trace_eval.py +0 -202
- synth_ai/environments/examples/crafter_custom/crafter/__init__.py +0 -7
- synth_ai/environments/examples/crafter_custom/crafter/config.py +0 -182
- synth_ai/environments/examples/crafter_custom/crafter/constants.py +0 -8
- synth_ai/environments/examples/crafter_custom/crafter/engine.py +0 -269
- synth_ai/environments/examples/crafter_custom/crafter/env.py +0 -262
- synth_ai/environments/examples/crafter_custom/crafter/objects.py +0 -417
- synth_ai/environments/examples/crafter_custom/crafter/recorder.py +0 -187
- synth_ai/environments/examples/crafter_custom/crafter/worldgen.py +0 -118
- synth_ai/environments/examples/crafter_custom/dataset_builder.py +0 -373
- synth_ai/environments/examples/crafter_custom/environment.py +0 -312
- synth_ai/environments/examples/crafter_custom/old/analyze_diamond_issue.py +0 -159
- synth_ai/environments/examples/crafter_custom/old/analyze_diamond_spawning.py +0 -158
- synth_ai/environments/examples/crafter_custom/old/compare_worlds.py +0 -71
- synth_ai/environments/examples/crafter_custom/old/dataset_stats.py +0 -105
- synth_ai/environments/examples/crafter_custom/old/diamond_spawning_summary.py +0 -119
- synth_ai/environments/examples/crafter_custom/old/example_dataset_usage.py +0 -52
- synth_ai/environments/examples/crafter_custom/run_dataset.py +0 -305
- synth_ai/environments/examples/enron/art_helpers/email_search_tools.py +0 -156
- synth_ai/environments/examples/enron/art_helpers/local_email_db.py +0 -281
- synth_ai/environments/examples/enron/art_helpers/types_enron.py +0 -25
- synth_ai/environments/examples/enron/engine.py +0 -295
- synth_ai/environments/examples/enron/environment.py +0 -166
- synth_ai/environments/examples/enron/taskset.py +0 -112
- synth_ai/environments/examples/enron/units/keyword_stats.py +0 -112
- synth_ai/environments/examples/minigrid/__init__.py +0 -48
- synth_ai/environments/examples/minigrid/agent_demos/minigrid_evaluation_framework.py +0 -1188
- synth_ai/environments/examples/minigrid/agent_demos/minigrid_quick_evaluation.py +0 -48
- synth_ai/environments/examples/minigrid/agent_demos/minigrid_react_agent.py +0 -562
- synth_ai/environments/examples/minigrid/agent_demos/minigrid_trace_evaluation.py +0 -221
- synth_ai/environments/examples/minigrid/engine.py +0 -589
- synth_ai/environments/examples/minigrid/environment.py +0 -274
- synth_ai/environments/examples/minigrid/environment_mapping.py +0 -242
- synth_ai/environments/examples/minigrid/puzzle_loader.py +0 -417
- synth_ai/environments/examples/minigrid/taskset.py +0 -583
- synth_ai/environments/examples/nethack/__init__.py +0 -7
- synth_ai/environments/examples/nethack/achievements.py +0 -337
- synth_ai/environments/examples/nethack/agent_demos/nethack_evaluation_framework.py +0 -981
- synth_ai/environments/examples/nethack/agent_demos/nethack_quick_evaluation.py +0 -74
- synth_ai/environments/examples/nethack/agent_demos/nethack_react_agent.py +0 -831
- synth_ai/environments/examples/nethack/engine.py +0 -739
- synth_ai/environments/examples/nethack/environment.py +0 -256
- synth_ai/environments/examples/nethack/helpers/__init__.py +0 -41
- synth_ai/environments/examples/nethack/helpers/action_mapping.py +0 -301
- synth_ai/environments/examples/nethack/helpers/nle_wrapper.py +0 -402
- synth_ai/environments/examples/nethack/helpers/observation_utils.py +0 -433
- synth_ai/environments/examples/nethack/helpers/recording_wrapper.py +0 -200
- synth_ai/environments/examples/nethack/helpers/trajectory_recorder.py +0 -269
- synth_ai/environments/examples/nethack/helpers/visualization/replay_viewer.py +0 -308
- synth_ai/environments/examples/nethack/helpers/visualization/visualizer.py +0 -431
- synth_ai/environments/examples/nethack/taskset.py +0 -323
- synth_ai/environments/examples/red/__init__.py +0 -7
- synth_ai/environments/examples/red/agent_demos/__init__.py +0 -1
- synth_ai/environments/examples/red/config_logging.py +0 -110
- synth_ai/environments/examples/red/engine.py +0 -694
- synth_ai/environments/examples/red/engine_helpers/__init__.py +0 -1
- synth_ai/environments/examples/red/engine_helpers/memory_map.py +0 -28
- synth_ai/environments/examples/red/engine_helpers/reward_components.py +0 -276
- synth_ai/environments/examples/red/engine_helpers/reward_library/__init__.py +0 -142
- synth_ai/environments/examples/red/engine_helpers/reward_library/adaptive_rewards.py +0 -57
- synth_ai/environments/examples/red/engine_helpers/reward_library/battle_rewards.py +0 -284
- synth_ai/environments/examples/red/engine_helpers/reward_library/composite_rewards.py +0 -150
- synth_ai/environments/examples/red/engine_helpers/reward_library/economy_rewards.py +0 -138
- synth_ai/environments/examples/red/engine_helpers/reward_library/efficiency_rewards.py +0 -57
- synth_ai/environments/examples/red/engine_helpers/reward_library/exploration_rewards.py +0 -331
- synth_ai/environments/examples/red/engine_helpers/reward_library/novelty_rewards.py +0 -121
- synth_ai/environments/examples/red/engine_helpers/reward_library/pallet_town_rewards.py +0 -559
- synth_ai/environments/examples/red/engine_helpers/reward_library/pokemon_rewards.py +0 -313
- synth_ai/environments/examples/red/engine_helpers/reward_library/social_rewards.py +0 -148
- synth_ai/environments/examples/red/engine_helpers/reward_library/story_rewards.py +0 -247
- synth_ai/environments/examples/red/engine_helpers/screen_analysis.py +0 -368
- synth_ai/environments/examples/red/engine_helpers/state_extraction.py +0 -140
- synth_ai/environments/examples/red/environment.py +0 -238
- synth_ai/environments/examples/red/taskset.py +0 -79
- synth_ai/environments/examples/red/units/__init__.py +0 -1
- synth_ai/environments/examples/sokoban/__init__.py +0 -1
- synth_ai/environments/examples/sokoban/agent_demos/sokoban_full_eval.py +0 -899
- synth_ai/environments/examples/sokoban/engine.py +0 -678
- synth_ai/environments/examples/sokoban/engine_helpers/__init__.py +0 -1
- synth_ai/environments/examples/sokoban/engine_helpers/room_utils.py +0 -657
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/__init__.py +0 -18
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/__init__.py +0 -3
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/boxoban_env.py +0 -131
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/render_utils.py +0 -370
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/room_utils.py +0 -332
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env.py +0 -306
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_fixed_targets.py +0 -67
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_pull.py +0 -115
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_two_player.py +0 -123
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_variations.py +0 -394
- synth_ai/environments/examples/sokoban/environment.py +0 -229
- synth_ai/environments/examples/sokoban/generate_verified_puzzles.py +0 -440
- synth_ai/environments/examples/sokoban/puzzle_loader.py +0 -312
- synth_ai/environments/examples/sokoban/taskset.py +0 -428
- synth_ai/environments/examples/sokoban/units/astar_common.py +0 -95
- synth_ai/environments/examples/tictactoe/__init__.py +0 -1
- synth_ai/environments/examples/tictactoe/engine.py +0 -368
- synth_ai/environments/examples/tictactoe/environment.py +0 -240
- synth_ai/environments/examples/tictactoe/taskset.py +0 -215
- synth_ai/environments/examples/verilog/__init__.py +0 -10
- synth_ai/environments/examples/verilog/engine.py +0 -329
- synth_ai/environments/examples/verilog/environment.py +0 -350
- synth_ai/environments/examples/verilog/taskset.py +0 -420
- synth_ai/environments/examples/wordle/__init__.py +0 -29
- synth_ai/environments/examples/wordle/engine.py +0 -398
- synth_ai/environments/examples/wordle/environment.py +0 -159
- synth_ai/environments/examples/wordle/helpers/generate_instances_wordfreq.py +0 -75
- synth_ai/environments/examples/wordle/taskset.py +0 -230
- synth_ai/environments/reproducibility/core.py +0 -42
- synth_ai/environments/reproducibility/helpers.py +0 -0
- synth_ai/environments/reproducibility/tree.py +0 -364
- synth_ai/environments/service/app.py +0 -98
- synth_ai/environments/service/core_routes.py +0 -1020
- synth_ai/environments/service/external_registry.py +0 -56
- synth_ai/environments/service/registry.py +0 -9
- synth_ai/environments/stateful/__init__.py +0 -1
- synth_ai/environments/stateful/core.py +0 -163
- synth_ai/environments/stateful/engine.py +0 -21
- synth_ai/environments/stateful/state.py +0 -7
- synth_ai/environments/tasks/api.py +0 -19
- synth_ai/environments/tasks/core.py +0 -80
- synth_ai/environments/tasks/filters.py +0 -41
- synth_ai/environments/tasks/utils.py +0 -91
- synth_ai/environments/v0_observability/history.py +0 -3
- synth_ai/environments/v0_observability/log.py +0 -2
- synth_ai/evals/base.py +0 -15
- synth_ai/experimental/synth_oss.py +0 -446
- synth_ai/handshake.py +0 -63
- synth_ai/http.py +0 -26
- synth_ai/http_client.py +0 -104
- synth_ai/inference/client.py +0 -20
- synth_ai/install_sqld.sh +0 -40
- synth_ai/jobs/client.py +0 -246
- synth_ai/learning/__init__.py +0 -24
- synth_ai/learning/config.py +0 -43
- synth_ai/learning/filtering.py +0 -0
- synth_ai/learning/ft_client.py +0 -59
- 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/learning/sse.py +0 -58
- synth_ai/learning/validators.py +0 -48
- 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/__init__.py +0 -0
- 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/__init__.py +0 -0
- 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/__init__.py +0 -0
- synth_ai/lm/vendors/base.py +0 -81
- synth_ai/lm/vendors/core/__init__.py +0 -0
- 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/__init__.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/__init__.py +0 -0
- 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/task/__init__.py +0 -10
- synth_ai/task/contracts.py +0 -120
- synth_ai/task/health.py +0 -28
- synth_ai/task/validators.py +0 -12
- synth_ai/tracing/__init__.py +0 -30
- synth_ai/tracing_v1/__init__.py +0 -33
- synth_ai/tracing_v3/config.py +0 -84
- synth_ai/tracing_v3/storage/config.py +0 -62
- synth_ai/tracing_v3/turso/__init__.py +0 -25
- synth_ai/tracing_v3/turso/daemon.py +0 -144
- synth_ai/tracing_v3/turso/manager.py +0 -760
- synth_ai/v0/tracing/__init__.py +0 -0
- 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.dev2.dist-info/METADATA +0 -129
- synth_ai-0.2.8.dev2.dist-info/RECORD +0 -420
- /synth_ai/{demos → cli/demo_apps}/demo_task_apps/math/__init__.py +0 -0
- /synth_ai/{lm/caching → core/apps}/__init__.py +0 -0
- /synth_ai/{tracing_v3 → core/tracing_v3}/lm_call_record_abstractions.py +0 -0
- /synth_ai/{tracing_v3 → core/tracing_v3}/storage/__init__.py +0 -0
- /synth_ai/{tracing_v3 → core/tracing_v3}/storage/exceptions.py +0 -0
- /synth_ai/{tracing_v3 → core/tracing_v3}/storage/types.py +0 -0
- /synth_ai/{compound/cais.py → py.typed} +0 -0
- /synth_ai/{learning → sdk/learning}/core.py +0 -0
- /synth_ai/{learning → sdk/learning}/gateway.py +0 -0
- {synth_ai-0.2.8.dev2.dist-info → synth_ai-0.4.3.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.8.dev2.dist-info → synth_ai-0.4.3.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.2.8.dev2.dist-info → synth_ai-0.4.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
import click
|
|
7
|
+
|
|
8
|
+
from synth_ai.cli.lib.agents import write_agents_md
|
|
9
|
+
from synth_ai.cli.lib.bin import install_bin, verify_bin
|
|
10
|
+
from synth_ai.cli.lib.env import resolve_env_var
|
|
11
|
+
from synth_ai.core.env import get_backend_from_env
|
|
12
|
+
from synth_ai.core.paths import get_bin_path
|
|
13
|
+
from synth_ai.core.urls import BACKEND_URL_SYNTH_RESEARCH_OPENAI
|
|
14
|
+
from synth_ai.data.enums import SYNTH_MODEL_NAMES
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
import tomllib # Python 3.11+
|
|
18
|
+
except ImportError:
|
|
19
|
+
try:
|
|
20
|
+
import tomli as tomllib # type: ignore
|
|
21
|
+
except ImportError:
|
|
22
|
+
tomllib = None # type: ignore
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _load_session_config(config_path: Path | None = None) -> dict[str, Any]:
|
|
26
|
+
"""Load session configuration from TOML file.
|
|
27
|
+
|
|
28
|
+
Looks for [session] section with:
|
|
29
|
+
- limit_cost_usd: float (default: 20.0)
|
|
30
|
+
- limit_tokens: int | None
|
|
31
|
+
- limit_gpu_hours: float | None
|
|
32
|
+
|
|
33
|
+
Returns dict with session limits.
|
|
34
|
+
"""
|
|
35
|
+
if config_path is None:
|
|
36
|
+
# Look for codex.toml or synth.toml in current directory
|
|
37
|
+
for name in ["codex.toml", "synth.toml"]:
|
|
38
|
+
path = Path(name)
|
|
39
|
+
if path.exists():
|
|
40
|
+
config_path = path
|
|
41
|
+
break
|
|
42
|
+
|
|
43
|
+
if config_path is None or not config_path.exists():
|
|
44
|
+
# Default: $20 cost limit
|
|
45
|
+
return {"limit_cost_usd": 20.0}
|
|
46
|
+
|
|
47
|
+
if tomllib is None:
|
|
48
|
+
return {"limit_cost_usd": 20.0}
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
with config_path.open("rb") as f:
|
|
52
|
+
config = tomllib.load(f)
|
|
53
|
+
|
|
54
|
+
session_config = config.get("session", {})
|
|
55
|
+
result: dict[str, Any] = {}
|
|
56
|
+
|
|
57
|
+
# Default cost limit is $20 if not specified
|
|
58
|
+
result["limit_cost_usd"] = session_config.get("limit_cost_usd", 20.0)
|
|
59
|
+
|
|
60
|
+
if "limit_tokens" in session_config:
|
|
61
|
+
result["limit_tokens"] = session_config["limit_tokens"]
|
|
62
|
+
if "limit_gpu_hours" in session_config:
|
|
63
|
+
result["limit_gpu_hours"] = session_config["limit_gpu_hours"]
|
|
64
|
+
|
|
65
|
+
return result
|
|
66
|
+
except Exception as e:
|
|
67
|
+
click.echo(f"Warning: Failed to load session config from {config_path}: {e}", err=True)
|
|
68
|
+
return {"limit_cost_usd": 20.0}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@click.command("codex")
|
|
72
|
+
@click.option(
|
|
73
|
+
"--model",
|
|
74
|
+
"model_name",
|
|
75
|
+
type=str,
|
|
76
|
+
default=None
|
|
77
|
+
)
|
|
78
|
+
@click.option(
|
|
79
|
+
"--force",
|
|
80
|
+
is_flag=True,
|
|
81
|
+
help="Prompt for API keys even if cached values exist."
|
|
82
|
+
)
|
|
83
|
+
@click.option(
|
|
84
|
+
"--url",
|
|
85
|
+
"override_url",
|
|
86
|
+
type=str,
|
|
87
|
+
default=None,
|
|
88
|
+
)
|
|
89
|
+
@click.option(
|
|
90
|
+
"--wire-api",
|
|
91
|
+
"wire_api",
|
|
92
|
+
type=click.Choice(["chat", "responses"], case_sensitive=False),
|
|
93
|
+
default=None,
|
|
94
|
+
help="API wire format: 'chat' for Chat Completions, 'responses' for Responses API"
|
|
95
|
+
)
|
|
96
|
+
@click.option(
|
|
97
|
+
"--config",
|
|
98
|
+
"config_path",
|
|
99
|
+
type=click.Path(exists=True, path_type=Path),
|
|
100
|
+
default=None,
|
|
101
|
+
help="Path to TOML config file (default: codex.toml or synth.toml in current directory)"
|
|
102
|
+
)
|
|
103
|
+
def codex_cmd(
|
|
104
|
+
model_name: str | None = None,
|
|
105
|
+
force: bool = False,
|
|
106
|
+
override_url: str | None = None,
|
|
107
|
+
wire_api: str | None = None,
|
|
108
|
+
config_path: Path | None = None,
|
|
109
|
+
) -> None:
|
|
110
|
+
|
|
111
|
+
while True:
|
|
112
|
+
bin_path = get_bin_path("codex")
|
|
113
|
+
if bin_path:
|
|
114
|
+
break
|
|
115
|
+
if not install_bin(
|
|
116
|
+
"Codex",
|
|
117
|
+
[
|
|
118
|
+
"brew install codex",
|
|
119
|
+
"npm install -g @openai/codex"
|
|
120
|
+
]
|
|
121
|
+
):
|
|
122
|
+
print("Failed to find your installed Codex")
|
|
123
|
+
print("Please install from: https://developers.openai.com/codex/cli/")
|
|
124
|
+
return
|
|
125
|
+
print(f"Using Codex at {bin_path}")
|
|
126
|
+
|
|
127
|
+
if not verify_bin(bin_path):
|
|
128
|
+
print("Failed to verify Codex is runnable")
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
write_agents_md()
|
|
132
|
+
env = os.environ.copy()
|
|
133
|
+
override_args = []
|
|
134
|
+
|
|
135
|
+
# Load session config from TOML
|
|
136
|
+
session_config = _load_session_config(config_path)
|
|
137
|
+
session_limit_cost = session_config.get("limit_cost_usd")
|
|
138
|
+
session_limit_tokens = session_config.get("limit_tokens")
|
|
139
|
+
session_limit_gpu_hours = session_config.get("limit_gpu_hours")
|
|
140
|
+
|
|
141
|
+
# Get API key and base URL for session creation
|
|
142
|
+
api_key = resolve_env_var("SYNTH_API_KEY", override_process_env=force)
|
|
143
|
+
if override_url:
|
|
144
|
+
base_url = override_url.rstrip("/")
|
|
145
|
+
if base_url.endswith("/api"):
|
|
146
|
+
base_url = base_url[:-4]
|
|
147
|
+
else:
|
|
148
|
+
base_url, _ = get_backend_from_env()
|
|
149
|
+
|
|
150
|
+
# Create agent session with limits from config (default: $20 cost limit)
|
|
151
|
+
session_id: str | None = None
|
|
152
|
+
if session_limit_tokens or session_limit_cost or session_limit_gpu_hours:
|
|
153
|
+
try:
|
|
154
|
+
import asyncio
|
|
155
|
+
|
|
156
|
+
# Create session - org_id will be fetched from backend /me endpoint
|
|
157
|
+
async def create_session():
|
|
158
|
+
from synth_ai.cli.local.session import AgentSessionClient
|
|
159
|
+
|
|
160
|
+
client = AgentSessionClient(f"{base_url}/api", api_key)
|
|
161
|
+
|
|
162
|
+
limits = []
|
|
163
|
+
if session_limit_tokens:
|
|
164
|
+
limits.append({
|
|
165
|
+
"limit_type": "hard",
|
|
166
|
+
"metric_type": "tokens",
|
|
167
|
+
"limit_value": float(session_limit_tokens),
|
|
168
|
+
})
|
|
169
|
+
if session_limit_cost:
|
|
170
|
+
limits.append({
|
|
171
|
+
"limit_type": "hard",
|
|
172
|
+
"metric_type": "cost_usd",
|
|
173
|
+
"limit_value": float(session_limit_cost),
|
|
174
|
+
})
|
|
175
|
+
if session_limit_gpu_hours:
|
|
176
|
+
limits.append({
|
|
177
|
+
"limit_type": "hard",
|
|
178
|
+
"metric_type": "gpu_hours",
|
|
179
|
+
"limit_value": float(session_limit_gpu_hours),
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
# org_id will be automatically fetched from /api/v1/me endpoint
|
|
183
|
+
session = await client.create(
|
|
184
|
+
org_id=None, # Will be fetched from backend
|
|
185
|
+
limits=limits,
|
|
186
|
+
tracing_session_id=None,
|
|
187
|
+
session_type="codex_agent",
|
|
188
|
+
)
|
|
189
|
+
return session.session_id
|
|
190
|
+
|
|
191
|
+
session_id = asyncio.run(create_session())
|
|
192
|
+
env["SYNTH_SESSION_ID"] = session_id
|
|
193
|
+
# Note: Codex CLI doesn't directly support custom headers
|
|
194
|
+
# Users may need to configure Codex to pass X-Session-ID header
|
|
195
|
+
# For now, session is created but not automatically passed to API calls
|
|
196
|
+
click.echo(f"✓ Created agent session: {session_id}")
|
|
197
|
+
click.echo(" Note: Set X-Session-ID header in Codex config to use this session")
|
|
198
|
+
if session_limit_tokens:
|
|
199
|
+
click.echo(f" Token limit: {session_limit_tokens:,}")
|
|
200
|
+
if session_limit_cost:
|
|
201
|
+
click.echo(f" Cost limit: ${session_limit_cost:.2f}")
|
|
202
|
+
if session_limit_gpu_hours:
|
|
203
|
+
click.echo(f" GPU hours limit: {session_limit_gpu_hours:.2f}")
|
|
204
|
+
except Exception as e:
|
|
205
|
+
print(f"Warning: Failed to create agent session: {e}")
|
|
206
|
+
print("Continuing without session limits...")
|
|
207
|
+
|
|
208
|
+
if model_name is not None:
|
|
209
|
+
if model_name not in SYNTH_MODEL_NAMES:
|
|
210
|
+
raise ValueError(f"model_name={model_name} is invalid. Valid values for model_name: {SYNTH_MODEL_NAMES}")
|
|
211
|
+
if override_url:
|
|
212
|
+
url = override_url
|
|
213
|
+
print("Using override URL:", url)
|
|
214
|
+
else:
|
|
215
|
+
url = BACKEND_URL_SYNTH_RESEARCH_OPENAI
|
|
216
|
+
|
|
217
|
+
# Determine wire_api based on URL or explicit option
|
|
218
|
+
# If URL contains "/responses", default to responses API
|
|
219
|
+
# Otherwise, use explicit wire_api option or default to chat
|
|
220
|
+
if wire_api is None:
|
|
221
|
+
wire_api = "responses" if "/responses" in url or url.endswith("/responses") else "chat"
|
|
222
|
+
|
|
223
|
+
# Build provider config with wire_api
|
|
224
|
+
provider_config_parts = [
|
|
225
|
+
'name="Synth"',
|
|
226
|
+
f'base_url="{url}"',
|
|
227
|
+
'env_key="OPENAI_API_KEY"',
|
|
228
|
+
f'wire_api="{wire_api}"'
|
|
229
|
+
]
|
|
230
|
+
provider_config = "{" + ",".join(provider_config_parts) + "}"
|
|
231
|
+
|
|
232
|
+
config_overrides = [
|
|
233
|
+
f"model_providers.synth={provider_config}",
|
|
234
|
+
'model_provider="synth"',
|
|
235
|
+
f'default_model="{model_name}"'
|
|
236
|
+
]
|
|
237
|
+
override_args = [arg for override in config_overrides for arg in ("-c", override)]
|
|
238
|
+
env["OPENAI_API_KEY"] = resolve_env_var("SYNTH_API_KEY", override_process_env=force)
|
|
239
|
+
env["SYNTH_API_KEY"] = env["OPENAI_API_KEY"]
|
|
240
|
+
print(f"Configured with wire_api={wire_api}")
|
|
241
|
+
|
|
242
|
+
try:
|
|
243
|
+
cmd = ["codex"]
|
|
244
|
+
if model_name is not None:
|
|
245
|
+
cmd.extend(["-m", model_name])
|
|
246
|
+
cmd.extend(override_args)
|
|
247
|
+
print(" ".join(cmd))
|
|
248
|
+
subprocess.run(cmd, check=True, env=env)
|
|
249
|
+
except subprocess.CalledProcessError:
|
|
250
|
+
print("Failed to run Codex")
|
|
251
|
+
finally:
|
|
252
|
+
# End session if created
|
|
253
|
+
if session_id is not None:
|
|
254
|
+
try:
|
|
255
|
+
# Assign to local variable to help type checker
|
|
256
|
+
final_session_id: str = session_id
|
|
257
|
+
async def end_session():
|
|
258
|
+
from synth_ai.cli.local.session import AgentSessionClient
|
|
259
|
+
client = AgentSessionClient(f"{base_url}/api", api_key)
|
|
260
|
+
await client.end(final_session_id)
|
|
261
|
+
click.echo(f"✓ Ended agent session: {final_session_id}")
|
|
262
|
+
|
|
263
|
+
asyncio.run(end_session())
|
|
264
|
+
except Exception as e:
|
|
265
|
+
click.echo(f"Warning: Failed to end agent session: {e}", err=True)
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from synth_ai.cli.lib.agents import write_agents_md
|
|
8
|
+
from synth_ai.cli.lib.bin import install_bin, verify_bin
|
|
9
|
+
from synth_ai.cli.lib.env import resolve_env_var
|
|
10
|
+
from synth_ai.core.env import get_backend_from_env
|
|
11
|
+
from synth_ai.core.json import create_and_write_json, load_json_to_dict
|
|
12
|
+
from synth_ai.core.paths import get_bin_path
|
|
13
|
+
from synth_ai.core.urls import BACKEND_URL_SYNTH_RESEARCH_BASE
|
|
14
|
+
from synth_ai.data.enums import SYNTH_MODEL_NAMES
|
|
15
|
+
|
|
16
|
+
CONFIG_PATH = Path.home() / ".config" / "opencode" / "opencode.json"
|
|
17
|
+
AUTH_PATH = Path.home() / ".local" / "share" / "opencode" / "auth.json"
|
|
18
|
+
SYNTH_PROVIDER_ID = "synth"
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
import tomllib # Python 3.11+
|
|
22
|
+
except ImportError:
|
|
23
|
+
try:
|
|
24
|
+
import tomli as tomllib # type: ignore
|
|
25
|
+
except ImportError:
|
|
26
|
+
tomllib = None # type: ignore
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _load_session_config(config_path: Path | None = None) -> dict[str, Any]:
|
|
30
|
+
"""Load session configuration from TOML file.
|
|
31
|
+
|
|
32
|
+
Looks for [session] section with:
|
|
33
|
+
- limit_cost_usd: float (default: 20.0)
|
|
34
|
+
- limit_tokens: int | None
|
|
35
|
+
- limit_gpu_hours: float | None
|
|
36
|
+
|
|
37
|
+
Returns dict with session limits.
|
|
38
|
+
"""
|
|
39
|
+
if config_path is None:
|
|
40
|
+
# Look for opencode.toml or synth.toml in current directory
|
|
41
|
+
for name in ["opencode.toml", "synth.toml"]:
|
|
42
|
+
path = Path(name)
|
|
43
|
+
if path.exists():
|
|
44
|
+
config_path = path
|
|
45
|
+
break
|
|
46
|
+
|
|
47
|
+
if config_path is None or not config_path.exists():
|
|
48
|
+
# Default: $20 cost limit
|
|
49
|
+
return {"limit_cost_usd": 20.0}
|
|
50
|
+
|
|
51
|
+
if tomllib is None:
|
|
52
|
+
return {"limit_cost_usd": 20.0}
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
with config_path.open("rb") as f:
|
|
56
|
+
config = tomllib.load(f)
|
|
57
|
+
|
|
58
|
+
session_config = config.get("session", {})
|
|
59
|
+
result: dict[str, Any] = {}
|
|
60
|
+
|
|
61
|
+
# Default cost limit is $20 if not specified
|
|
62
|
+
result["limit_cost_usd"] = session_config.get("limit_cost_usd", 20.0)
|
|
63
|
+
|
|
64
|
+
if "limit_tokens" in session_config:
|
|
65
|
+
result["limit_tokens"] = session_config["limit_tokens"]
|
|
66
|
+
if "limit_gpu_hours" in session_config:
|
|
67
|
+
result["limit_gpu_hours"] = session_config["limit_gpu_hours"]
|
|
68
|
+
|
|
69
|
+
return result
|
|
70
|
+
except Exception as e:
|
|
71
|
+
click.echo(f"Warning: Failed to load session config from {config_path}: {e}", err=True)
|
|
72
|
+
return {"limit_cost_usd": 20.0}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@click.command("opencode")
|
|
76
|
+
@click.option(
|
|
77
|
+
"--model",
|
|
78
|
+
"model_name",
|
|
79
|
+
type=str,
|
|
80
|
+
default=None
|
|
81
|
+
)
|
|
82
|
+
@click.option(
|
|
83
|
+
"--force",
|
|
84
|
+
is_flag=True,
|
|
85
|
+
help="Prompt for API keys even if cached values exist."
|
|
86
|
+
)
|
|
87
|
+
@click.option(
|
|
88
|
+
"--url",
|
|
89
|
+
"override_url",
|
|
90
|
+
type=str,
|
|
91
|
+
default=None,
|
|
92
|
+
)
|
|
93
|
+
@click.option(
|
|
94
|
+
"--config",
|
|
95
|
+
"config_path",
|
|
96
|
+
type=click.Path(exists=True, path_type=Path),
|
|
97
|
+
default=None,
|
|
98
|
+
help="Path to TOML config file (default: opencode.toml or synth.toml in current directory)"
|
|
99
|
+
)
|
|
100
|
+
def opencode_cmd(
|
|
101
|
+
model_name: str | None = None,
|
|
102
|
+
force: bool = False,
|
|
103
|
+
override_url: str | None = None,
|
|
104
|
+
config_path: Path | None = None,
|
|
105
|
+
) -> None:
|
|
106
|
+
|
|
107
|
+
while True:
|
|
108
|
+
bin_path = get_bin_path("opencode")
|
|
109
|
+
if bin_path:
|
|
110
|
+
break
|
|
111
|
+
if not install_bin(
|
|
112
|
+
"OpenCode",
|
|
113
|
+
[
|
|
114
|
+
"brew install opencode",
|
|
115
|
+
"bun add -g opencode-ai",
|
|
116
|
+
"curl -fsSL https://opencode.ai/install | bash",
|
|
117
|
+
"npm i -g opencode-ai",
|
|
118
|
+
"paru -S opencode"
|
|
119
|
+
]
|
|
120
|
+
):
|
|
121
|
+
print("Failed to find your installed OpenCode")
|
|
122
|
+
print("Please install from: https://opencode.ai")
|
|
123
|
+
return
|
|
124
|
+
print(f"Using OpenCode at {bin_path}")
|
|
125
|
+
|
|
126
|
+
if not verify_bin(bin_path):
|
|
127
|
+
print("Failed to verify OpenCode is runnable")
|
|
128
|
+
return
|
|
129
|
+
|
|
130
|
+
write_agents_md()
|
|
131
|
+
|
|
132
|
+
# Load session config from TOML
|
|
133
|
+
session_config = _load_session_config(config_path)
|
|
134
|
+
session_limit_cost = session_config.get("limit_cost_usd")
|
|
135
|
+
session_limit_tokens = session_config.get("limit_tokens")
|
|
136
|
+
session_limit_gpu_hours = session_config.get("limit_gpu_hours")
|
|
137
|
+
|
|
138
|
+
# Get API key and base URL for session creation
|
|
139
|
+
synth_api_key = resolve_env_var("SYNTH_API_KEY", override_process_env=force)
|
|
140
|
+
if override_url:
|
|
141
|
+
base_url = override_url.rstrip("/")
|
|
142
|
+
if base_url.endswith("/api"):
|
|
143
|
+
base_url = base_url[:-4]
|
|
144
|
+
else:
|
|
145
|
+
base_url, _ = get_backend_from_env()
|
|
146
|
+
|
|
147
|
+
# Create agent session with limits from config (default: $20 cost limit)
|
|
148
|
+
session_id: str | None = None
|
|
149
|
+
if session_limit_tokens or session_limit_cost or session_limit_gpu_hours:
|
|
150
|
+
try:
|
|
151
|
+
import asyncio
|
|
152
|
+
|
|
153
|
+
# Create session - org_id will be fetched from backend /me endpoint
|
|
154
|
+
async def create_session():
|
|
155
|
+
from synth_ai.cli.local.session import AgentSessionClient
|
|
156
|
+
|
|
157
|
+
client = AgentSessionClient(f"{base_url}/api", synth_api_key)
|
|
158
|
+
|
|
159
|
+
limits = []
|
|
160
|
+
if session_limit_tokens:
|
|
161
|
+
limits.append({
|
|
162
|
+
"limit_type": "hard",
|
|
163
|
+
"metric_type": "tokens",
|
|
164
|
+
"limit_value": float(session_limit_tokens),
|
|
165
|
+
})
|
|
166
|
+
if session_limit_cost:
|
|
167
|
+
limits.append({
|
|
168
|
+
"limit_type": "hard",
|
|
169
|
+
"metric_type": "cost_usd",
|
|
170
|
+
"limit_value": float(session_limit_cost),
|
|
171
|
+
})
|
|
172
|
+
if session_limit_gpu_hours:
|
|
173
|
+
limits.append({
|
|
174
|
+
"limit_type": "hard",
|
|
175
|
+
"metric_type": "gpu_hours",
|
|
176
|
+
"limit_value": float(session_limit_gpu_hours),
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
# org_id will be automatically fetched from /api/v1/me endpoint
|
|
180
|
+
session = await client.create(
|
|
181
|
+
org_id=None, # Will be fetched from backend
|
|
182
|
+
limits=limits,
|
|
183
|
+
tracing_session_id=None,
|
|
184
|
+
session_type="opencode_agent",
|
|
185
|
+
)
|
|
186
|
+
return session.session_id
|
|
187
|
+
|
|
188
|
+
session_id = asyncio.run(create_session())
|
|
189
|
+
click.echo(f"✓ Created agent session: {session_id}")
|
|
190
|
+
if session_limit_tokens:
|
|
191
|
+
click.echo(f" Token limit: {session_limit_tokens:,}")
|
|
192
|
+
if session_limit_cost:
|
|
193
|
+
click.echo(f" Cost limit: ${session_limit_cost:.2f}")
|
|
194
|
+
if session_limit_gpu_hours:
|
|
195
|
+
click.echo(f" GPU hours limit: {session_limit_gpu_hours:.2f}")
|
|
196
|
+
except Exception as e:
|
|
197
|
+
click.echo(f"Warning: Failed to create agent session: {e}", err=True)
|
|
198
|
+
click.echo("Continuing without session limits...", err=True)
|
|
199
|
+
|
|
200
|
+
if model_name is not None:
|
|
201
|
+
if model_name not in SYNTH_MODEL_NAMES:
|
|
202
|
+
raise ValueError(
|
|
203
|
+
f"model_name={model_name} is invalid. Valid values for model_name: {SYNTH_MODEL_NAMES}"
|
|
204
|
+
)
|
|
205
|
+
synth_api_key = resolve_env_var("SYNTH_API_KEY", override_process_env=force)
|
|
206
|
+
data = load_json_to_dict(AUTH_PATH)
|
|
207
|
+
good_entry = {
|
|
208
|
+
"type": "api",
|
|
209
|
+
"key": synth_api_key,
|
|
210
|
+
}
|
|
211
|
+
if data.get(SYNTH_PROVIDER_ID) != good_entry:
|
|
212
|
+
data[SYNTH_PROVIDER_ID] = good_entry
|
|
213
|
+
create_and_write_json(AUTH_PATH, data)
|
|
214
|
+
config = load_json_to_dict(CONFIG_PATH)
|
|
215
|
+
config.setdefault("$schema", "https://opencode.ai/config.json")
|
|
216
|
+
if override_url:
|
|
217
|
+
url = override_url
|
|
218
|
+
print("Using override URL:", url)
|
|
219
|
+
else:
|
|
220
|
+
url = BACKEND_URL_SYNTH_RESEARCH_BASE
|
|
221
|
+
provider_section = config.setdefault("provider", {})
|
|
222
|
+
synth_provider = provider_section.setdefault(SYNTH_PROVIDER_ID, {})
|
|
223
|
+
synth_provider["npm"] = "@ai-sdk/openai-compatible"
|
|
224
|
+
synth_provider.setdefault("name", "Synth")
|
|
225
|
+
models = synth_provider.setdefault("models", {})
|
|
226
|
+
models.setdefault(model_name, {})
|
|
227
|
+
options = synth_provider.setdefault("options", {})
|
|
228
|
+
options["baseURL"] = url
|
|
229
|
+
full_model_name = f"{SYNTH_PROVIDER_ID}/{model_name}"
|
|
230
|
+
config["model"] = full_model_name
|
|
231
|
+
create_and_write_json(CONFIG_PATH, config)
|
|
232
|
+
|
|
233
|
+
try:
|
|
234
|
+
subprocess.run([str(bin_path)], check=True)
|
|
235
|
+
except subprocess.CalledProcessError:
|
|
236
|
+
print("Failed to launch OpenCode")
|
|
237
|
+
finally:
|
|
238
|
+
# End session if created
|
|
239
|
+
if session_id is not None:
|
|
240
|
+
try:
|
|
241
|
+
# Assign to local variable to help type checker
|
|
242
|
+
final_session_id: str = session_id
|
|
243
|
+
import asyncio
|
|
244
|
+
|
|
245
|
+
async def end_session():
|
|
246
|
+
from synth_ai.cli.local.session import AgentSessionClient
|
|
247
|
+
client = AgentSessionClient(f"{base_url}/api", synth_api_key)
|
|
248
|
+
await client.end(final_session_id)
|
|
249
|
+
click.echo(f"✓ Ended agent session: {final_session_id}")
|
|
250
|
+
|
|
251
|
+
asyncio.run(end_session())
|
|
252
|
+
except Exception as e:
|
|
253
|
+
click.echo(f"Warning: Failed to end agent session: {e}", err=True)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Structured CLI command implementations.
|
|
3
|
+
|
|
4
|
+
Each subpackage under this namespace provides the core command entrypoints,
|
|
5
|
+
validation helpers, and error types for a top-level CLI command (e.g. train,
|
|
6
|
+
eval, deploy).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"train",
|
|
13
|
+
"eval",
|
|
14
|
+
"filter",
|
|
15
|
+
"deploy",
|
|
16
|
+
"status",
|
|
17
|
+
"smoke",
|
|
18
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Artifacts CLI commands for managing models and prompts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def register(cli: click.Group) -> None:
|
|
9
|
+
"""Register artifacts commands with the main CLI."""
|
|
10
|
+
from .core import artifacts_group
|
|
11
|
+
|
|
12
|
+
cli.add_command(artifacts_group, name="artifacts")
|
|
13
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""HTTP client for artifacts API endpoints."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
from typing import Any, Dict, List, Optional
|
|
7
|
+
|
|
8
|
+
from synth_ai.core._utils.http import AsyncHttpClient
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ArtifactsClient:
|
|
14
|
+
"""Client for artifacts API endpoints.
|
|
15
|
+
|
|
16
|
+
Provides methods to interact with the Synth AI artifacts API, including
|
|
17
|
+
listing artifacts, retrieving model and prompt details, exporting models
|
|
18
|
+
to HuggingFace, and accessing prompt snapshots.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, base_url: str, api_key: str, *, timeout: float = 30.0) -> None:
|
|
22
|
+
"""Initialize the artifacts client.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
base_url: Base URL of the backend API (e.g., "https://api.usesynth.ai")
|
|
26
|
+
api_key: API key for authentication
|
|
27
|
+
timeout: Request timeout in seconds (default: 30.0)
|
|
28
|
+
"""
|
|
29
|
+
self._base_url = base_url.rstrip("/")
|
|
30
|
+
self._api_key = api_key
|
|
31
|
+
self._timeout = timeout
|
|
32
|
+
|
|
33
|
+
async def list_artifacts(
|
|
34
|
+
self,
|
|
35
|
+
*,
|
|
36
|
+
artifact_type: Optional[str] = None,
|
|
37
|
+
status: Optional[str] = None,
|
|
38
|
+
limit: int = 50,
|
|
39
|
+
) -> Dict[str, Any]:
|
|
40
|
+
"""List all artifacts (models and prompts)."""
|
|
41
|
+
params: Dict[str, Any] = {"limit": limit}
|
|
42
|
+
if artifact_type:
|
|
43
|
+
params["type"] = artifact_type
|
|
44
|
+
if status:
|
|
45
|
+
params["status"] = status
|
|
46
|
+
|
|
47
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
48
|
+
return await http.get("/api/artifacts", params=params)
|
|
49
|
+
|
|
50
|
+
async def get_model(self, model_id: str) -> Dict[str, Any]:
|
|
51
|
+
"""Get detailed information about a model artifact."""
|
|
52
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
53
|
+
return await http.get(f"/api/artifacts/models/{model_id}")
|
|
54
|
+
|
|
55
|
+
async def get_prompt(self, job_id: str) -> Dict[str, Any]:
|
|
56
|
+
"""Get detailed information about a prompt optimization job."""
|
|
57
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
58
|
+
return await http.get(f"/api/artifacts/prompts/{job_id}")
|
|
59
|
+
|
|
60
|
+
async def export_to_huggingface(
|
|
61
|
+
self,
|
|
62
|
+
*,
|
|
63
|
+
wasabi_key: str,
|
|
64
|
+
repo_id: str,
|
|
65
|
+
repo_type: str = "model",
|
|
66
|
+
artifact_kind: str = "lora",
|
|
67
|
+
base_model: Optional[str] = None,
|
|
68
|
+
visibility: str = "private",
|
|
69
|
+
tags: Optional[List[str]] = None,
|
|
70
|
+
bucket: Optional[str] = None,
|
|
71
|
+
folder_name: Optional[str] = None,
|
|
72
|
+
) -> Dict[str, Any]:
|
|
73
|
+
"""Export a model artifact to HuggingFace Hub."""
|
|
74
|
+
body: Dict[str, Any] = {
|
|
75
|
+
"repo_id": repo_id,
|
|
76
|
+
"repo_type": repo_type,
|
|
77
|
+
"artifact_kind": artifact_kind,
|
|
78
|
+
"key": wasabi_key,
|
|
79
|
+
"visibility": visibility,
|
|
80
|
+
}
|
|
81
|
+
if base_model:
|
|
82
|
+
body["base_model"] = base_model
|
|
83
|
+
if tags:
|
|
84
|
+
body["tags"] = tags
|
|
85
|
+
if bucket:
|
|
86
|
+
body["bucket"] = bucket
|
|
87
|
+
if folder_name:
|
|
88
|
+
body["folder_name"] = folder_name
|
|
89
|
+
|
|
90
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
91
|
+
return await http.post_json("/api/learning/exports/hf", json=body)
|
|
92
|
+
|
|
93
|
+
async def get_prompt_snapshot(
|
|
94
|
+
self,
|
|
95
|
+
job_id: str,
|
|
96
|
+
snapshot_id: str,
|
|
97
|
+
) -> Dict[str, Any]:
|
|
98
|
+
"""Get a specific prompt snapshot."""
|
|
99
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
100
|
+
return await http.get(f"/api/prompt-learning/online/jobs/{job_id}/snapshots/{snapshot_id}")
|
|
101
|
+
|
|
102
|
+
async def list_prompt_snapshots(
|
|
103
|
+
self,
|
|
104
|
+
job_id: str,
|
|
105
|
+
) -> List[Dict[str, Any]]:
|
|
106
|
+
"""List all artifacts (snapshots) for a prompt job."""
|
|
107
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
108
|
+
artifacts = await http.get(f"/api/prompt-learning/online/jobs/{job_id}/artifacts")
|
|
109
|
+
if isinstance(artifacts, list):
|
|
110
|
+
return artifacts
|
|
111
|
+
if isinstance(artifacts, dict) and isinstance(artifacts.get("artifacts"), list):
|
|
112
|
+
return artifacts["artifacts"]
|
|
113
|
+
return []
|
|
114
|
+
|
|
115
|
+
async def get_models_on_wasabi(self) -> Dict[str, Any]:
|
|
116
|
+
"""Get models available on Wasabi."""
|
|
117
|
+
async with AsyncHttpClient(self._base_url, self._api_key, timeout=self._timeout) as http:
|
|
118
|
+
return await http.get("/api/learning/models/on-wasabi")
|
|
119
|
+
|