Skip to content

Commit

Permalink
adds initial message in chat playground (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajar98 authored Aug 6, 2023
1 parent 4ef940c commit 76fc257
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions playground/streaming/agent/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.transcript import Transcript
from vocode.streaming.utils.state_manager import ConversationStateManager
from vocode.streaming.utils.worker import InterruptibleAgentResponseEvent

load_dotenv()

from vocode.streaming.agent import *
from vocode.streaming.agent import ChatGPTAgent
from vocode.streaming.agent.base_agent import (
BaseAgent,
AgentResponseMessage,
Expand All @@ -30,7 +31,7 @@
from vocode.streaming.utils import create_conversation_id


class ShoutActionConfig(ActionConfig, type="shout"):
class ShoutActionConfig(ActionConfig, type="shout"): # type: ignore
num_exclamation_marks: int


Expand Down Expand Up @@ -152,6 +153,15 @@ async def agent_main():
)
agent.attach_conversation_state_manager(DummyConversationManager(conversation=None))
agent.attach_transcript(transcript)
if agent.agent_config.initial_message is not None:
agent.output_queue.put_nowait(
InterruptibleAgentResponseEvent(
payload=AgentResponseMessage(
message=agent.agent_config.initial_message
),
agent_response_tracker=asyncio.Event(),
)
)
agent.start()

try:
Expand Down

0 comments on commit 76fc257

Please sign in to comment.