diff --git a/examples/streaming_conversation.py b/examples/streaming_conversation.py index c0be5be..662fce3 100644 --- a/examples/streaming_conversation.py +++ b/examples/streaming_conversation.py @@ -46,17 +46,17 @@ async def main(): conversation = StreamingConversation( output_device=speaker_output, - transcriber=DeepgramTranscriberConfig.from_input_device( + transcriber_config=DeepgramTranscriberConfig.from_input_device( microphone_input, endpointing_config=PunctuationEndpointingConfig() ), - agent=ChatGPTAgentConfig( + 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, cut_off_response=CutOffResponse(), ), - synthesizer=AzureSynthesizerConfig.from_output_device(speaker_output), + synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output), logger=logger, ) await conversation.start() diff --git a/vocode/streaming/agent/bot_sentiment_analyser.py b/vocode/streaming/agent/bot_sentiment_analyser.py index c8ec3b0..729532b 100644 --- a/vocode/streaming/agent/bot_sentiment_analyser.py +++ b/vocode/streaming/agent/bot_sentiment_analyser.py @@ -3,6 +3,8 @@ from langchain.llms import OpenAI from langchain.prompts import PromptTemplate from pydantic import BaseModel +from vocode import getenv + TEMPLATE = """ Read the following conversation classify the final emotion of the Bot as one of [{emotions}]. Output the degree of emotion as a value between 0 and 1 in the format EMOTION,DEGREE: ex. {example_emotion},0.5 @@ -22,7 +24,7 @@ class BotSentimentAnalyser: def __init__(self, emotions: list[str], model_name: str = "text-davinci-003"): self.model_name = model_name self.llm = OpenAI( - model_name=self.model_name, + model_name=self.model_name, openai_api_key=getenv("OPENAI_API_KEY") ) assert len(emotions) > 0 self.emotions = [e.lower() for e in emotions] diff --git a/vocode/streaming/agent/chat_gpt_agent.py b/vocode/streaming/agent/chat_gpt_agent.py index 623350b..d9c3603 100644 --- a/vocode/streaming/agent/chat_gpt_agent.py +++ b/vocode/streaming/agent/chat_gpt_agent.py @@ -57,6 +57,7 @@ class ChatGPTAgent(BaseAgent): model_name=self.agent_config.model_name, temperature=self.agent_config.temperature, max_tokens=self.agent_config.max_tokens, + openai_api_key=openai.api_key, ) self.conversation = ConversationChain( memory=self.memory, prompt=self.prompt, llm=self.llm diff --git a/vocode/streaming/agent/llm_agent.py b/vocode/streaming/agent/llm_agent.py index 9810239..5289115 100644 --- a/vocode/streaming/agent/llm_agent.py +++ b/vocode/streaming/agent/llm_agent.py @@ -5,6 +5,7 @@ from langchain import OpenAI from langchain.llms import OpenAIChat from typing import Generator import logging +from vocode import getenv from vocode.streaming.agent.base_agent import BaseAgent from vocode.streaming.agent.utils import stream_llm_response @@ -43,6 +44,7 @@ class LLMAgent(BaseAgent): model_name=self.agent_config.model_name, temperature=self.agent_config.temperature, max_tokens=self.agent_config.max_tokens, + openai_api_key=getenv("OPENAI_API_KEY"), ) self.stop_tokens = [f"{recipient}:"] self.first_response = (