plancraft 0.3.16__py3-none-any.whl → 0.3.17__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 +34 -19
- plancraft/environment/search.py +11 -5
- {plancraft-0.3.16.dist-info → plancraft-0.3.17.dist-info}/METADATA +1 -1
- {plancraft-0.3.16.dist-info → plancraft-0.3.17.dist-info}/RECORD +6 -6
- {plancraft-0.3.16.dist-info → plancraft-0.3.17.dist-info}/WHEEL +0 -0
- {plancraft-0.3.16.dist-info → plancraft-0.3.17.dist-info}/licenses/LICENSE +0 -0
plancraft/environment/actions.py
CHANGED
@@ -208,10 +208,10 @@ class MoveActionHandler(ActionHandlerBase):
|
|
208
208
|
"""
|
209
209
|
Parse the raw model response to a MoveAction
|
210
210
|
"""
|
211
|
-
action_match = re.search(f"({self.action_name}):", generated_text)
|
212
|
-
if not action_match:
|
213
|
-
return
|
214
211
|
try:
|
212
|
+
action_match = re.search(f"({self.action_name}):", generated_text)
|
213
|
+
if not action_match:
|
214
|
+
return
|
215
215
|
slot_from = re.search(r" from (\[[ABCI]?\d+\])", generated_text).group(1)
|
216
216
|
slot_to = re.search(r" to (\[[ABCI]?\d+\])", generated_text).group(1)
|
217
217
|
quantity = re.search(r"with quantity (\d+)", generated_text).group(1)
|
@@ -221,8 +221,10 @@ class MoveActionHandler(ActionHandlerBase):
|
|
221
221
|
quantity=quantity,
|
222
222
|
)
|
223
223
|
return action
|
224
|
-
except AttributeError
|
225
|
-
return
|
224
|
+
except AttributeError:
|
225
|
+
return (
|
226
|
+
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
227
|
+
)
|
226
228
|
|
227
229
|
|
228
230
|
class SmeltActionHandler(ActionHandlerBase):
|
@@ -242,10 +244,11 @@ class SmeltActionHandler(ActionHandlerBase):
|
|
242
244
|
"""
|
243
245
|
Parse the raw model response to a SmeltAction
|
244
246
|
"""
|
245
|
-
|
246
|
-
if not action_match:
|
247
|
-
return
|
247
|
+
|
248
248
|
try:
|
249
|
+
action_match = re.search(f"({self.action_name}):", generated_text)
|
250
|
+
if not action_match:
|
251
|
+
return
|
249
252
|
slot_from = re.search(r" from (\[[ABCI]?\d+\])", generated_text).group(1)
|
250
253
|
slot_to = re.search(r" to (\[[ABCI]?\d+\])", generated_text).group(1)
|
251
254
|
quantity = re.search(r"with quantity (\d+)", generated_text).group(1)
|
@@ -255,8 +258,10 @@ class SmeltActionHandler(ActionHandlerBase):
|
|
255
258
|
quantity=quantity,
|
256
259
|
)
|
257
260
|
return action
|
258
|
-
except AttributeError
|
259
|
-
return
|
261
|
+
except AttributeError:
|
262
|
+
return (
|
263
|
+
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
264
|
+
)
|
260
265
|
|
261
266
|
|
262
267
|
class ImpossibleActionHandler(ActionHandlerBase):
|
@@ -276,11 +281,16 @@ class ImpossibleActionHandler(ActionHandlerBase):
|
|
276
281
|
"""
|
277
282
|
Parse the raw model response to a StopAction
|
278
283
|
"""
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
+
try:
|
285
|
+
action_match = re.search(f"({self.action_name}):", generated_text)
|
286
|
+
if not action_match:
|
287
|
+
return
|
288
|
+
reason = re.search(r"impossible: (.*)", generated_text).group(1)
|
289
|
+
return StopAction(reason=reason)
|
290
|
+
except AttributeError:
|
291
|
+
return (
|
292
|
+
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
293
|
+
)
|
284
294
|
|
285
295
|
|
286
296
|
class ThinkActionHandler(ActionHandlerBase):
|
@@ -300,7 +310,12 @@ class ThinkActionHandler(ActionHandlerBase):
|
|
300
310
|
"""
|
301
311
|
Parse the raw model response to a ThinkAction
|
302
312
|
"""
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
313
|
+
try:
|
314
|
+
action_match = re.search(f"({self.action_name}):", generated_text)
|
315
|
+
if not action_match:
|
316
|
+
return
|
317
|
+
return "Ok"
|
318
|
+
except AttributeError:
|
319
|
+
return (
|
320
|
+
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
321
|
+
)
|
plancraft/environment/search.py
CHANGED
@@ -46,8 +46,14 @@ class GoldSearchActionHandler(ActionHandlerBase):
|
|
46
46
|
"""
|
47
47
|
Parse the raw model response to a SearchAction
|
48
48
|
"""
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
try:
|
50
|
+
action_match = re.search(f"({self.action_name}):", generated_text)
|
51
|
+
if not action_match:
|
52
|
+
return
|
53
|
+
|
54
|
+
search_target = re.search(r"search: *(\w+)", generated_text).group(1)
|
55
|
+
return gold_search_recipe(search_target)
|
56
|
+
except AttributeError:
|
57
|
+
return (
|
58
|
+
f"Format Error. Action be in the format: {self.prompt_format_example}"
|
59
|
+
)
|
@@ -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=VhPSRr0b1ySxb106TcBFdb3MdycxWwQGzqDnWQagm-8,10007
|
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=kk6t-MkpFGTL7I38GQ6H21BjW9qJLSNGMbJqvZhr1LE,2035
|
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=tMp9mTwD70T3qohj-LZhJFjHYWyiVHDh8gu27asVimI,1342
|
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.17.dist-info/METADATA,sha256=DhUcHfnj_fMJTnHQVQVl50RpM3mwPCdFHOFNQtCo39c,11148
|
1924
|
+
plancraft-0.3.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
1925
|
+
plancraft-0.3.17.dist-info/licenses/LICENSE,sha256=YGR8ehDB4t-T-lOQKMfKNR-2zsOU7E3E5NA8t25HKE0,1070
|
1926
|
+
plancraft-0.3.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|