synth-ai 0.2.4.dev5__py3-none-any.whl → 0.2.4.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.
- synth_ai/__init__.py +18 -9
- synth_ai/cli/__init__.py +10 -5
- synth_ai/cli/balance.py +22 -17
- synth_ai/cli/calc.py +2 -3
- synth_ai/cli/demo.py +3 -5
- synth_ai/cli/legacy_root_backup.py +58 -32
- synth_ai/cli/man.py +22 -19
- synth_ai/cli/recent.py +9 -8
- synth_ai/cli/root.py +58 -13
- synth_ai/cli/status.py +13 -6
- synth_ai/cli/traces.py +45 -21
- synth_ai/cli/watch.py +40 -37
- synth_ai/config/base_url.py +1 -3
- synth_ai/core/experiment.py +1 -2
- synth_ai/environments/__init__.py +2 -6
- synth_ai/environments/environment/artifacts/base.py +3 -1
- synth_ai/environments/environment/db/sqlite.py +1 -1
- synth_ai/environments/environment/registry.py +19 -20
- synth_ai/environments/environment/resources/sqlite.py +2 -3
- synth_ai/environments/environment/rewards/core.py +3 -2
- synth_ai/environments/environment/tools/__init__.py +6 -4
- synth_ai/environments/examples/crafter_classic/__init__.py +1 -1
- synth_ai/environments/examples/crafter_classic/engine.py +21 -17
- synth_ai/environments/examples/crafter_classic/engine_deterministic_patch.py +1 -0
- synth_ai/environments/examples/crafter_classic/engine_helpers/action_map.py +2 -1
- synth_ai/environments/examples/crafter_classic/engine_helpers/serialization.py +2 -1
- synth_ai/environments/examples/crafter_classic/engine_serialization_patch_v3.py +3 -2
- synth_ai/environments/examples/crafter_classic/environment.py +16 -15
- synth_ai/environments/examples/crafter_classic/taskset.py +2 -2
- synth_ai/environments/examples/crafter_classic/trace_hooks_v3.py +2 -3
- synth_ai/environments/examples/crafter_classic/world_config_patch_simple.py +2 -1
- synth_ai/environments/examples/crafter_custom/crafter/__init__.py +2 -2
- synth_ai/environments/examples/crafter_custom/crafter/config.py +2 -2
- synth_ai/environments/examples/crafter_custom/crafter/env.py +1 -5
- synth_ai/environments/examples/crafter_custom/crafter/objects.py +1 -2
- synth_ai/environments/examples/crafter_custom/crafter/worldgen.py +1 -2
- synth_ai/environments/examples/crafter_custom/dataset_builder.py +5 -5
- synth_ai/environments/examples/crafter_custom/environment.py +13 -13
- synth_ai/environments/examples/crafter_custom/run_dataset.py +5 -5
- synth_ai/environments/examples/enron/art_helpers/email_search_tools.py +2 -2
- synth_ai/environments/examples/enron/art_helpers/local_email_db.py +5 -4
- synth_ai/environments/examples/enron/art_helpers/types_enron.py +2 -1
- synth_ai/environments/examples/enron/engine.py +18 -14
- synth_ai/environments/examples/enron/environment.py +12 -11
- synth_ai/environments/examples/enron/taskset.py +7 -7
- synth_ai/environments/examples/minigrid/__init__.py +6 -6
- synth_ai/environments/examples/minigrid/engine.py +6 -6
- synth_ai/environments/examples/minigrid/environment.py +6 -6
- synth_ai/environments/examples/minigrid/puzzle_loader.py +3 -2
- synth_ai/environments/examples/minigrid/taskset.py +13 -13
- synth_ai/environments/examples/nethack/achievements.py +1 -1
- synth_ai/environments/examples/nethack/engine.py +8 -7
- synth_ai/environments/examples/nethack/environment.py +10 -9
- synth_ai/environments/examples/nethack/helpers/__init__.py +8 -9
- synth_ai/environments/examples/nethack/helpers/action_mapping.py +1 -1
- synth_ai/environments/examples/nethack/helpers/nle_wrapper.py +2 -1
- synth_ai/environments/examples/nethack/helpers/observation_utils.py +1 -1
- synth_ai/environments/examples/nethack/helpers/recording_wrapper.py +3 -4
- synth_ai/environments/examples/nethack/helpers/trajectory_recorder.py +6 -5
- synth_ai/environments/examples/nethack/helpers/visualization/replay_viewer.py +5 -5
- synth_ai/environments/examples/nethack/helpers/visualization/visualizer.py +7 -6
- synth_ai/environments/examples/nethack/taskset.py +5 -5
- synth_ai/environments/examples/red/engine.py +9 -8
- synth_ai/environments/examples/red/engine_helpers/reward_components.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/__init__.py +7 -7
- synth_ai/environments/examples/red/engine_helpers/reward_library/adaptive_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/battle_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/composite_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/economy_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/efficiency_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/exploration_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/novelty_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/pallet_town_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/pokemon_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/social_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/reward_library/story_rewards.py +2 -1
- synth_ai/environments/examples/red/engine_helpers/screen_analysis.py +3 -2
- synth_ai/environments/examples/red/engine_helpers/state_extraction.py +2 -1
- synth_ai/environments/examples/red/environment.py +18 -15
- synth_ai/environments/examples/red/taskset.py +5 -3
- synth_ai/environments/examples/sokoban/engine.py +16 -13
- synth_ai/environments/examples/sokoban/engine_helpers/room_utils.py +3 -2
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/__init__.py +2 -1
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/__init__.py +1 -1
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/boxoban_env.py +7 -5
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/render_utils.py +1 -1
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/room_utils.py +2 -1
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env.py +5 -4
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_fixed_targets.py +3 -2
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_pull.py +2 -1
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_two_player.py +5 -4
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_variations.py +1 -1
- synth_ai/environments/examples/sokoban/environment.py +15 -14
- synth_ai/environments/examples/sokoban/generate_verified_puzzles.py +5 -3
- synth_ai/environments/examples/sokoban/puzzle_loader.py +3 -2
- synth_ai/environments/examples/sokoban/taskset.py +13 -10
- synth_ai/environments/examples/tictactoe/engine.py +6 -6
- synth_ai/environments/examples/tictactoe/environment.py +8 -7
- synth_ai/environments/examples/tictactoe/taskset.py +6 -5
- synth_ai/environments/examples/verilog/engine.py +4 -3
- synth_ai/environments/examples/verilog/environment.py +11 -10
- synth_ai/environments/examples/verilog/taskset.py +14 -12
- synth_ai/environments/examples/wordle/__init__.py +29 -0
- synth_ai/environments/examples/wordle/engine.py +398 -0
- synth_ai/environments/examples/wordle/environment.py +159 -0
- synth_ai/environments/examples/wordle/helpers/generate_instances_wordfreq.py +75 -0
- synth_ai/environments/examples/wordle/taskset.py +230 -0
- synth_ai/environments/reproducibility/core.py +1 -1
- synth_ai/environments/reproducibility/tree.py +21 -21
- synth_ai/environments/service/app.py +11 -2
- synth_ai/environments/service/core_routes.py +137 -105
- synth_ai/environments/service/external_registry.py +1 -2
- synth_ai/environments/service/registry.py +1 -1
- synth_ai/environments/stateful/core.py +1 -2
- synth_ai/environments/stateful/engine.py +1 -1
- synth_ai/environments/tasks/api.py +4 -4
- synth_ai/environments/tasks/core.py +14 -12
- synth_ai/environments/tasks/filters.py +6 -4
- synth_ai/environments/tasks/utils.py +13 -11
- synth_ai/evals/base.py +2 -3
- synth_ai/experimental/synth_oss.py +4 -4
- synth_ai/learning/gateway.py +1 -3
- synth_ai/learning/prompts/banking77_injection_eval.py +168 -0
- synth_ai/learning/prompts/hello_world_in_context_injection_ex.py +213 -0
- synth_ai/learning/prompts/mipro.py +282 -1
- synth_ai/learning/prompts/random_search.py +246 -0
- synth_ai/learning/prompts/run_mipro_banking77.py +172 -0
- synth_ai/learning/prompts/run_random_search_banking77.py +324 -0
- synth_ai/lm/__init__.py +5 -5
- synth_ai/lm/caching/ephemeral.py +9 -9
- synth_ai/lm/caching/handler.py +20 -20
- synth_ai/lm/caching/persistent.py +10 -10
- synth_ai/lm/config.py +3 -3
- synth_ai/lm/constants.py +7 -7
- synth_ai/lm/core/all.py +17 -3
- synth_ai/lm/core/exceptions.py +0 -2
- synth_ai/lm/core/main.py +26 -41
- synth_ai/lm/core/main_v3.py +20 -10
- synth_ai/lm/core/vendor_clients.py +18 -17
- synth_ai/lm/injection.py +80 -0
- synth_ai/lm/overrides.py +206 -0
- synth_ai/lm/provider_support/__init__.py +1 -1
- synth_ai/lm/provider_support/anthropic.py +51 -24
- synth_ai/lm/provider_support/openai.py +51 -22
- synth_ai/lm/structured_outputs/handler.py +34 -32
- synth_ai/lm/structured_outputs/inject.py +24 -27
- synth_ai/lm/structured_outputs/rehabilitate.py +19 -15
- synth_ai/lm/tools/base.py +17 -16
- synth_ai/lm/unified_interface.py +17 -18
- synth_ai/lm/vendors/base.py +20 -18
- synth_ai/lm/vendors/core/anthropic_api.py +50 -25
- synth_ai/lm/vendors/core/gemini_api.py +31 -36
- synth_ai/lm/vendors/core/mistral_api.py +19 -19
- synth_ai/lm/vendors/core/openai_api.py +11 -10
- synth_ai/lm/vendors/openai_standard.py +144 -88
- synth_ai/lm/vendors/openai_standard_responses.py +74 -61
- synth_ai/lm/vendors/retries.py +9 -1
- synth_ai/lm/vendors/supported/custom_endpoint.py +26 -26
- synth_ai/lm/vendors/supported/deepseek.py +10 -10
- synth_ai/lm/vendors/supported/grok.py +8 -8
- synth_ai/lm/vendors/supported/ollama.py +2 -1
- synth_ai/lm/vendors/supported/openrouter.py +11 -9
- synth_ai/lm/vendors/synth_client.py +69 -63
- synth_ai/lm/warmup.py +8 -7
- synth_ai/tracing/__init__.py +22 -10
- synth_ai/tracing_v1/__init__.py +22 -20
- synth_ai/tracing_v3/__init__.py +7 -7
- synth_ai/tracing_v3/abstractions.py +56 -52
- synth_ai/tracing_v3/config.py +4 -2
- synth_ai/tracing_v3/db_config.py +6 -8
- synth_ai/tracing_v3/decorators.py +29 -30
- synth_ai/tracing_v3/examples/basic_usage.py +12 -12
- synth_ai/tracing_v3/hooks.py +21 -21
- synth_ai/tracing_v3/llm_call_record_helpers.py +85 -98
- synth_ai/tracing_v3/lm_call_record_abstractions.py +2 -4
- synth_ai/tracing_v3/migration_helper.py +3 -5
- synth_ai/tracing_v3/replica_sync.py +30 -32
- synth_ai/tracing_v3/session_tracer.py +35 -29
- synth_ai/tracing_v3/storage/__init__.py +1 -1
- synth_ai/tracing_v3/storage/base.py +8 -7
- synth_ai/tracing_v3/storage/config.py +4 -4
- synth_ai/tracing_v3/storage/factory.py +4 -4
- synth_ai/tracing_v3/storage/utils.py +9 -9
- synth_ai/tracing_v3/turso/__init__.py +3 -3
- synth_ai/tracing_v3/turso/daemon.py +9 -9
- synth_ai/tracing_v3/turso/manager.py +60 -48
- synth_ai/tracing_v3/turso/models.py +24 -19
- synth_ai/tracing_v3/utils.py +5 -5
- synth_ai/tui/__main__.py +1 -1
- synth_ai/tui/cli/query_experiments.py +2 -3
- synth_ai/tui/cli/query_experiments_v3.py +2 -3
- synth_ai/tui/dashboard.py +97 -86
- synth_ai/v0/tracing/abstractions.py +28 -28
- synth_ai/v0/tracing/base_client.py +9 -9
- synth_ai/v0/tracing/client_manager.py +7 -7
- synth_ai/v0/tracing/config.py +7 -7
- synth_ai/v0/tracing/context.py +6 -6
- synth_ai/v0/tracing/decorators.py +6 -5
- synth_ai/v0/tracing/events/manage.py +1 -1
- synth_ai/v0/tracing/events/store.py +5 -4
- synth_ai/v0/tracing/immediate_client.py +4 -5
- synth_ai/v0/tracing/local.py +3 -3
- synth_ai/v0/tracing/log_client_base.py +4 -5
- synth_ai/v0/tracing/retry_queue.py +5 -6
- synth_ai/v0/tracing/trackers.py +25 -25
- synth_ai/v0/tracing/upload.py +6 -0
- synth_ai/v0/tracing_v1/__init__.py +1 -1
- synth_ai/v0/tracing_v1/abstractions.py +28 -28
- synth_ai/v0/tracing_v1/base_client.py +9 -9
- synth_ai/v0/tracing_v1/client_manager.py +7 -7
- synth_ai/v0/tracing_v1/config.py +7 -7
- synth_ai/v0/tracing_v1/context.py +6 -6
- synth_ai/v0/tracing_v1/decorators.py +7 -6
- synth_ai/v0/tracing_v1/events/manage.py +1 -1
- synth_ai/v0/tracing_v1/events/store.py +5 -4
- synth_ai/v0/tracing_v1/immediate_client.py +4 -5
- synth_ai/v0/tracing_v1/local.py +3 -3
- synth_ai/v0/tracing_v1/log_client_base.py +4 -5
- synth_ai/v0/tracing_v1/retry_queue.py +5 -6
- synth_ai/v0/tracing_v1/trackers.py +25 -25
- synth_ai/v0/tracing_v1/upload.py +25 -24
- synth_ai/zyk/__init__.py +1 -0
- {synth_ai-0.2.4.dev5.dist-info → synth_ai-0.2.4.dev7.dist-info}/METADATA +2 -11
- synth_ai-0.2.4.dev7.dist-info/RECORD +299 -0
- synth_ai-0.2.4.dev5.dist-info/RECORD +0 -287
- {synth_ai-0.2.4.dev5.dist-info → synth_ai-0.2.4.dev7.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.4.dev5.dist-info → synth_ai-0.2.4.dev7.dist-info}/entry_points.txt +0 -0
- {synth_ai-0.2.4.dev5.dist-info → synth_ai-0.2.4.dev7.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.2.4.dev5.dist-info → synth_ai-0.2.4.dev7.dist-info}/top_level.txt +0 -0
@@ -4,8 +4,9 @@ Story & Achievement Progression Reward Components
|
|
4
4
|
Rewards for major milestones, story gates, and achievements.
|
5
5
|
"""
|
6
6
|
|
7
|
+
from typing import Any, Dict, Set
|
8
|
+
|
7
9
|
from synth_ai.environments.environment.rewards.core import RewardComponent
|
8
|
-
from typing import Dict, Any, Set
|
9
10
|
|
10
11
|
|
11
12
|
class GymBadgeEarnedReward(RewardComponent):
|
@@ -3,9 +3,10 @@ Screen analysis functions for Pokemon Red to provide rich textual descriptions
|
|
3
3
|
of what's actually visible on the game screen.
|
4
4
|
"""
|
5
5
|
|
6
|
-
import numpy as np
|
7
|
-
from typing import Dict, Any, List, Tuple
|
8
6
|
import hashlib
|
7
|
+
from typing import Any, Dict, List, Tuple
|
8
|
+
|
9
|
+
import numpy as np
|
9
10
|
|
10
11
|
# Define some common Pokemon Red screen colors (RGB values)
|
11
12
|
POKEMON_RED_COLORS = {
|
@@ -1,29 +1,32 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from typing import List, Optional, Any, Dict, Union
|
3
|
-
from pydantic import BaseModel, Field
|
4
2
|
|
5
|
-
|
3
|
+
from typing import Any, Dict, List, Optional, Union
|
4
|
+
|
5
|
+
from pydantic import BaseModel, Field
|
6
6
|
|
7
|
-
from .engine import (
|
8
|
-
PokemonRedEngine,
|
9
|
-
PokemonRedPrivateState,
|
10
|
-
PokemonRedPublicState,
|
11
|
-
PokemonRedEngineSnapshot,
|
12
|
-
)
|
13
|
-
from .taskset import PokemonRedTaskInstance, INSTANCE as DEFAULT_TASK_INSTANCE
|
14
7
|
from synth_ai.environments.environment.shared_engine import (
|
15
8
|
GetObservationCallable,
|
16
9
|
InternalObservation,
|
17
10
|
)
|
18
|
-
from synth_ai.environments.reproducibility.core import ReproducibleEnvironment
|
19
|
-
from synth_ai.environments.stateful.core import StatefulEnvironment
|
20
11
|
from synth_ai.environments.environment.tools import (
|
12
|
+
TOOL_REGISTRY,
|
21
13
|
AbstractTool,
|
22
14
|
EnvToolCall,
|
23
15
|
ToolResult,
|
24
|
-
TOOL_REGISTRY,
|
25
16
|
register_tool,
|
26
17
|
)
|
18
|
+
from synth_ai.environments.reproducibility.core import ReproducibleEnvironment
|
19
|
+
from synth_ai.environments.stateful.core import StatefulEnvironment
|
20
|
+
|
21
|
+
# Import logging configuration to suppress JAX debug messages
|
22
|
+
from .engine import (
|
23
|
+
PokemonRedEngine,
|
24
|
+
PokemonRedEngineSnapshot,
|
25
|
+
PokemonRedPrivateState,
|
26
|
+
PokemonRedPublicState,
|
27
|
+
)
|
28
|
+
from .taskset import INSTANCE as DEFAULT_TASK_INSTANCE
|
29
|
+
from .taskset import PokemonRedTaskInstance
|
27
30
|
|
28
31
|
|
29
32
|
# Tool input schemas
|
@@ -73,9 +76,9 @@ class PokemonRedObservationCallable(GetObservationCallable):
|
|
73
76
|
) -> InternalObservation:
|
74
77
|
"""Convert Pokemon Red states to agent observation"""
|
75
78
|
from .engine_helpers.state_extraction import (
|
76
|
-
get_badge_count,
|
77
|
-
format_position,
|
78
79
|
format_hp_status,
|
80
|
+
format_position,
|
81
|
+
get_badge_count,
|
79
82
|
)
|
80
83
|
|
81
84
|
badge_count = get_badge_count(pub.badges)
|
@@ -1,12 +1,14 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
+
|
3
|
+
import uuid
|
2
4
|
from dataclasses import dataclass
|
3
5
|
from pathlib import Path
|
4
|
-
|
6
|
+
|
5
7
|
from synth_ai.environments.tasks.core import (
|
6
|
-
Task,
|
7
|
-
TaskInstance,
|
8
8
|
Impetus,
|
9
9
|
Intent,
|
10
|
+
Task,
|
11
|
+
TaskInstance,
|
10
12
|
TaskInstanceMetadata,
|
11
13
|
)
|
12
14
|
|
@@ -1,25 +1,28 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from typing import Optional, Dict, Any, Tuple
|
3
2
|
|
3
|
+
import logging
|
4
|
+
from dataclasses import dataclass
|
5
|
+
from typing import Any, Dict, Optional, Tuple
|
6
|
+
|
7
|
+
import numpy as np
|
8
|
+
|
9
|
+
from synth_ai.environments.environment.rewards.core import RewardComponent, RewardStack
|
4
10
|
from synth_ai.environments.environment.shared_engine import (
|
5
11
|
GetObservationCallable,
|
6
12
|
InternalObservation,
|
7
13
|
)
|
8
|
-
from synth_ai.environments.stateful.engine import StatefulEngine, StatefulEngineSnapshot
|
9
|
-
from synth_ai.environments.tasks.core import TaskInstance
|
10
|
-
import numpy as np
|
11
|
-
from dataclasses import dataclass
|
12
|
-
from synth_ai.environments.examples.sokoban.taskset import (
|
13
|
-
SokobanTaskInstance,
|
14
|
-
) # Assuming this is where SokobanTaskInstance is defined
|
15
|
-
from synth_ai.environments.reproducibility.core import IReproducibleEngine # Added import
|
16
|
-
import logging
|
17
|
-
from synth_ai.environments.environment.rewards.core import RewardStack, RewardComponent
|
18
14
|
from synth_ai.environments.examples.sokoban.engine_helpers.vendored.envs.sokoban_env import (
|
19
15
|
ACTION_LOOKUP,
|
16
|
+
)
|
17
|
+
from synth_ai.environments.examples.sokoban.engine_helpers.vendored.envs.sokoban_env import (
|
20
18
|
SokobanEnv as GymSokobanEnv,
|
21
19
|
)
|
22
|
-
|
20
|
+
from synth_ai.environments.examples.sokoban.taskset import (
|
21
|
+
SokobanTaskInstance,
|
22
|
+
) # Assuming this is where SokobanTaskInstance is defined
|
23
|
+
from synth_ai.environments.reproducibility.core import IReproducibleEngine # Added import
|
24
|
+
from synth_ai.environments.stateful.engine import StatefulEngine, StatefulEngineSnapshot
|
25
|
+
from synth_ai.environments.tasks.core import TaskInstance
|
23
26
|
|
24
27
|
# No monkey-patch needed - we fixed the vendored code directly
|
25
28
|
|
@@ -623,8 +626,8 @@ if __name__ == "__main__":
|
|
623
626
|
"num_env_steps": 0,
|
624
627
|
}
|
625
628
|
}
|
626
|
-
import random
|
627
629
|
import asyncio
|
630
|
+
import random
|
628
631
|
|
629
632
|
async def sanity():
|
630
633
|
task_instance = TaskInstance()
|
@@ -1,13 +1,15 @@
|
|
1
|
-
from .sokoban_env import SokobanEnv
|
2
|
-
from .render_utils import room_to_rgb
|
3
1
|
import os
|
2
|
+
import random
|
3
|
+
import zipfile
|
4
4
|
from os import listdir
|
5
5
|
from os.path import isfile, join
|
6
|
+
|
7
|
+
import numpy as np
|
6
8
|
import requests
|
7
|
-
import zipfile
|
8
9
|
from tqdm import tqdm
|
9
|
-
|
10
|
-
|
10
|
+
|
11
|
+
from .render_utils import room_to_rgb
|
12
|
+
from .sokoban_env import SokobanEnv
|
11
13
|
|
12
14
|
|
13
15
|
class BoxobanEnv(SokobanEnv):
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import gym
|
2
|
-
|
3
|
-
from gym.spaces.discrete import Discrete
|
2
|
+
import numpy as np
|
4
3
|
from gym.spaces import Box
|
5
|
-
from .
|
4
|
+
from gym.spaces.discrete import Discrete
|
5
|
+
from gym.utils import seeding
|
6
|
+
|
6
7
|
from .render_utils import room_to_rgb, room_to_tiny_world_rgb
|
7
|
-
|
8
|
+
from .room_utils import generate_room
|
8
9
|
|
9
10
|
|
10
11
|
class SokobanEnv(gym.Env):
|
synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_fixed_targets.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
from .sokoban_env import SokobanEnv
|
2
|
-
from .render_utils import room_to_rgb_FT, room_to_tiny_world_rgb_FT
|
3
1
|
from gym.spaces import Box
|
4
2
|
|
3
|
+
from .render_utils import room_to_rgb_FT, room_to_tiny_world_rgb_FT
|
4
|
+
from .sokoban_env import SokobanEnv
|
5
|
+
|
5
6
|
|
6
7
|
class FixedTargetsSokobanEnv(SokobanEnv):
|
7
8
|
def __init__(self, dim_room=(10, 10), max_steps=120, num_boxes=3, num_gen_steps=None):
|
@@ -1,7 +1,8 @@
|
|
1
|
-
from .sokoban_env import SokobanEnv, CHANGE_COORDINATES
|
2
1
|
from gym.spaces import Box
|
3
2
|
from gym.spaces.discrete import Discrete
|
4
3
|
|
4
|
+
from .sokoban_env import CHANGE_COORDINATES, SokobanEnv
|
5
|
+
|
5
6
|
|
6
7
|
class PushAndPullSokobanEnv(SokobanEnv):
|
7
8
|
def __init__(self, dim_room=(10, 10), max_steps=120, num_boxes=3, num_gen_steps=None):
|
synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_two_player.py
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
|
1
|
+
import numpy as np
|
2
2
|
from gym.spaces import Box
|
3
3
|
from gym.spaces.discrete import Discrete
|
4
|
+
|
4
5
|
from .render_utils import (
|
5
|
-
room_to_rgb,
|
6
|
-
room_to_tiny_world_rgb,
|
7
6
|
color_player_two,
|
8
7
|
color_tiny_player_two,
|
8
|
+
room_to_rgb,
|
9
|
+
room_to_tiny_world_rgb,
|
9
10
|
)
|
10
|
-
import
|
11
|
+
from .sokoban_env import CHANGE_COORDINATES, SokobanEnv
|
11
12
|
|
12
13
|
|
13
14
|
class TwoPlayerSokobanEnv(SokobanEnv):
|
synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_variations.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
+
from .boxoban_env import BoxobanEnv
|
1
2
|
from .sokoban_env import SokobanEnv
|
2
3
|
from .sokoban_env_fixed_targets import FixedTargetsSokobanEnv
|
3
4
|
from .sokoban_env_pull import PushAndPullSokobanEnv
|
4
5
|
from .sokoban_env_two_player import TwoPlayerSokobanEnv
|
5
|
-
from .boxoban_env import BoxobanEnv
|
6
6
|
|
7
7
|
|
8
8
|
class SokobanEnv1(SokobanEnv):
|
@@ -1,29 +1,30 @@
|
|
1
|
-
from typing import List, Optional, Any, Dict, Union
|
2
|
-
from pydantic import BaseModel
|
3
1
|
import dataclasses
|
2
|
+
from typing import Any, Dict, List, Optional, Union
|
3
|
+
|
4
|
+
from pydantic import BaseModel
|
4
5
|
|
5
|
-
from synth_ai.environments.examples.sokoban.engine import (
|
6
|
-
SokobanEngine,
|
7
|
-
SynthSokobanObservationCallable,
|
8
|
-
SokobanPrivateState,
|
9
|
-
SokobanPublicState,
|
10
|
-
SynthSokobanCheckpointObservationCallable,
|
11
|
-
SokobanEngineSnapshot,
|
12
|
-
)
|
13
6
|
from synth_ai.environments.environment.shared_engine import (
|
14
7
|
GetObservationCallable,
|
15
8
|
InternalObservation,
|
16
9
|
)
|
17
|
-
from synth_ai.environments.reproducibility.core import ReproducibleEnvironment
|
18
|
-
from synth_ai.environments.stateful.core import StatefulEnvironment
|
19
|
-
from synth_ai.environments.tasks.core import TaskInstance
|
20
10
|
from synth_ai.environments.environment.tools import (
|
11
|
+
TOOL_REGISTRY,
|
21
12
|
AbstractTool,
|
22
13
|
EnvToolCall,
|
23
14
|
ToolResult,
|
24
|
-
TOOL_REGISTRY,
|
25
15
|
register_tool,
|
26
16
|
)
|
17
|
+
from synth_ai.environments.examples.sokoban.engine import (
|
18
|
+
SokobanEngine,
|
19
|
+
SokobanEngineSnapshot,
|
20
|
+
SokobanPrivateState,
|
21
|
+
SokobanPublicState,
|
22
|
+
SynthSokobanCheckpointObservationCallable,
|
23
|
+
SynthSokobanObservationCallable,
|
24
|
+
)
|
25
|
+
from synth_ai.environments.reproducibility.core import ReproducibleEnvironment
|
26
|
+
from synth_ai.environments.stateful.core import StatefulEnvironment
|
27
|
+
from synth_ai.environments.tasks.core import TaskInstance
|
27
28
|
|
28
29
|
|
29
30
|
# --- Tool Definition ---
|
@@ -8,10 +8,12 @@ and saves them as JSON. Each puzzle is verified to be solvable using BFS.
|
|
8
8
|
|
9
9
|
import json
|
10
10
|
import logging
|
11
|
-
import
|
12
|
-
from typing import Dict, List, Tuple, Optional, Any, Set
|
11
|
+
from dataclasses import asdict, dataclass
|
13
12
|
from pathlib import Path
|
14
|
-
from
|
13
|
+
from typing import Any, Dict, List, Optional, Set, Tuple
|
14
|
+
|
15
|
+
import numpy as np
|
16
|
+
|
15
17
|
from synth_ai.environments.examples.sokoban.engine_helpers.room_utils import (
|
16
18
|
generate_room,
|
17
19
|
get_shortest_action_path,
|
@@ -5,9 +5,10 @@ Puzzle loader for pre-generated verified Sokoban puzzles.
|
|
5
5
|
import json
|
6
6
|
import logging
|
7
7
|
import random
|
8
|
-
from pathlib import Path
|
9
|
-
from typing import Dict, List, Optional, Tuple, Any
|
10
8
|
from dataclasses import dataclass
|
9
|
+
from pathlib import Path
|
10
|
+
from typing import Any, Dict, List, Optional, Tuple
|
11
|
+
|
11
12
|
import numpy as np
|
12
13
|
|
13
14
|
logger = logging.getLogger(__name__)
|
@@ -1,20 +1,23 @@
|
|
1
|
+
import logging
|
2
|
+
import os
|
3
|
+
from dataclasses import asdict, dataclass, fields
|
4
|
+
from typing import List, Tuple
|
5
|
+
from uuid import UUID, uuid4
|
6
|
+
|
7
|
+
from synth_ai.environments.examples.sokoban.puzzle_loader import (
|
8
|
+
SokobanPuzzle,
|
9
|
+
get_puzzle_loader,
|
10
|
+
)
|
1
11
|
from synth_ai.environments.tasks.core import (
|
12
|
+
Impetus,
|
13
|
+
Intent,
|
14
|
+
SplitInfo,
|
2
15
|
Task,
|
3
16
|
TaskInstance,
|
4
17
|
TaskInstanceMetadata,
|
5
18
|
TaskInstanceMetadataFilter,
|
6
19
|
TaskInstanceSet,
|
7
20
|
)
|
8
|
-
from uuid import uuid4, UUID
|
9
|
-
from synth_ai.environments.tasks.core import SplitInfo, Impetus, Intent
|
10
|
-
from synth_ai.environments.examples.sokoban.puzzle_loader import (
|
11
|
-
get_puzzle_loader,
|
12
|
-
SokobanPuzzle,
|
13
|
-
)
|
14
|
-
from dataclasses import dataclass, asdict, fields
|
15
|
-
from typing import Tuple, List
|
16
|
-
import os
|
17
|
-
import logging
|
18
21
|
|
19
22
|
logger = logging.getLogger(__name__)
|
20
23
|
|
@@ -1,19 +1,19 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
import numpy as np
|
4
3
|
from dataclasses import dataclass
|
5
|
-
from typing import
|
4
|
+
from typing import Any, Dict, Optional, Tuple
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
from synth_ai.environments.environment.rewards.core import
|
6
|
+
import numpy as np
|
7
|
+
|
8
|
+
from synth_ai.environments.environment.rewards.core import RewardComponent, RewardStack
|
10
9
|
from synth_ai.environments.environment.shared_engine import (
|
11
10
|
GetObservationCallable,
|
12
11
|
InternalObservation,
|
13
12
|
)
|
13
|
+
from synth_ai.environments.reproducibility.core import IReproducibleEngine
|
14
|
+
from synth_ai.environments.stateful.engine import StatefulEngine, StatefulEngineSnapshot
|
14
15
|
from synth_ai.environments.tasks.core import TaskInstance
|
15
16
|
|
16
|
-
|
17
17
|
# Action mapping: coordinate strings to board indices
|
18
18
|
COORD_TO_IDX = {
|
19
19
|
"A1": 0,
|
@@ -1,10 +1,9 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Dict, List, Optional, Union
|
4
|
+
|
4
5
|
from pydantic import BaseModel
|
5
6
|
|
6
|
-
from synth_ai.environments.stateful.core import StatefulEnvironment
|
7
|
-
from synth_ai.environments.reproducibility.core import ReproducibleEnvironment
|
8
7
|
from synth_ai.environments.environment.shared_engine import (
|
9
8
|
GetObservationCallable,
|
10
9
|
InternalObservation,
|
@@ -14,15 +13,17 @@ from synth_ai.environments.environment.tools import (
|
|
14
13
|
EnvToolCall,
|
15
14
|
ToolResult,
|
16
15
|
)
|
16
|
+
from synth_ai.environments.reproducibility.core import ReproducibleEnvironment
|
17
|
+
from synth_ai.environments.stateful.core import StatefulEnvironment
|
17
18
|
from synth_ai.environments.tasks.core import TaskInstance
|
18
19
|
|
19
20
|
from .engine import (
|
21
|
+
SynthTicTacToeCheckpointObservationCallable,
|
22
|
+
SynthTicTacToeObservationCallable,
|
20
23
|
TicTacToeEngine,
|
21
|
-
TicTacToePublicState,
|
22
|
-
TicTacToePrivateState,
|
23
24
|
TicTacToeEngineSnapshot,
|
24
|
-
|
25
|
-
|
25
|
+
TicTacToePrivateState,
|
26
|
+
TicTacToePublicState,
|
26
27
|
)
|
27
28
|
|
28
29
|
|
@@ -3,19 +3,20 @@ from __future__ import annotations
|
|
3
3
|
import random
|
4
4
|
from dataclasses import dataclass
|
5
5
|
from typing import List
|
6
|
+
from uuid import uuid4
|
7
|
+
|
6
8
|
import numpy as np
|
7
9
|
|
8
|
-
from uuid import uuid4
|
9
10
|
from synth_ai.environments.tasks.core import (
|
10
|
-
TaskInstance,
|
11
|
-
TaskInstanceMetadata,
|
12
|
-
TaskInstanceSet,
|
13
11
|
Impetus,
|
14
12
|
Intent,
|
15
13
|
SplitInfo,
|
14
|
+
TaskInstance,
|
15
|
+
TaskInstanceMetadata,
|
16
|
+
TaskInstanceSet,
|
16
17
|
)
|
17
18
|
|
18
|
-
from .engine import COORD_TO_IDX,
|
19
|
+
from .engine import COORD_TO_IDX, PLAYER_MARKS, WIN_PATTERNS
|
19
20
|
|
20
21
|
|
21
22
|
@dataclass
|
@@ -1,13 +1,14 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
+
|
2
3
|
import shutil
|
3
4
|
import subprocess
|
4
|
-
from pathlib import Path
|
5
|
-
from typing import Dict, Any, Tuple, Optional
|
6
5
|
from dataclasses import dataclass
|
6
|
+
from pathlib import Path
|
7
|
+
from typing import Any, Dict, Optional, Tuple
|
7
8
|
|
9
|
+
from synth_ai.environments.environment.rewards.core import RewardComponent, RewardStack
|
8
10
|
from synth_ai.environments.stateful.engine import StatefulEngine, StatefulEngineSnapshot
|
9
11
|
from synth_ai.environments.tasks.core import TaskInstance
|
10
|
-
from synth_ai.environments.environment.rewards.core import RewardStack, RewardComponent
|
11
12
|
|
12
13
|
|
13
14
|
@dataclass
|
@@ -1,25 +1,26 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Any, Dict, List, Optional, Union
|
2
|
+
|
2
3
|
from pydantic import BaseModel
|
3
4
|
|
4
|
-
from synth_ai.environments.examples.verilog.engine import (
|
5
|
-
VerilogEngine,
|
6
|
-
VerilogPrivateState,
|
7
|
-
VerilogPublicState,
|
8
|
-
VerilogEngineSnapshot,
|
9
|
-
)
|
10
5
|
from synth_ai.environments.environment.shared_engine import (
|
11
6
|
GetObservationCallable,
|
12
7
|
InternalObservation,
|
13
8
|
)
|
14
|
-
from synth_ai.environments.stateful.core import StatefulEnvironment
|
15
|
-
from synth_ai.environments.tasks.core import TaskInstance
|
16
9
|
from synth_ai.environments.environment.tools import (
|
10
|
+
TOOL_REGISTRY,
|
17
11
|
AbstractTool,
|
18
12
|
EnvToolCall,
|
19
13
|
ToolResult,
|
20
|
-
TOOL_REGISTRY,
|
21
14
|
register_tool,
|
22
15
|
)
|
16
|
+
from synth_ai.environments.examples.verilog.engine import (
|
17
|
+
VerilogEngine,
|
18
|
+
VerilogEngineSnapshot,
|
19
|
+
VerilogPrivateState,
|
20
|
+
VerilogPublicState,
|
21
|
+
)
|
22
|
+
from synth_ai.environments.stateful.core import StatefulEnvironment
|
23
|
+
from synth_ai.environments.tasks.core import TaskInstance
|
23
24
|
|
24
25
|
|
25
26
|
# Tool Input Schemas
|
@@ -1,21 +1,23 @@
|
|
1
|
+
import atexit
|
2
|
+
import os
|
3
|
+
import shutil
|
4
|
+
import tempfile
|
5
|
+
from dataclasses import asdict, dataclass, fields
|
6
|
+
from pathlib import Path
|
7
|
+
from typing import Optional
|
8
|
+
from uuid import UUID, uuid4
|
9
|
+
|
10
|
+
from datasets import load_dataset
|
11
|
+
|
1
12
|
from synth_ai.environments.tasks.core import (
|
13
|
+
Impetus,
|
14
|
+
Intent,
|
15
|
+
SplitInfo,
|
2
16
|
Task,
|
3
17
|
TaskInstance,
|
4
18
|
TaskInstanceMetadata,
|
5
19
|
TaskInstanceSet,
|
6
|
-
SplitInfo,
|
7
|
-
Impetus,
|
8
|
-
Intent,
|
9
20
|
)
|
10
|
-
from uuid import uuid4, UUID
|
11
|
-
from dataclasses import dataclass, asdict, fields
|
12
|
-
from typing import Optional
|
13
|
-
from pathlib import Path
|
14
|
-
import tempfile
|
15
|
-
import os
|
16
|
-
import shutil
|
17
|
-
import atexit
|
18
|
-
from datasets import load_dataset
|
19
21
|
|
20
22
|
# Global list to track temp directories for cleanup
|
21
23
|
_temp_dirs = []
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from .engine import (
|
2
|
+
SynthWordleCheckpointObservationCallable,
|
3
|
+
SynthWordleObservationCallable,
|
4
|
+
WordleEngine,
|
5
|
+
WordleEngineSnapshot,
|
6
|
+
WordlePrivateState,
|
7
|
+
WordlePublicState,
|
8
|
+
)
|
9
|
+
from .environment import WordleActionInput, WordleEnvironment, WordleInteractTool
|
10
|
+
from .taskset import WordleTaskInstance, WordleTaskInstanceMetadata, create_wordle_taskset, taskset
|
11
|
+
|
12
|
+
__all__ = [
|
13
|
+
# Engine
|
14
|
+
"WordleEngine",
|
15
|
+
"WordlePublicState",
|
16
|
+
"WordlePrivateState",
|
17
|
+
"WordleEngineSnapshot",
|
18
|
+
"SynthWordleObservationCallable",
|
19
|
+
"SynthWordleCheckpointObservationCallable",
|
20
|
+
# Environment
|
21
|
+
"WordleEnvironment",
|
22
|
+
"WordleInteractTool",
|
23
|
+
"WordleActionInput",
|
24
|
+
# TaskSet
|
25
|
+
"WordleTaskInstance",
|
26
|
+
"WordleTaskInstanceMetadata",
|
27
|
+
"create_wordle_taskset",
|
28
|
+
"taskset",
|
29
|
+
]
|