synth-ai 0.2.9.dev5__py3-none-any.whl → 0.2.9.dev7__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.
Potentially problematic release.
This version of synth-ai might be problematic. Click here for more details.
- examples/common_old/backend.py +0 -1
- examples/crafter_debug_render.py +15 -6
- examples/evals_old/compare_models.py +1 -0
- examples/finetuning_old/_backup_synth_qwen/filter_traces_achievements.py +6 -2
- examples/finetuning_old/_backup_synth_qwen/react_agent_lm.py +4 -4
- examples/finetuning_old/_backup_synth_qwen/sft_kickoff.py +4 -3
- examples/finetuning_old/synth_qwen_v1/filter_traces_achievements.py +6 -2
- examples/finetuning_old/synth_qwen_v1/finetune.py +1 -1
- examples/finetuning_old/synth_qwen_v1/hello_ft_model.py +4 -4
- examples/finetuning_old/synth_qwen_v1/infer.py +1 -2
- examples/finetuning_old/synth_qwen_v1/poll.py +4 -2
- examples/finetuning_old/synth_qwen_v1/prepare_data.py +8 -8
- examples/finetuning_old/synth_qwen_v1/react_agent_lm.py +5 -4
- examples/finetuning_old/synth_qwen_v1/run_crafter_sft_job.py +11 -8
- examples/finetuning_old/synth_qwen_v1/run_ft_job.py +17 -12
- examples/finetuning_old/synth_qwen_v1/upload_data.py +1 -1
- examples/finetuning_old/synth_qwen_v1/util.py +7 -2
- examples/rl/configs/eval_base_qwen.toml +1 -1
- examples/rl/configs/rl_from_base_qwen17.toml +1 -1
- examples/rl/download_dataset.py +26 -10
- examples/rl/run_eval.py +17 -15
- examples/rl/run_rl_and_save.py +24 -7
- examples/rl/task_app/math_single_step.py +128 -11
- examples/rl/task_app/math_task_app.py +11 -3
- examples/rl_old/task_app.py +222 -53
- examples/warming_up_to_rl/analyze_trace_db.py +7 -5
- examples/warming_up_to_rl/export_trace_sft.py +141 -16
- examples/warming_up_to_rl/groq_test.py +11 -4
- examples/warming_up_to_rl/manage_secrets.py +15 -6
- examples/warming_up_to_rl/readme.md +9 -2
- examples/warming_up_to_rl/run_eval.py +108 -30
- examples/warming_up_to_rl/run_fft_and_save.py +128 -52
- examples/warming_up_to_rl/run_local_rollout.py +87 -36
- examples/warming_up_to_rl/run_local_rollout_modal.py +113 -25
- examples/warming_up_to_rl/run_local_rollout_parallel.py +80 -16
- examples/warming_up_to_rl/run_local_rollout_traced.py +125 -20
- examples/warming_up_to_rl/run_rl_and_save.py +31 -7
- examples/warming_up_to_rl/run_rollout_remote.py +37 -10
- examples/warming_up_to_rl/task_app/grpo_crafter.py +90 -27
- examples/warming_up_to_rl/task_app/grpo_crafter_task_app.py +9 -27
- examples/warming_up_to_rl/task_app/synth_envs_hosted/environment_routes.py +46 -108
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/app.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/environment.py +50 -17
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/policy.py +35 -21
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/react_agent.py +8 -4
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/shared.py +29 -26
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/tools.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/hosted_app.py +17 -13
- examples/warming_up_to_rl/task_app/synth_envs_hosted/inference/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/inference/openai_client.py +106 -63
- examples/warming_up_to_rl/task_app/synth_envs_hosted/policy_routes.py +82 -84
- examples/warming_up_to_rl/task_app/synth_envs_hosted/rollout.py +76 -59
- examples/warming_up_to_rl/task_app/synth_envs_hosted/storage/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/storage/volume.py +43 -49
- examples/warming_up_to_rl/task_app/synth_envs_hosted/test_service.py +5 -15
- synth_ai/__init__.py +1 -0
- synth_ai/api/train/builders.py +34 -10
- synth_ai/api/train/cli.py +172 -32
- synth_ai/api/train/config_finder.py +59 -4
- synth_ai/api/train/env_resolver.py +32 -14
- synth_ai/api/train/pollers.py +11 -3
- synth_ai/api/train/task_app.py +4 -1
- synth_ai/api/train/utils.py +20 -4
- synth_ai/cli/__init__.py +11 -4
- synth_ai/cli/balance.py +1 -1
- synth_ai/cli/demo.py +19 -5
- synth_ai/cli/rl_demo.py +75 -16
- synth_ai/cli/root.py +116 -37
- synth_ai/cli/task_apps.py +1276 -186
- synth_ai/cli/traces.py +1 -0
- synth_ai/cli/turso.py +73 -0
- synth_ai/core/experiment.py +0 -2
- synth_ai/demo_registry.py +67 -30
- synth_ai/demos/core/cli.py +493 -164
- synth_ai/demos/demo_task_apps/core.py +50 -6
- synth_ai/demos/demo_task_apps/crafter/configs/crafter_fft_4b.toml +2 -3
- synth_ai/demos/demo_task_apps/crafter/grpo_crafter_task_app.py +36 -28
- synth_ai/demos/demo_task_apps/math/_common.py +1 -2
- synth_ai/demos/demo_task_apps/math/deploy_modal.py +0 -2
- synth_ai/demos/demo_task_apps/math/modal_task_app.py +168 -65
- synth_ai/demos/demo_task_apps/math/task_app_entry.py +0 -1
- synth_ai/environments/examples/bandit/engine.py +12 -4
- synth_ai/environments/examples/bandit/taskset.py +4 -4
- synth_ai/environments/reproducibility/tree.py +3 -1
- synth_ai/environments/service/core_routes.py +6 -2
- synth_ai/evals/base.py +0 -2
- synth_ai/experimental/synth_oss.py +11 -12
- synth_ai/handshake.py +3 -1
- synth_ai/http_client.py +31 -7
- synth_ai/inference/__init__.py +0 -2
- synth_ai/inference/client.py +8 -4
- synth_ai/jobs/client.py +40 -10
- synth_ai/learning/client.py +33 -8
- synth_ai/learning/config.py +0 -2
- synth_ai/learning/constants.py +0 -2
- synth_ai/learning/ft_client.py +6 -3
- synth_ai/learning/health.py +9 -2
- synth_ai/learning/jobs.py +17 -5
- synth_ai/learning/prompts/hello_world_in_context_injection_ex.py +1 -3
- synth_ai/learning/prompts/random_search.py +4 -1
- synth_ai/learning/prompts/run_random_search_banking77.py +6 -1
- synth_ai/learning/rl_client.py +42 -14
- synth_ai/learning/sse.py +0 -2
- synth_ai/learning/validators.py +6 -2
- synth_ai/lm/caching/ephemeral.py +1 -3
- synth_ai/lm/core/exceptions.py +0 -2
- synth_ai/lm/core/main.py +13 -1
- synth_ai/lm/core/synth_models.py +0 -1
- synth_ai/lm/core/vendor_clients.py +4 -2
- synth_ai/lm/overrides.py +2 -2
- synth_ai/lm/vendors/core/anthropic_api.py +7 -7
- synth_ai/lm/vendors/core/openai_api.py +2 -0
- synth_ai/lm/vendors/openai_standard.py +3 -1
- synth_ai/lm/vendors/openai_standard_responses.py +6 -3
- synth_ai/lm/vendors/supported/custom_endpoint.py +1 -3
- synth_ai/lm/vendors/synth_client.py +37 -10
- synth_ai/rl/__init__.py +0 -1
- synth_ai/rl/contracts.py +0 -2
- synth_ai/rl/env_keys.py +6 -1
- synth_ai/task/__init__.py +1 -0
- synth_ai/task/apps/__init__.py +11 -11
- synth_ai/task/auth.py +29 -17
- synth_ai/task/client.py +3 -1
- synth_ai/task/contracts.py +1 -0
- synth_ai/task/datasets.py +3 -1
- synth_ai/task/errors.py +3 -2
- synth_ai/task/health.py +0 -2
- synth_ai/task/json.py +0 -1
- synth_ai/task/proxy.py +2 -5
- synth_ai/task/rubrics.py +9 -3
- synth_ai/task/server.py +31 -5
- synth_ai/task/tracing_utils.py +8 -3
- synth_ai/task/validators.py +0 -1
- synth_ai/task/vendors.py +0 -1
- synth_ai/tracing_v3/db_config.py +26 -1
- synth_ai/tracing_v3/decorators.py +1 -0
- synth_ai/tracing_v3/examples/basic_usage.py +3 -2
- synth_ai/tracing_v3/hooks.py +2 -0
- synth_ai/tracing_v3/replica_sync.py +1 -0
- synth_ai/tracing_v3/session_tracer.py +24 -3
- synth_ai/tracing_v3/storage/base.py +4 -1
- synth_ai/tracing_v3/storage/factory.py +0 -1
- synth_ai/tracing_v3/turso/manager.py +102 -38
- synth_ai/tracing_v3/turso/models.py +4 -1
- synth_ai/tracing_v3/utils.py +1 -0
- synth_ai/v0/tracing/upload.py +32 -135
- {synth_ai-0.2.9.dev5.dist-info → synth_ai-0.2.9.dev7.dist-info}/METADATA +1 -1
- {synth_ai-0.2.9.dev5.dist-info → synth_ai-0.2.9.dev7.dist-info}/RECORD +154 -154
- synth_ai/install_sqld.sh +0 -40
- {synth_ai-0.2.9.dev5.dist-info → synth_ai-0.2.9.dev7.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.9.dev5.dist-info → synth_ai-0.2.9.dev7.dist-info}/entry_points.txt +0 -0
- {synth_ai-0.2.9.dev5.dist-info → synth_ai-0.2.9.dev7.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.2.9.dev5.dist-info → synth_ai-0.2.9.dev7.dist-info}/top_level.txt +0 -0
synth_ai/v0/tracing/upload.py
CHANGED
|
@@ -373,140 +373,37 @@ def upload_helper(
|
|
|
373
373
|
raise ValueError("SYNTH_API_KEY environment variable not set")
|
|
374
374
|
base_url = os.getenv("SYNTH_ENDPOINT_OVERRIDE", PROD_BASE_URL_DEFAULT)
|
|
375
375
|
|
|
376
|
-
"""Legacy block below retained for reference and disabled for linting/parsing.
|
|
377
|
-
Start disabled block.
|
|
378
|
-
"""
|
|
379
|
-
"""
|
|
380
|
-
from .decorators import _local, active_events_var
|
|
381
|
-
from .trackers import synth_tracker_async, synth_tracker_sync
|
|
382
|
-
|
|
383
|
-
# First close any tracker events
|
|
384
|
-
if hasattr(synth_tracker_async, "active_events"):
|
|
385
|
-
for event_type, event in list(synth_tracker_async.active_events.items()):
|
|
386
|
-
if event and event.closed is None:
|
|
387
|
-
event.closed = time.time()
|
|
388
|
-
try:
|
|
389
|
-
event_store.add_event(
|
|
390
|
-
event.system_name,
|
|
391
|
-
event.system_id,
|
|
392
|
-
event.system_instance_id,
|
|
393
|
-
event,
|
|
394
|
-
)
|
|
395
|
-
if verbose:
|
|
396
|
-
print(f"Closed and stored tracker async event: {event_type}")
|
|
397
|
-
except Exception as e:
|
|
398
|
-
logging.error(f"Failed to store tracker event {event_type}: {str(e)}")
|
|
399
|
-
synth_tracker_async.active_events.clear()
|
|
400
|
-
|
|
401
|
-
# End all active events before uploading
|
|
402
|
-
if hasattr(_local, "active_events"):
|
|
403
|
-
for event_type, event in _local.active_events.items():
|
|
404
|
-
if event and event.closed is None:
|
|
405
|
-
event.closed = time.time()
|
|
406
|
-
if hasattr(_local, "system_instance_id"):
|
|
407
|
-
try:
|
|
408
|
-
event_store.add_event(
|
|
409
|
-
_local.system_name,
|
|
410
|
-
_local.system_id,
|
|
411
|
-
_local.system_instance_id,
|
|
412
|
-
event,
|
|
413
|
-
)
|
|
414
|
-
if verbose:
|
|
415
|
-
print(f"Closed and stored active event: {event_type}")
|
|
416
|
-
except Exception as e:
|
|
417
|
-
logging.error(f"Failed to store event {event_type}: {str(e)}")
|
|
418
|
-
_local.active_events.clear()
|
|
419
|
-
|
|
420
|
-
# NEW: Close all open asynchronous events
|
|
421
|
-
active_events_async = active_events_var.get()
|
|
422
|
-
if active_events_async:
|
|
423
|
-
current_time = time.time()
|
|
424
|
-
for event_type, event in list(active_events_async.items()):
|
|
425
|
-
if event and event.closed is None:
|
|
426
|
-
event.closed = current_time
|
|
427
|
-
try:
|
|
428
|
-
event_store.add_event(
|
|
429
|
-
event.system_name,
|
|
430
|
-
event.system_id,
|
|
431
|
-
event.system_instance_id,
|
|
432
|
-
event,
|
|
433
|
-
)
|
|
434
|
-
if verbose:
|
|
435
|
-
print(f"Closed and stored async event: {event_type}")
|
|
436
|
-
except Exception as e:
|
|
437
|
-
logging.error(f"Failed to store async event {event_type}: {str(e)}")
|
|
438
|
-
active_events_var.set({})
|
|
439
|
-
|
|
440
|
-
# Also close any unclosed events in existing traces
|
|
441
376
|
logged_traces = event_store.get_system_traces()
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
traces_dict = [trace.to_dict() for trace in traces]
|
|
464
|
-
dataset_dict = dataset.to_dict()
|
|
465
|
-
|
|
466
|
-
# Validate upload format
|
|
467
|
-
if verbose:
|
|
468
|
-
print("Validating upload format...")
|
|
469
|
-
validate_upload(traces_dict, dataset_dict)
|
|
470
|
-
if verbose:
|
|
471
|
-
print("Upload format validation successful")
|
|
472
|
-
|
|
473
|
-
# Send to server
|
|
474
|
-
upload_id, signed_url = send_system_traces_s3(
|
|
475
|
-
dataset=dataset,
|
|
476
|
-
traces=traces,
|
|
477
|
-
base_url=base_url,
|
|
478
|
-
api_key=api_key,
|
|
479
|
-
system_id=traces[0].system_id,
|
|
480
|
-
system_name=traces[0].system_name,
|
|
481
|
-
verbose=verbose,
|
|
482
|
-
)
|
|
483
|
-
|
|
484
|
-
questions_json, reward_signals_json, traces_json = format_upload_output(dataset, traces)
|
|
485
|
-
return (
|
|
486
|
-
{
|
|
487
|
-
"status": "success",
|
|
488
|
-
"upload_id": upload_id,
|
|
489
|
-
"signed_url": signed_url,
|
|
490
|
-
},
|
|
491
|
-
questions_json,
|
|
492
|
-
reward_signals_json,
|
|
493
|
-
traces_json,
|
|
494
|
-
)
|
|
377
|
+
combined_traces: List[SystemTrace] = list(logged_traces) + list(traces)
|
|
378
|
+
|
|
379
|
+
if not combined_traces:
|
|
380
|
+
raise ValueError("No system traces found")
|
|
381
|
+
|
|
382
|
+
traces_dict = [trace.to_dict() for trace in combined_traces]
|
|
383
|
+
dataset_dict = dataset.to_dict()
|
|
384
|
+
|
|
385
|
+
if verbose:
|
|
386
|
+
print("Validating upload format...")
|
|
387
|
+
validate_upload(traces_dict, dataset_dict)
|
|
388
|
+
|
|
389
|
+
upload_id, signed_url = send_system_traces_s3(
|
|
390
|
+
dataset=dataset,
|
|
391
|
+
traces=combined_traces,
|
|
392
|
+
base_url=base_url,
|
|
393
|
+
api_key=api_key,
|
|
394
|
+
system_id=combined_traces[0].system_id,
|
|
395
|
+
system_name=combined_traces[0].system_name,
|
|
396
|
+
verbose=verbose,
|
|
397
|
+
)
|
|
495
398
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
print("\nTraces:")
|
|
508
|
-
print(json.dumps(traces_dict, indent=2))
|
|
509
|
-
print("\nDataset:")
|
|
510
|
-
print(json.dumps(dataset_dict, indent=2))
|
|
511
|
-
raise
|
|
512
|
-
"""
|
|
399
|
+
questions_json, reward_signals_json, traces_json = format_upload_output(dataset, combined_traces)
|
|
400
|
+
return (
|
|
401
|
+
{
|
|
402
|
+
"status": "success",
|
|
403
|
+
"upload_id": upload_id,
|
|
404
|
+
"signed_url": signed_url,
|
|
405
|
+
},
|
|
406
|
+
questions_json,
|
|
407
|
+
reward_signals_json,
|
|
408
|
+
traces_json,
|
|
409
|
+
)
|