Skip to content

Commit

Permalink
chore: fixed type hints for python 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
djcowley committed Oct 16, 2023
1 parent 4b4a29c commit 6eca72a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions rasa/dialogue_understanding/generator/llm_command_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import importlib.resources
import re
from typing import Dict, Any, Optional, List, Union
from typing import Dict, Any, List, Optional, Tuple, Union

from jinja2 import Template
import structlog
Expand Down Expand Up @@ -396,7 +396,7 @@ def is_extractable(
)
)

def allowed_values_for_slot(self, slot: Slot) -> Optional[str]:
def allowed_values_for_slot(self, slot: Slot) -> Union[str, None]:
"""Get the allowed values for a slot."""
if isinstance(slot, BooleanSlot):
return str([True, False])
Expand Down Expand Up @@ -425,6 +425,16 @@ def get_slot_value(tracker: DialogueStateTracker, slot_name: str) -> str:
def prepare_current_flow_slots_for_template(
self, top_flow: Flow, current_step: FlowStep, tracker: DialogueStateTracker
) -> List[Dict[str, Any]]:
"""Prepare the current flow slots for the template.
Args:
top_flow: The top flow.
current_step: The current step in the flow.
tracker: The tracker containing the current state of the conversation.
Returns:
The slots with values, types, allowed values and a description.
"""
if top_flow is not None:
flow_slots = [
{
Expand All @@ -445,7 +455,7 @@ def prepare_current_flow_slots_for_template(

def prepare_current_slot_for_template(
self, current_step: FlowStep
) -> tuple[Optional[str], Optional[str]]:
) -> Tuple[Union[str, None], Union[str, None]]:
"""Prepare the current slot for the template."""
return (
(current_step.collect, current_step.description)
Expand Down

0 comments on commit 6eca72a

Please sign in to comment.