Skip to content

Commit

Permalink
Move terminate code to base_agent
Browse files Browse the repository at this point in the history
  • Loading branch information
HHousen committed Aug 1, 2023
1 parent e1773cb commit 4cccaf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 9 additions & 0 deletions vocode/streaming/agent/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ async def get_tracer_name_start(self) -> str:
self.tracer_name_start: str = tracer_name_start
return tracer_name_start

def terminate(self):
if (
hasattr(self.agent_config, "vector_db_config")
and self.agent_config.vector_db_config
):
self.logger.debug("Terminating vector db")
self.vector_db.tear_down()
return super().terminate()

async def respond(
self,
human_input,
Expand Down
3 changes: 0 additions & 3 deletions vocode/streaming/streaming_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,6 @@ async def terminate(self):
await self.synthesizer.tear_down()
self.logger.debug("Terminating agent")
self.agent.terminate()
if hasattr(self.agent.agent_config, "vector_db_config") and self.agent.agent_config.vector_db_config:
self.logger.debug("Terminating vector db")
self.agent.vector_db.tear_down()
self.logger.debug("Terminating output device")
self.output_device.terminate()
self.logger.debug("Terminating speech transcriber")
Expand Down

0 comments on commit 4cccaf9

Please sign in to comment.