Skip to content

Commit

Permalink
phrase trigger matcher returns agent config instead of type (vocodede…
Browse files Browse the repository at this point in the history
  • Loading branch information
adnaans authored Jul 9, 2024
1 parent 6198f7b commit 18761bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions vocode/streaming/agent/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,13 @@ async def handle_generate_response(
),
)

phrase_trigger_match = (
phrase_trigger_match_action_config = (
matches_phrase_trigger(responses_buffer, self.agent_config.actions)
if self.agent_config.actions
else None
)
if phrase_trigger_match:
action_config = self._get_action_config(phrase_trigger_match)
assert action_config is not None
action = self.action_factory.create_action(action_config)
if phrase_trigger_match_action_config:
action = self.action_factory.create_action(phrase_trigger_match_action_config)
action_input = self.create_action_input(
action,
agent_input,
Expand Down
4 changes: 2 additions & 2 deletions vocode/streaming/agent/phrase_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def matches_phrase_trigger(
message: str,
action_configs: List[ActionConfig],
) -> Optional[str]:
) -> Optional[ActionConfig]:
cleaned = re.sub(r"[^\w\s]", "", message.lower())
for action_config in action_configs:
if not isinstance(action_config.action_trigger, PhraseBasedActionTrigger):
Expand All @@ -17,5 +17,5 @@ def matches_phrase_trigger(
lowered = phrase_trigger.phrase.lower()
for condition in phrase_trigger.conditions:
if condition == "phrase_condition_type_contains" and lowered in cleaned:
return action_config.type
return action_config
return None

0 comments on commit 18761bb

Please sign in to comment.