update example + add chatgpt configs
This commit is contained in:
parent
daa25f78da
commit
477ea8407e
3 changed files with 15 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ import signal
|
|||
from vocode.conversation import Conversation
|
||||
from vocode.helpers import create_microphone_input_and_speaker_output
|
||||
from vocode.models.transcriber import DeepgramTranscriberConfig
|
||||
from vocode.models.agent import ChatGPTAgentConfig, RESTfulUserImplementedAgentConfig, WebSocketUserImplementedAgentConfig, EchoAgentConfig
|
||||
from vocode.models.agent import ChatGPTAgentConfig, RESTfulUserImplementedAgentConfig, WebSocketUserImplementedAgentConfig, EchoAgentConfig, ChatGPTAlphaAgentConfig, ChatGPTAgentConfig
|
||||
from vocode.models.synthesizer import AzureSynthesizerConfig
|
||||
from vocode.user_implemented_agent.restful_agent import RESTfulAgent
|
||||
|
||||
|
|
@ -14,15 +14,17 @@ logging.root.setLevel(logging.INFO)
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
microphone_input, speaker_output = create_microphone_input_and_speaker_output(use_default_devices=True)
|
||||
microphone_input, speaker_output = create_microphone_input_and_speaker_output(use_default_devices=False)
|
||||
|
||||
conversation = Conversation(
|
||||
input_device=microphone_input,
|
||||
output_device=speaker_output,
|
||||
transcriber_config=DeepgramTranscriberConfig.from_input_device(microphone_input),
|
||||
agent_config=EchoAgentConfig(
|
||||
agent_config=WebSocketUserImplementedAgentConfig(
|
||||
initial_message="Hello!",
|
||||
generate_responses=False,
|
||||
respond=WebSocketUserImplementedAgentConfig.RouteConfig(
|
||||
url="wss://a8ea877c9548.ngrok.io/respond"
|
||||
)
|
||||
),
|
||||
synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ from vocode.user_implemented_agent.websocket_agent import WebSocketAgent
|
|||
class EchoAgent(WebSocketAgent):
|
||||
|
||||
async def respond(self, input: str) -> str:
|
||||
return input
|
||||
print(input)
|
||||
return ''.join(i + j for i, j in zip(input, ' ' * len(input)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
agent = EchoAgent()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from .model import TypedModel, BaseModel
|
|||
class AgentType(str, Enum):
|
||||
BASE = "base"
|
||||
LLM = "llm"
|
||||
CHAT_GPT_ALPHA = "chat_gpt_alpha"
|
||||
CHAT_GPT = "chat_gpt"
|
||||
ECHO = "echo"
|
||||
INFORMATION_RETRIEVAL = "information_retrieval"
|
||||
|
|
@ -21,9 +22,14 @@ class LLMAgentConfig(AgentConfig, type=AgentType.LLM):
|
|||
prompt_preamble: str
|
||||
expected_first_prompt: Optional[str] = None
|
||||
|
||||
class ChatGPTAlphaAgentConfig(AgentConfig, type=AgentType.CHAT_GPT_ALPHA):
|
||||
prompt_preamble: str
|
||||
expected_first_prompt: Optional[str] = None
|
||||
|
||||
class ChatGPTAgentConfig(AgentConfig, type=AgentType.CHAT_GPT):
|
||||
prompt_preamble: str
|
||||
expected_first_prompt: Optional[str] = None
|
||||
generate_responses: bool = False
|
||||
|
||||
class InformationRetrievalAgentConfig(
|
||||
AgentConfig, type=AgentType.INFORMATION_RETRIEVAL
|
||||
|
|
@ -90,4 +96,4 @@ class AgentReadyMessage(WebSocketAgentMessage, type=WebSocketAgentMessageType.AG
|
|||
pass
|
||||
|
||||
class AgentStopMessage(WebSocketAgentMessage, type=WebSocketAgentMessageType.AGENT_STOP):
|
||||
pass
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue