add logger
This commit is contained in:
parent
8d2ee13a47
commit
7202a82923
2 changed files with 18 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
from vocode.turn_based.agent.base_agent import BaseAgent
|
||||
from vocode.turn_based.input_device.base_input_device import (
|
||||
BaseInputDevice,
|
||||
|
|
@ -15,6 +16,7 @@ class TurnBasedConversation:
|
|||
agent: BaseAgent,
|
||||
synthesizer: BaseSynthesizer,
|
||||
output_device: BaseOutputDevice,
|
||||
logger: logging.Logger = None,
|
||||
):
|
||||
self.input_device = input_device
|
||||
self.transcriber = transcriber
|
||||
|
|
@ -22,6 +24,7 @@ class TurnBasedConversation:
|
|||
self.synthesizer = synthesizer
|
||||
self.output_device = output_device
|
||||
self.maybe_play_initial_message()
|
||||
self.logger = logger or logging.getLogger(__name__)
|
||||
|
||||
def maybe_play_initial_message(self):
|
||||
if self.agent.initial_message:
|
||||
|
|
@ -34,5 +37,7 @@ class TurnBasedConversation:
|
|||
|
||||
def end_speech_and_respond(self):
|
||||
human_input = self.transcriber.transcribe(self.input_device.end_listening())
|
||||
self.logger.info(f"Transcription: {human_input}")
|
||||
agent_response = self.agent.respond(human_input)
|
||||
self.logger.info(f"Agent response: {agent_response}")
|
||||
self.output_device.send_audio(self.synthesizer.synthesize(agent_response))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue