Skip to content

Commit

Permalink
Use old code from ActionAgent (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
HHousen authored Jul 25, 2023
1 parent 6983a23 commit 61617f5
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions vocode/streaming/agent/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,15 @@ async def process(self, item: InterruptibleEvent[AgentInput]):
assert self.transcript is not None
try:
agent_input = item.payload
if isinstance(agent_input, ActionResultAgentInput):
if isinstance(agent_input, TranscriptionAgentInput):
transcription = typing.cast(
TranscriptionAgentInput, agent_input
).transcription
self.transcript.add_human_message(
text=transcription.message,
conversation_id=agent_input.conversation_id,
)
elif isinstance(agent_input, ActionResultAgentInput):
self.transcript.add_action_finish_log(
action_input=agent_input.action_input,
action_output=agent_input.action_output,
Expand All @@ -261,15 +269,14 @@ async def process(self, item: InterruptibleEvent[AgentInput]):
# Do not generate a response to quiet actions
self.logger.debug("Action is quiet, skipping response generation")
return
if agent_input.type != AgentInputType.TRANSCRIPTION:
return
transcription = typing.cast(
TranscriptionAgentInput, agent_input
).transcription
self.transcript.add_human_message(
text=transcription.message,
conversation_id=agent_input.conversation_id,
)
transcription = Transcription(
message=agent_input.action_output.response.json(),
confidence=1.0,
is_final=True,
)
else:
raise ValueError("Invalid AgentInput type")

goodbye_detected_task = None
if self.agent_config.end_conversation_on_goodbye:
goodbye_detected_task = self.create_goodbye_detection_task(
Expand Down

0 comments on commit 61617f5

Please sign in to comment.