Skip to content

Commit

Permalink
fix action prompt and prompt event actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jun 2, 2024
1 parent 6431609 commit fec907e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion taleweave/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class PromptEvent(BaseModel):
A prompt for a character to take an action.
"""

actions: Dict[str, Any]
actions: List[Dict[str, Any]]
prompt: str
room: Room
character: Character
Expand Down
2 changes: 1 addition & 1 deletion taleweave/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __call__(self, prompt: str, toolbox: Toolbox | None = None, **kwargs) -> str
Ask the player for input.
"""

actions = {}
actions = []
formatted_prompt = prompt.format(**kwargs)
if toolbox:
actions = toolbox.list_definitions()
Expand Down
26 changes: 13 additions & 13 deletions taleweave/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,19 @@ def result_parser(value, **kwargs):
logger.info("starting turn for character: %s", character.name)
result = loop_retry(
agent,
get_prompt("world_simulate_character_action"),
context={
"actions": action_names,
"character_items": character_items,
"attributes": character_attributes,
"directions": room_directions,
"room_name": room.name,
"room_description": describe_entity(room),
"visible_characters": room_characters,
"visible_items": room_items,
"notes_prompt": notes_prompt,
"events_prompt": events_prompt,
},
format_prompt(
"world_simulate_character_action",
actions=action_names,
character_items=character_items,
attributes=character_attributes,
directions=room_directions,
room_name=room.name,
room_description=describe_entity(room),
visible_characters=room_characters,
visible_items=room_items,
notes_prompt=notes_prompt,
events_prompt=events_prompt,
),
result_parser=result_parser,
toolbox=action_toolbox,
)
Expand Down

0 comments on commit fec907e

Please sign in to comment.