Skip to content

Commit 5dc582d

Browse files
ajar98levity
andauthored
[updated PR] Multiple agents per router (vocodedev#297)
* instantiate a new agent for each conversation * update client_backend to use agent_thunk * Undo change to apps/client_backend/main.py * remove mypy checking on apps since the versions will sometimes not match up --------- Co-authored-by: Lawrence Wang <l@lw.io>
1 parent 4183729 commit 5dc582d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
python -m poetry run mypy -p vocode
5353
python -m poetry run mypy -p quickstarts
5454
python -m poetry run mypy -p playground
55-
python -m poetry run mypy -p apps
5655
5756
- name: Test with pytest
5857
run: |

vocode/streaming/client_backend/conversation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
class ConversationRouter(BaseRouter):
3838
def __init__(
3939
self,
40-
agent: BaseAgent,
40+
agent_thunk: Callable[[], BaseAgent],
4141
transcriber_thunk: Callable[
4242
[InputAudioConfig], BaseTranscriber
4343
] = lambda input_audio_config: DeepgramTranscriber(
@@ -58,7 +58,7 @@ def __init__(
5858
):
5959
super().__init__()
6060
self.transcriber_thunk = transcriber_thunk
61-
self.agent = agent
61+
self.agent_thunk = agent_thunk
6262
self.synthesizer_thunk = synthesizer_thunk
6363
self.logger = logger or logging.getLogger(__name__)
6464
self.router = APIRouter()
@@ -75,7 +75,7 @@ def get_conversation(
7575
return StreamingConversation(
7676
output_device=output_device,
7777
transcriber=transcriber,
78-
agent=self.agent,
78+
agent=self.agent_thunk(),
7979
synthesizer=synthesizer,
8080
conversation_id=start_message.conversation_id,
8181
events_manager=TranscriptEventManager(output_device, self.logger)

0 commit comments

Comments
 (0)