From 84989044088dc4f7b0e3ab1fcbc45d518512033e Mon Sep 17 00:00:00 2001 From: Ajay Raj Date: Tue, 28 Mar 2023 13:51:38 -0700 Subject: [PATCH] Update README.md --- README.md | 98 +++++++++++++++++++++++++++---------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index c395751..babf01e 100644 --- a/README.md +++ b/README.md @@ -36,55 +36,6 @@ Vocode is an open source library that makes it easy to build voice-based LLM app Check out our React SDK [here](https://github.com/vocodedev/vocode-react-sdk)! -# ☁️ Quickstart (Hosted) - -First, get a *free* API key from our [dashboard](https://app.vocode.dev). - -```bash -pip install 'vocode[io]' -``` - -```python -import asyncio -import signal - -import vocode -from vocode.streaming.hosted_streaming_conversation import HostedStreamingConversation -from vocode.streaming.streaming_conversation import StreamingConversation -from vocode.helpers import create_microphone_input_and_speaker_output -from vocode.streaming.models.transcriber import ( - DeepgramTranscriberConfig, - PunctuationEndpointingConfig, -) -from vocode.streaming.models.agent import ChatGPTAgentConfig -from vocode.streaming.models.message import BaseMessage -from vocode.streaming.models.synthesizer import AzureSynthesizerConfig - -vocode.api_key = "" - - -if __name__ == "__main__": - microphone_input, speaker_output = create_microphone_input_and_speaker_output( - streaming=True, use_default_devices=False - ) - - conversation = HostedStreamingConversation( - input_device=microphone_input, - output_device=speaker_output, - transcriber_config=DeepgramTranscriberConfig.from_input_device( - microphone_input, - endpointing_config=PunctuationEndpointingConfig(), - ), - agent_config=ChatGPTAgentConfig( - initial_message=BaseMessage(text="Hello!"), - prompt_preamble="Have a pleasant conversation about life", - ), - synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output), - ) - signal.signal(signal.SIGINT, lambda _0, _1: conversation.deactivate()) - asyncio.run(conversation.start()) -``` - # 🚀 Quickstart (Self-hosted) ```bash @@ -145,6 +96,55 @@ if __name__ == "__main__": asyncio.run(main()) ``` +# ☁️ Quickstart (Hosted) + +First, get a *free* API key from our [dashboard](https://app.vocode.dev). + +```bash +pip install 'vocode[io]' +``` + +```python +import asyncio +import signal + +import vocode +from vocode.streaming.hosted_streaming_conversation import HostedStreamingConversation +from vocode.streaming.streaming_conversation import StreamingConversation +from vocode.helpers import create_microphone_input_and_speaker_output +from vocode.streaming.models.transcriber import ( + DeepgramTranscriberConfig, + PunctuationEndpointingConfig, +) +from vocode.streaming.models.agent import ChatGPTAgentConfig +from vocode.streaming.models.message import BaseMessage +from vocode.streaming.models.synthesizer import AzureSynthesizerConfig + +vocode.api_key = "" + + +if __name__ == "__main__": + microphone_input, speaker_output = create_microphone_input_and_speaker_output( + streaming=True, use_default_devices=False + ) + + conversation = HostedStreamingConversation( + input_device=microphone_input, + output_device=speaker_output, + transcriber_config=DeepgramTranscriberConfig.from_input_device( + microphone_input, + endpointing_config=PunctuationEndpointingConfig(), + ), + agent_config=ChatGPTAgentConfig( + initial_message=BaseMessage(text="Hello!"), + prompt_preamble="Have a pleasant conversation about life", + ), + synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output), + ) + signal.signal(signal.SIGINT, lambda _0, _1: conversation.deactivate()) + asyncio.run(conversation.start()) +``` + # 📞 Phone call quickstarts - [Inbound calls - Hosted](https://docs.vocode.dev/telephony#inbound-calls)