v0 of user rolled AI
This commit is contained in:
parent
d9f12ec0de
commit
37b5ffd674
8 changed files with 90 additions and 21 deletions
|
|
@ -5,24 +5,16 @@ 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
|
||||
from vocode.models.agent import ChatGPTAgentConfig, RESTfulUserImplementedAgentConfig, WebSocketUserImplementedAgentConfig
|
||||
from vocode.models.synthesizer import AzureSynthesizerConfig
|
||||
from vocode.user_implemented_agent.restful_agent import RESTfulAgent
|
||||
|
||||
logging.basicConfig()
|
||||
logging.root.setLevel(logging.INFO)
|
||||
|
||||
class EchoAgent(RESTfulAgent):
|
||||
|
||||
async def respond(self, input: str) -> str:
|
||||
return input
|
||||
|
||||
if __name__ == "__main__":
|
||||
import threading
|
||||
|
||||
microphone_input, speaker_output = create_microphone_input_and_speaker_output(use_first_available_device=False)
|
||||
user_agent_thread = threading.Thread(target=EchoAgent().run)
|
||||
user_agent_thread.start()
|
||||
|
||||
conversation = Conversation(
|
||||
input_device=microphone_input,
|
||||
|
|
@ -32,7 +24,7 @@ if __name__ == "__main__":
|
|||
initial_message="Hello!",
|
||||
generate_responses=False,
|
||||
respond=RESTfulUserImplementedAgentConfig.EndpointConfig(
|
||||
url="http://localhost:3001/respond",
|
||||
url="http://a6eb64f4a9b7.ngrok.io/respond",
|
||||
method="POST"
|
||||
)
|
||||
),
|
||||
|
|
@ -40,5 +32,4 @@ if __name__ == "__main__":
|
|||
)
|
||||
signal.signal(signal.SIGINT, lambda _0, _1: conversation.deactivate())
|
||||
asyncio.run(conversation.start())
|
||||
user_agent_thread.join()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue