aboutsummaryrefslogtreecommitdiff
path: root/speller_agent.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2023-10-13 19:56:39 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2023-10-13 19:56:39 -0600
commitb919f2dcabc8dcba41f7e309b2d4eccd8cc0d87e (patch)
treebc3aa43c748e212f074bc82fa3621a7fbdec13a0 /speller_agent.py
parent2c670084b3ea2628e9b4d874f3b858e7945ed737 (diff)
ooga chaga
Diffstat (limited to 'speller_agent.py')
-rw-r--r--speller_agent.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/speller_agent.py b/speller_agent.py
new file mode 100644
index 0000000..9328e88
--- /dev/null
+++ b/speller_agent.py
@@ -0,0 +1,39 @@
+import logging
+from typing import Optional, Tuple
+import typing
+from vocode.streaming.agent.chat_gpt_agent import ChatGPTAgent
+from vocode.streaming.models.agent import AgentConfig, AgentType, ChatGPTAgentConfig
+from vocode.streaming.agent.base_agent import BaseAgent, RespondAgent
+from vocode.streaming.agent.factory import AgentFactory
+
+
+class SpellerAgentConfig(AgentConfig, type="agent_speller"):
+ pass
+
+
+class SpellerAgent(RespondAgent[SpellerAgentConfig]):
+ def __init__(self, agent_config: SpellerAgentConfig):
+ super().__init__(agent_config=agent_config)
+
+ async def respond(
+ self,
+ human_input,
+ conversation_id: str,
+ is_interrupt: bool = False,
+ ) -> Tuple[Optional[str], bool]:
+ return "".join(c + " " for c in human_input), False
+
+
+class SpellerAgentFactory(AgentFactory):
+ def create_agent(
+ self, agent_config: AgentConfig, logger: Optional[logging.Logger] = None
+ ) -> BaseAgent:
+ if agent_config.type == AgentType.CHAT_GPT:
+ return ChatGPTAgent(
+ agent_config=typing.cast(ChatGPTAgentConfig, agent_config)
+ )
+ elif agent_config.type == "agent_speller":
+ return SpellerAgent(
+ agent_config=typing.cast(SpellerAgentConfig, agent_config)
+ )
+ raise Exception("Invalid agent config") \ No newline at end of file