remove pyq goodbye model and rime synthesizer and fix environment loading

This commit is contained in:
Ajay Raj 2023-03-28 10:20:36 -07:00
commit 1dc7bc74c3
28 changed files with 143 additions and 285 deletions

View file

@ -2,14 +2,15 @@ import asyncio
import logging
import signal
from dotenv import load_dotenv
import os
load_dotenv()
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,
GoogleTranscriberConfig,
)
from vocode.streaming.models.agent import (
ChatGPTAgentConfig,
@ -23,10 +24,6 @@ from vocode.streaming.models.agent import (
)
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
import vocode
load_dotenv()
vocode.api_key = os.getenv("VOCODE_API_KEY")
logging.basicConfig()
logging.root.setLevel(logging.INFO)
@ -41,7 +38,8 @@ if __name__ == "__main__":
input_device=microphone_input,
output_device=speaker_output,
transcriber_config=DeepgramTranscriberConfig.from_input_device(
microphone_input
microphone_input,
endpointing_config=PunctuationEndpointingConfig(),
),
agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="Hello!"),

View file

@ -2,7 +2,9 @@ import asyncio
import logging
import signal
from dotenv import load_dotenv
import os
load_dotenv()
from vocode.streaming.agent.chat_gpt_agent import ChatGPTAgent
from vocode.streaming.streaming_conversation import StreamingConversation
from vocode.helpers import create_microphone_input_and_speaker_output
@ -31,8 +33,6 @@ import vocode
from vocode.streaming.synthesizer.azure_synthesizer import AzureSynthesizer
from vocode.streaming.transcriber.deepgram_transcriber import DeepgramTranscriber
load_dotenv()
vocode.api_key = os.getenv("VOCODE_API_KEY")
logging.basicConfig()
logger = logging.getLogger(__name__)
@ -46,23 +46,17 @@ async def main():
conversation = StreamingConversation(
output_device=speaker_output,
transcriber=DeepgramTranscriber(
DeepgramTranscriberConfig.from_input_device(
microphone_input, endpointing_config=PunctuationEndpointingConfig()
)
transcriber=DeepgramTranscriberConfig.from_input_device(
microphone_input, endpointing_config=PunctuationEndpointingConfig()
),
agent=ChatGPTAgent(
ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"),
prompt_preamble="""You are a helpful gen Z AI assistant. You use slang like um, but, and like a LOT. All of your responses are 10 words or less. Be super chill, use slang like
agent=ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"),
prompt_preamble="""You are a helpful gen Z AI assistant. You use slang like um, but, and like a LOT. All of your responses are 10 words or less. Be super chill, use slang like
hella, down, fire, totally, but like, slay, vibing, queen, go off, bet, sus, simp, cap, big yikes, main character, dank""",
generate_responses=True,
cut_off_response=CutOffResponse(),
)
),
synthesizer=AzureSynthesizer(
AzureSynthesizerConfig.from_output_device(speaker_output),
generate_responses=True,
cut_off_response=CutOffResponse(),
),
synthesizer=AzureSynthesizerConfig.from_output_device(speaker_output),
logger=logger,
)
await conversation.start()

View file

@ -1,7 +1,7 @@
import logging
from fastapi import FastAPI
import os
from dotenv import load_dotenv
from vocode import getenv
load_dotenv()
@ -34,13 +34,12 @@ telephony_server = TelephonyServer(
url="/inbound_call",
agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"),
prompt_preamble="""You are a helpful gen Z AI assistant. You use slang like um, but, and like a LOT. All of your responses are 10 words or less. Be super chill, use slang like
hella, down, fire, totally, but like, slay, vibing, queen, go off, bet, sus, simp, cap, big yikes, main character, dank""",
prompt_preamble="Have a pleasant conversation about life",
generate_responses=True,
),
twilio_config=TwilioConfig(
account_sid=os.getenv("TWILIO_ACCOUNT_SID"),
auth_token=os.getenv("TWILIO_AUTH_TOKEN"),
account_sid=getenv("TWILIO_ACCOUNT_SID"),
auth_token=getenv("TWILIO_AUTH_TOKEN"),
),
)
],
@ -49,21 +48,22 @@ hella, down, fire, totally, but like, slay, vibing, queen, go off, bet, sus,
app.include_router(telephony_server.get_router())
# outbound_call = OutboundCall(
# base_url=BASE_URL,
# to_phone="+14088926228",
# from_phone="+14086600744",
# config_manager=config_manager,
# agent_config=ChatGPTAgentConfig(
# initial_message=BaseMessage(text="What up"),
# prompt_preamble="""You are a helpful gen Z AI assistant. You use slang like um, but, and like a LOT. All of your responses are 10 words or less. Be super chill, use slang like
# hella, down, fire, totally, but like, slay, vibing, queen, go off, bet, sus, simp, cap, big yikes, main character, dank""",
# generate_responses=True,
# ),
# twilio_config=TwilioConfig(
# account_sid=os.getenv("TWILIO_ACCOUNT_SID"),
# auth_token=os.getenv("TWILIO_AUTH_TOKEN"),
# ),
# logger=logger,
# )
# outbound_call.start()
outbound_call = OutboundCall(
base_url=BASE_URL,
to_phone="+14088926228",
from_phone="+14086600744",
config_manager=config_manager,
agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"),
prompt_preamble="Have a pleasant conversation about life",
generate_responses=True,
),
twilio_config=TwilioConfig(
account_sid=getenv("TWILIO_ACCOUNT_SID"),
auth_token=getenv("TWILIO_AUTH_TOKEN"),
),
logger=logger,
)
input("Press enter to start call...")
outbound_call.start()

View file

@ -1,6 +1,6 @@
import logging
from dotenv import load_dotenv
import os
from vocode import getenv
from vocode.helpers import create_microphone_input_and_speaker_output
from vocode.turn_based.agent.chat_gpt_agent import ChatGPTAgent
from vocode.turn_based.synthesizer.azure_synthesizer import AzureSynthesizer
@ -25,15 +25,15 @@ if __name__ == "__main__":
conversation = TurnBasedConversation(
input_device=microphone_input,
output_device=speaker_output,
transcriber=WhisperTranscriber(api_key=os.getenv("OPENAI_API_KEY")),
transcriber=WhisperTranscriber(api_key=getenv("OPENAI_API_KEY")),
agent=ChatGPTAgent(
system_prompt="The AI is having a pleasant conversation about life",
initial_message="Hello!",
api_key=os.getenv("OPENAI_API_KEY"),
api_key=getenv("OPENAI_API_KEY"),
),
synthesizer=ElevenLabsSynthesizer(
voice_id=ADAM_VOICE_ID,
api_key=os.getenv("ELEVEN_LABS_API_KEY"),
api_key=getenv("ELEVEN_LABS_API_KEY"),
),
logger=logger,
)