plancraft 0.3.21__py3-none-any.whl → 0.3.22__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.
- plancraft/environment/actions.py +24 -24
- plancraft/environment/search.py +2 -4
- {plancraft-0.3.21.dist-info → plancraft-0.3.22.dist-info}/METADATA +1 -1
- {plancraft-0.3.21.dist-info → plancraft-0.3.22.dist-info}/RECORD +6 -6
- {plancraft-0.3.21.dist-info → plancraft-0.3.22.dist-info}/WHEEL +0 -0
- {plancraft-0.3.21.dist-info → plancraft-0.3.22.dist-info}/licenses/LICENSE +0 -0
plancraft/environment/actions.py
CHANGED
@@ -61,6 +61,14 @@ class ActionHandlerBase(abc.ABC):
|
|
61
61
|
"""
|
62
62
|
raise NotImplementedError()
|
63
63
|
|
64
|
+
@property
|
65
|
+
@abc.abstractmethod
|
66
|
+
def regex_pattern(self) -> str:
|
67
|
+
"""
|
68
|
+
Return the regex pattern for the model
|
69
|
+
"""
|
70
|
+
raise NotImplementedError()
|
71
|
+
|
64
72
|
@property
|
65
73
|
@abc.abstractmethod
|
66
74
|
def action_name(self) -> str:
|
@@ -97,7 +105,7 @@ class MoveAction(BaseModel):
|
|
97
105
|
return convert_to_slot_index(value)
|
98
106
|
except ValueError:
|
99
107
|
raise AttributeError(
|
100
|
-
"
|
108
|
+
"[Source] and [Target] must be [0] or [A1] to [C3] or [I1] to [I36]"
|
101
109
|
)
|
102
110
|
return value
|
103
111
|
|
@@ -113,11 +121,11 @@ class MoveAction(BaseModel):
|
|
113
121
|
@model_validator(mode="after")
|
114
122
|
def validate(self):
|
115
123
|
if self.slot_from == self.slot_to:
|
116
|
-
raise AttributeError("
|
124
|
+
raise AttributeError("[Source] and [Target] must be different")
|
117
125
|
if self.slot_from < 0 or self.slot_from > 45:
|
118
|
-
raise AttributeError("
|
126
|
+
raise AttributeError("[Source] must be between 0 and 45")
|
119
127
|
if self.slot_to < 1 or self.slot_to > 45:
|
120
|
-
raise AttributeError("
|
128
|
+
raise AttributeError("[Target] must be between 1 and 45")
|
121
129
|
if self.quantity < 1 or self.quantity > 64:
|
122
130
|
raise AttributeError("quantity must be between 1 and 64")
|
123
131
|
return self
|
@@ -146,7 +154,7 @@ class SmeltAction(BaseModel):
|
|
146
154
|
return convert_to_slot_index(value)
|
147
155
|
except ValueError:
|
148
156
|
raise AttributeError(
|
149
|
-
"
|
157
|
+
"[Source] and [Target] must be [0] or [A1] to [C3] or [I1] to [I36]"
|
150
158
|
)
|
151
159
|
return value
|
152
160
|
|
@@ -162,11 +170,11 @@ class SmeltAction(BaseModel):
|
|
162
170
|
@model_validator(mode="after")
|
163
171
|
def validate(self):
|
164
172
|
if self.slot_from == self.slot_to:
|
165
|
-
raise AttributeError("
|
173
|
+
raise AttributeError("[Source] and [Target] must be different")
|
166
174
|
if self.slot_from < 0 or self.slot_from > 45:
|
167
|
-
raise AttributeError("
|
175
|
+
raise AttributeError("[Source] must be between 0 and 45")
|
168
176
|
if self.slot_to < 1 or self.slot_to > 45:
|
169
|
-
raise AttributeError("
|
177
|
+
raise AttributeError("[Target] must be between 1 and 45")
|
170
178
|
if self.quantity < 1 or self.quantity > 64:
|
171
179
|
raise AttributeError("quantity must be between 1 and 64")
|
172
180
|
return self
|
@@ -227,10 +235,8 @@ class MoveActionHandler(ActionHandlerBase):
|
|
227
235
|
quantity=quantity,
|
228
236
|
)
|
229
237
|
return action
|
230
|
-
except AttributeError:
|
231
|
-
return
|
232
|
-
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
233
|
-
)
|
238
|
+
except AttributeError as e:
|
239
|
+
return f"Format Error: {e}. Correct format: {self.prompt_format_example}"
|
234
240
|
|
235
241
|
|
236
242
|
class SmeltActionHandler(ActionHandlerBase):
|
@@ -270,10 +276,8 @@ class SmeltActionHandler(ActionHandlerBase):
|
|
270
276
|
quantity=quantity,
|
271
277
|
)
|
272
278
|
return action
|
273
|
-
except AttributeError:
|
274
|
-
return
|
275
|
-
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
276
|
-
)
|
279
|
+
except AttributeError as e:
|
280
|
+
return f"Format Error: {e}. Correct format: {self.prompt_format_example}"
|
277
281
|
|
278
282
|
|
279
283
|
class ImpossibleActionHandler(ActionHandlerBase):
|
@@ -303,10 +307,8 @@ class ImpossibleActionHandler(ActionHandlerBase):
|
|
303
307
|
return
|
304
308
|
reason = re.search(r"impossible: (.*)", generated_text).group(1)
|
305
309
|
return StopAction(reason=reason)
|
306
|
-
except AttributeError:
|
307
|
-
return
|
308
|
-
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
309
|
-
)
|
310
|
+
except AttributeError as e:
|
311
|
+
return f"Format Error: {e}. Correct format: {self.prompt_format_example}"
|
310
312
|
|
311
313
|
|
312
314
|
class ThinkActionHandler(ActionHandlerBase):
|
@@ -335,7 +337,5 @@ class ThinkActionHandler(ActionHandlerBase):
|
|
335
337
|
if not action_match:
|
336
338
|
return
|
337
339
|
return "Ok"
|
338
|
-
except AttributeError:
|
339
|
-
return
|
340
|
-
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
341
|
-
)
|
340
|
+
except AttributeError as e:
|
341
|
+
return f"Format Error: {e}. Correct format: {self.prompt_format_example}"
|
plancraft/environment/search.py
CHANGED
@@ -57,7 +57,5 @@ class GoldSearchActionHandler(ActionHandlerBase):
|
|
57
57
|
|
58
58
|
search_target = re.search(r"search: *(\w+)", generated_text).group(1)
|
59
59
|
return gold_search_recipe(search_target)
|
60
|
-
except AttributeError:
|
61
|
-
return
|
62
|
-
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
63
|
-
)
|
60
|
+
except AttributeError as e:
|
61
|
+
return f"Format Error: {e}. Correct format: {self.prompt_format_example}"
|
@@ -11,14 +11,14 @@ 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=
|
14
|
+
plancraft/environment/actions.py,sha256=Ve3SHwg0o2NcMBVM8O-IRjsvcdO2dH8kqvweWm6euo8,10559
|
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
|
18
18
|
plancraft/environment/prompts.py,sha256=8QXclX0ygpL02uZichE1AVkbdn_0HGteD5bzo0FZGOU,6947
|
19
19
|
plancraft/environment/recipes.py,sha256=0vwzOU86eZmGN2EpZVSIvzxpx0AOBWNPxTtAOFBN2A0,19570
|
20
20
|
plancraft/environment/sampler.py,sha256=79hLpTU0ajvMPoBsvSe8tE88x31c8Vlczb3tJZJcau0,7441
|
21
|
-
plancraft/environment/search.py,sha256=
|
21
|
+
plancraft/environment/search.py,sha256=z31eEwQBY7WJaYVBEEwulFS8P3h1Nwo1Th9BaCTxk5M,2085
|
22
22
|
plancraft/environment/assets/constants.json,sha256=kyOIOh82CTTMMGEIS60k5k6M-6fkEmYDoGAnvi3Zx5k,1379016
|
23
23
|
plancraft/environment/assets/minecraft_font.ttf,sha256=AzoK9cgggXwjFPHtIO7uz-YaDrminl3nvB-VsaTvTAk,60992
|
24
24
|
plancraft/environment/assets/table.png,sha256=IKIViZKAPyR4FWnS0JP9AZ19vIEO3qoS5-YRGAO1ow8,5430
|
@@ -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.
|
1924
|
-
plancraft-0.3.
|
1925
|
-
plancraft-0.3.
|
1926
|
-
plancraft-0.3.
|
1923
|
+
plancraft-0.3.22.dist-info/METADATA,sha256=jTX0TZZxJRldUDDFuJ6AhuN1Bf5Jc2DuDooPVwCBkAQ,11148
|
1924
|
+
plancraft-0.3.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
1925
|
+
plancraft-0.3.22.dist-info/licenses/LICENSE,sha256=YGR8ehDB4t-T-lOQKMfKNR-2zsOU7E3E5NA8t25HKE0,1070
|
1926
|
+
plancraft-0.3.22.dist-info/RECORD,,
|
File without changes
|
File without changes
|