plancraft 0.3.24__py3-none-any.whl → 0.3.26__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.
@@ -22,6 +22,10 @@ def convert_to_slot_index(slot: str) -> int:
22
22
  if slot in grid_map:
23
23
  return grid_map[slot]
24
24
  else:
25
+ # check if it is an inventory slot
26
+ if len(slot) < 4 or len(slot) > 5 or slot[1] != "I" or slot[2] == "0":
27
+ raise ValueError("Invalid slot index")
28
+ # convert I1 to 10, I2 to 11, I3 to 12, ..., I36 to 45
25
29
  return int(slot[2:-1]) + 9
26
30
 
27
31
 
@@ -40,8 +44,9 @@ def convert_from_slot_index(slot_index: int) -> str:
40
44
  }
41
45
  if slot_index < 10:
42
46
  return grid_map[slot_index]
43
- else:
47
+ elif slot_index < 46:
44
48
  return f"[I{slot_index-9}]"
49
+ raise ValueError("Invalid slot index")
45
50
 
46
51
 
47
52
  class ActionHandlerBase(abc.ABC):
@@ -123,9 +128,13 @@ class MoveAction(BaseModel):
123
128
  if self.slot_from == self.slot_to:
124
129
  raise AttributeError("[Source] and [Target] must be different")
125
130
  if self.slot_from < 0 or self.slot_from > 45:
126
- raise AttributeError("[Source] must be between 0 and 45")
131
+ raise AttributeError(
132
+ "[Source] must be [0] or [A1] to [C3] or [I1] to [I36]"
133
+ )
134
+ if self.slot_to == 0:
135
+ raise AttributeError("You cannot move items into [0]")
127
136
  if self.slot_to < 1 or self.slot_to > 45:
128
- raise AttributeError("[Target] must be between 1 and 45")
137
+ raise AttributeError("[Target] must be [A1] to [C3] or [I1] to [I36]")
129
138
  if self.quantity < 1 or self.quantity > 64:
130
139
  raise AttributeError("quantity must be between 1 and 64")
131
140
  return self
@@ -172,9 +181,13 @@ class SmeltAction(BaseModel):
172
181
  if self.slot_from == self.slot_to:
173
182
  raise AttributeError("[Source] and [Target] must be different")
174
183
  if self.slot_from < 0 or self.slot_from > 45:
175
- raise AttributeError("[Source] must be between 0 and 45")
184
+ raise AttributeError(
185
+ "[Source] must be [0] or [A1] to [C3] or [I1] to [I36]"
186
+ )
187
+ if self.slot_to == 0:
188
+ raise AttributeError("You cannot smelt items into [0]")
176
189
  if self.slot_to < 1 or self.slot_to > 45:
177
- raise AttributeError("[Target] must be between 1 and 45")
190
+ raise AttributeError("[Target] must be [A1] to [C3] or [I1] to [I36]")
178
191
  if self.quantity < 1 or self.quantity > 64:
179
192
  raise AttributeError("quantity must be between 1 and 64")
180
193
  return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plancraft
3
- Version: 0.3.24
3
+ Version: 0.3.26
4
4
  Summary: Plancraft: an evaluation dataset for planning with LLM agents
5
5
  License: MIT License
6
6
 
@@ -11,7 +11,7 @@ plancraft/data/val.json,sha256=IToAiaqUNQi_xhX1bzmInuskLaT7C2ryQjP-CZkzL24,13044
11
11
  plancraft/data/val.small.easy.json,sha256=9zEmqepjXG2NIp88xnFqOCkwsUsku3HEwHoQGxgTr6U,190252
12
12
  plancraft/data/val.small.json,sha256=76E9EFaljDQyAokg97e-IblvcOe6KbrdKkXvRxhhkgo,237653
13
13
  plancraft/environment/__init__.py,sha256=XFsFny4lH195AwAmL-WeCaF9ZCMgc7IgXIwhQ8FTdgE,505
14
- plancraft/environment/actions.py,sha256=Ve3SHwg0o2NcMBVM8O-IRjsvcdO2dH8kqvweWm6euo8,10559
14
+ plancraft/environment/actions.py,sha256=9GESxqx4z0aTwEmI6H-8MJMaqnFTAgsfck7GOHUQEBg,11175
15
15
  plancraft/environment/env.py,sha256=A4532st7JFBYBF_Nh0CEEi3ZTLJAeaB3t9PAIVSemj0,16390
16
16
  plancraft/environment/items.py,sha256=Z9rhSyVDEoHF1pxRvhyiT94tyQJaWHi3wUHVcamz82o,221
17
17
  plancraft/environment/planner.py,sha256=uIOJjIoyT_4pxeWeTKb8BkLJyKZG0-AMoEOkZs6Ua9A,19340
@@ -1920,7 +1920,7 @@ plancraft/models/generators.py,sha256=F76_iPiqxUjDIrQwF58tzM0bLM91OkZJ0sBqBuki5w
1920
1920
  plancraft/models/oracle.py,sha256=f-0KWlBuHy6wcxmDsxM3MQ_QwfBstzfbA26mlk1MgLA,1657
1921
1921
  plancraft/models/utils.py,sha256=E-sZohvolWgGbpHQKgAgkgIfUJoVnT5pMt6JP8xLHKg,4034
1922
1922
  plancraft/train/dataset.py,sha256=oFqEd4LG9oEQ-71teh0Wf7-jJbtybT2ZibfM2bBdBkM,5474
1923
- plancraft-0.3.24.dist-info/METADATA,sha256=yCmPq3zXC2cEu5E9c1MOT1nsrfGcI_clOMYIV4GQoR4,11148
1924
- plancraft-0.3.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1925
- plancraft-0.3.24.dist-info/licenses/LICENSE,sha256=YGR8ehDB4t-T-lOQKMfKNR-2zsOU7E3E5NA8t25HKE0,1070
1926
- plancraft-0.3.24.dist-info/RECORD,,
1923
+ plancraft-0.3.26.dist-info/METADATA,sha256=2s3S8xZMyP8v1T0y2qHl5OHIN18sMn0UXXA8iJxUQq8,11148
1924
+ plancraft-0.3.26.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1925
+ plancraft-0.3.26.dist-info/licenses/LICENSE,sha256=YGR8ehDB4t-T-lOQKMfKNR-2zsOU7E3E5NA8t25HKE0,1070
1926
+ plancraft-0.3.26.dist-info/RECORD,,