From 571d538eb20ef4017aa5185968f06660924d8178 Mon Sep 17 00:00:00 2001 From: James Hush Date: Tue, 19 Nov 2024 15:46:28 +0800 Subject: [PATCH] This seems to all work? --- examples/foundational/bad-snippet.log | 56 +++++++++++++++++++++++++++ examples/foundational/bigly.py | 52 ++++++++++++++++++++----- src/pipecat/services/ai_services.py | 2 +- src/pipecat/services/openai.py | 8 ++-- 4 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 examples/foundational/bad-snippet.log diff --git a/examples/foundational/bad-snippet.log b/examples/foundational/bad-snippet.log new file mode 100644 index 000000000..0f0e36cf4 --- /dev/null +++ b/examples/foundational/bad-snippet.log @@ -0,0 +1,56 @@ +BAD + +2024-11-18 20:36:51.394 | DEBUG | pipecat.transports.base_input:_handle_interruptions:124 - User started speaking +_---_ai_services.py process_frame * frame: StartInterruptionFrame#13 +_____openai.py * return from push_aggregation__________ +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : StartInterruptionFrame#13 +_---_ai_services.py process_frame * frame: UserStartedSpeakingFrame#13 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStartedSpeakingFrame#13 +___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStartedSpeakingFrame#13 +2024-11-18 20:36:52.714 | DEBUG | pipecat.transports.base_input:_handle_interruptions:131 - User stopped speaking +_---_ai_services.py process_frame * frame: StopInterruptionFrame#13 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : StopInterruptionFrame#13 +___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : StopInterruptionFrame#13 +_---_ai_services.py process_frame * frame: UserStoppedSpeakingFrame#13 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStoppedSpeakingFrame#13 +___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStoppedSpeakingFrame#13 +_____openai.py * _process_context: tool_call_id +2024-11-18 20:36:52.715 | DEBUG | pipecat.services.openai:_stream_chat_completions:175 - Generating chat: [{"role": "system", "content": "Main Prompt", "name": "system"}, {"role": "assistant", "content": "I'm ready to help. What do you need assistance with today?"}, {"role": "user", "content": "Hello? Can you call me"}, {"role": "user", "content": "a meeting option?"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_vYUGnPvKR00EIZvqfQkKQ6ny", "function": {"name": "get_meeting_dates", "arguments": "{}"}, "type": "function"}]}, {"role": "tool", "content": "\"\\n \\\"1- 8AM Eastern on November 16 2024\\n\\n2- 9AM Eastern on November 16 2024\\n\\n3- 10AM Eastern on November 16 2024\\n\\n4- 11AM Eastern on November 16 2024\\n\\n5- 12PM Eastern on November 16 2024\\n\\n6- 1PM Eastern on November 16 2024\\n\\n7- 2PM Eastern on November 16 2024\\n\\n8- 3PM Eastern on November 16 2024\\n\\n9- 4PM Eastern on November 16 2024\\n\\n10- 5PM Eastern on November 16 2024\\n\\n11- 6PM Eastern on November 16 2024\\n\\n12- 7PM Eastern on November 16 2024\\n\\n\\\"\\n \"", "tool_call_id": "call_vYUGnPvKR00EIZvqfQkKQ6ny"}, {"role": "assistant", "content": "Here are the available meeting slots on November 16, 2024: 1. 8"}, {"role": "user", "content": "Can you tell me about a"}, {"role": "assistant", "content": "Could"}, {"role": "user", "content": "solar panel? Okay."}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_MNTgAllUH5r8qbrj7JfxxYDs", "function": {"name": "get_knowledge_base", "arguments": "{\"question\": \"solar panel\", \"reason\": \"GENERAL_QUESTION\"}"}, "type": "function"}]}, {"role": "tool", "content": "\"Sure! Here are some random facts that could be associated with a solar panel company: 1. **History**: The company was founded in 2008 by a group of renewable energy enthusiasts who wanted to make solar power more accessible to homeowners and businesses. 2. **Headquarters**: Their headquarters is a net-zero energy building powered entirely by their own solar panels, showcasing their commitment to sustainability. 3. **Products**: They produce three main types of solar panels: monocrystalline, polycrystalline, and thin-film, catering to different customer needs and budgets. 4. **Innovation**: The company holds patents for advanced solar cell technology that increases efficiency by 20% compared to industry standards. 5. **Global Reach**: They have installed solar systems in over 40 countries and have manufacturing plants on three continents.6. **Community Impact**: For every 100 solar panels sold, they donate a panel to a school or community center in underprivileged areas. 7. **Workforce**: The company employs over 5,000 people, 40% of whom are in research and development roles. 8. **Recognition**: They won the \\u201cGreen Energy Innovator of the Year\\u201d award in 2022 for their work on solar panels made from recycled materials. 9. **Sustainability**: Their panels are designed to last 25+ years and are 95% recyclable at the end of their life cycle. 10. **Customer Perks**: They offer a 25-year warranty and real-time monitoring systems that allow users to track energy production via an app. 11. **Mission Statement**: \\\"Empowering the world with clean energy, one panel at a time.\\\" 12. **Energy Production**: The combined output of all their installations generates enough electricity to power over 2 million homes annually. 13. **R&D Efforts**: They are actively working on integrating solar panels into everyday items like backpacks and electric vehicles. 14. **Solar Farms**: The company has partnered with governments to develop large-scale solar farms, including one that spans over 10,000 acres. 15. **Future Goals**: By 2030, they aim to make solar power the most affordable energy source worldwide. Would you like these customized for a specific scenario?\"", "tool_call_id": "call_MNTgAllUH5r8qbrj7JfxxYDs"}, {"role": "assistant", "content": "Here's some information related to"}, {"role": "user", "content": "Can you tell me"}, {"role": "user", "content": "about"}, {"role": "assistant", "content": "Could"}, {"role": "user", "content": "a solar panel."}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_41inbmYQzvhWSTU0cXd3EqRF", "function": {"name": "get_knowledge_base", "arguments": "{\"question\": \"about a solar panel\", \"reason\": \"GENERAL_QUESTION\"}"}, "type": "function"}]}, {"role": "tool", "content": "\"Sure! Here are some random facts that could be associated with a solar panel company: 1. **History**: The company was founded in 2008 by a group of renewable energy enthusiasts who wanted to make solar power more accessible to homeowners and businesses. 2. **Headquarters**: Their headquarters is a net-zero energy building powered entirely by their own solar panels, showcasing their commitment to sustainability. 3. **Products**: They produce three main types of solar panels: monocrystalline, polycrystalline, and thin-film, catering to different customer needs and budgets. 4. **Innovation**: The company holds patents for advanced solar cell technology that increases efficiency by 20% compared to industry standards. 5. **Global Reach**: They have installed solar systems in over 40 countries and have manufacturing plants on three continents.6. **Community Impact**: For every 100 solar panels sold, they donate a panel to a school or community center in underprivileged areas. 7. **Workforce**: The company employs over 5,000 people, 40% of whom are in research and development roles. 8. **Recognition**: They won the \\u201cGreen Energy Innovator of the Year\\u201d award in 2022 for their work on solar panels made from recycled materials. 9. **Sustainability**: Their panels are designed to last 25+ years and are 95% recyclable at the end of their life cycle. 10. **Customer Perks**: They offer a 25-year warranty and real-time monitoring systems that allow users to track energy production via an app. 11. **Mission Statement**: \\\"Empowering the world with clean energy, one panel at a time.\\\" 12. **Energy Production**: The combined output of all their installations generates enough electricity to power over 2 million homes annually. 13. **R&D Efforts**: They are actively working on integrating solar panels into everyday items like backpacks and electric vehicles. 14. **Solar Farms**: The company has partnered with governments to develop large-scale solar farms, including one that spans over 10,000 acres. 15. **Future Goals**: By 2030, they aim to make solar power the most affordable energy source worldwide. Would you like these customized for a specific scenario?\"", "tool_call_id": "call_41inbmYQzvhWSTU0cXd3EqRF"}, {"role": "assistant", "content": "Here's some information about solar panels and a related company: 1. **History**: The company began in 2008,"}, {"role": "user", "content": "Okay. Hey. Can you tell me what are my meeting time options?"}, {"role": "assistant", "content": "Here are your available meeting time options on November 16, 2024: 1. 8 AM Eastern"}, {"role": "user", "content": "What, are some times that I can meet?"}, {"role": "user", "content": "With people November."}, {"role": "assistant", "content": "Here are the available meeting slots on November 16, 2024: 1. 8 AM Eastern 2. 9 AM Eastern 3. 10 AM Eastern"}, {"role": "user", "content": "What is 9"}, {"role": "user", "content": "that I can meet people?"}, {"role": "assistant", "content": "On November 16, 2024, you can meet people at the following times"}, {"role": "user", "content": "And you tell me"}, {"role": "user", "content": "about"}] +_____openai.py get_chat_completions * chunks: +2024-11-18 20:36:53.205 | DEBUG | pipecat.transports.base_input:_handle_interruptions:124 - User started speaking +_---_ai_services.py process_frame * frame: StartInterruptionFrame#14 +_____openai.py * return from push_aggregation__________ +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : StartInterruptionFrame#14 +_---_ai_services.py process_frame * frame: UserStartedSpeakingFrame#14 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStartedSpeakingFrame#14 +___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStartedSpeakingFrame#14 +2024-11-18 20:36:54.684 | DEBUG | pipecat.transports.base_input:_handle_interruptions:131 - User stopped speaking +_---_ai_services.py process_frame * frame: StopInterruptionFrame#14 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : StopInterruptionFrame#14 +___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : StopInterruptionFrame#14 +_---_ai_services.py process_frame * frame: UserStoppedSpeakingFrame#14 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStoppedSpeakingFrame#14 +___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : UserStoppedSpeakingFrame#14 +_____openai.py * _process_context: tool_call_id +2024-11-18 20:36:54.685 | DEBUG | pipecat.services.openai:_stream_chat_completions:175 - Generating chat: [{"role": "system", "content": "Main Prompt", "name": "system"}, {"role": "assistant", "content": "I'm ready to help. What do you need assistance with today?"}, {"role": "user", "content": "Hello? Can you call me"}, {"role": "user", "content": "a meeting option?"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_vYUGnPvKR00EIZvqfQkKQ6ny", "function": {"name": "get_meeting_dates", "arguments": "{}"}, "type": "function"}]}, {"role": "tool", "content": "\"\\n \\\"1- 8AM Eastern on November 16 2024\\n\\n2- 9AM Eastern on November 16 2024\\n\\n3- 10AM Eastern on November 16 2024\\n\\n4- 11AM Eastern on November 16 2024\\n\\n5- 12PM Eastern on November 16 2024\\n\\n6- 1PM Eastern on November 16 2024\\n\\n7- 2PM Eastern on November 16 2024\\n\\n8- 3PM Eastern on November 16 2024\\n\\n9- 4PM Eastern on November 16 2024\\n\\n10- 5PM Eastern on November 16 2024\\n\\n11- 6PM Eastern on November 16 2024\\n\\n12- 7PM Eastern on November 16 2024\\n\\n\\\"\\n \"", "tool_call_id": "call_vYUGnPvKR00EIZvqfQkKQ6ny"}, {"role": "assistant", "content": "Here are the available meeting slots on November 16, 2024: 1. 8"}, {"role": "user", "content": "Can you tell me about a"}, {"role": "assistant", "content": "Could"}, {"role": "user", "content": "solar panel? Okay."}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_MNTgAllUH5r8qbrj7JfxxYDs", "function": {"name": "get_knowledge_base", "arguments": "{\"question\": \"solar panel\", \"reason\": \"GENERAL_QUESTION\"}"}, "type": "function"}]}, {"role": "tool", "content": "\"Sure! Here are some random facts that could be associated with a solar panel company: 1. **History**: The company was founded in 2008 by a group of renewable energy enthusiasts who wanted to make solar power more accessible to homeowners and businesses. 2. **Headquarters**: Their headquarters is a net-zero energy building powered entirely by their own solar panels, showcasing their commitment to sustainability. 3. **Products**: They produce three main types of solar panels: monocrystalline, polycrystalline, and thin-film, catering to different customer needs and budgets. 4. **Innovation**: The company holds patents for advanced solar cell technology that increases efficiency by 20% compared to industry standards. 5. **Global Reach**: They have installed solar systems in over 40 countries and have manufacturing plants on three continents.6. **Community Impact**: For every 100 solar panels sold, they donate a panel to a school or community center in underprivileged areas. 7. **Workforce**: The company employs over 5,000 people, 40% of whom are in research and development roles. 8. **Recognition**: They won the \\u201cGreen Energy Innovator of the Year\\u201d award in 2022 for their work on solar panels made from recycled materials. 9. **Sustainability**: Their panels are designed to last 25+ years and are 95% recyclable at the end of their life cycle. 10. **Customer Perks**: They offer a 25-year warranty and real-time monitoring systems that allow users to track energy production via an app. 11. **Mission Statement**: \\\"Empowering the world with clean energy, one panel at a time.\\\" 12. **Energy Production**: The combined output of all their installations generates enough electricity to power over 2 million homes annually. 13. **R&D Efforts**: They are actively working on integrating solar panels into everyday items like backpacks and electric vehicles. 14. **Solar Farms**: The company has partnered with governments to develop large-scale solar farms, including one that spans over 10,000 acres. 15. **Future Goals**: By 2030, they aim to make solar power the most affordable energy source worldwide. Would you like these customized for a specific scenario?\"", "tool_call_id": "call_MNTgAllUH5r8qbrj7JfxxYDs"}, {"role": "assistant", "content": "Here's some information related to"}, {"role": "user", "content": "Can you tell me"}, {"role": "user", "content": "about"}, {"role": "assistant", "content": "Could"}, {"role": "user", "content": "a solar panel."}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_41inbmYQzvhWSTU0cXd3EqRF", "function": {"name": "get_knowledge_base", "arguments": "{\"question\": \"about a solar panel\", \"reason\": \"GENERAL_QUESTION\"}"}, "type": "function"}]}, {"role": "tool", "content": "\"Sure! Here are some random facts that could be associated with a solar panel company: 1. **History**: The company was founded in 2008 by a group of renewable energy enthusiasts who wanted to make solar power more accessible to homeowners and businesses. 2. **Headquarters**: Their headquarters is a net-zero energy building powered entirely by their own solar panels, showcasing their commitment to sustainability. 3. **Products**: They produce three main types of solar panels: monocrystalline, polycrystalline, and thin-film, catering to different customer needs and budgets. 4. **Innovation**: The company holds patents for advanced solar cell technology that increases efficiency by 20% compared to industry standards. 5. **Global Reach**: They have installed solar systems in over 40 countries and have manufacturing plants on three continents.6. **Community Impact**: For every 100 solar panels sold, they donate a panel to a school or community center in underprivileged areas. 7. **Workforce**: The company employs over 5,000 people, 40% of whom are in research and development roles. 8. **Recognition**: They won the \\u201cGreen Energy Innovator of the Year\\u201d award in 2022 for their work on solar panels made from recycled materials. 9. **Sustainability**: Their panels are designed to last 25+ years and are 95% recyclable at the end of their life cycle. 10. **Customer Perks**: They offer a 25-year warranty and real-time monitoring systems that allow users to track energy production via an app. 11. **Mission Statement**: \\\"Empowering the world with clean energy, one panel at a time.\\\" 12. **Energy Production**: The combined output of all their installations generates enough electricity to power over 2 million homes annually. 13. **R&D Efforts**: They are actively working on integrating solar panels into everyday items like backpacks and electric vehicles. 14. **Solar Farms**: The company has partnered with governments to develop large-scale solar farms, including one that spans over 10,000 acres. 15. **Future Goals**: By 2030, they aim to make solar power the most affordable energy source worldwide. Would you like these customized for a specific scenario?\"", "tool_call_id": "call_41inbmYQzvhWSTU0cXd3EqRF"}, {"role": "assistant", "content": "Here's some information about solar panels and a related company: 1. **History**: The company began in 2008,"}, {"role": "user", "content": "Okay. Hey. Can you tell me what are my meeting time options?"}, {"role": "assistant", "content": "Here are your available meeting time options on November 16, 2024: 1. 8 AM Eastern"}, {"role": "user", "content": "What, are some times that I can meet?"}, {"role": "user", "content": "With people November."}, {"role": "assistant", "content": "Here are the available meeting slots on November 16, 2024: 1. 8 AM Eastern 2. 9 AM Eastern 3. 10 AM Eastern"}, {"role": "user", "content": "What is 9"}, {"role": "user", "content": "that I can meet people?"}, {"role": "assistant", "content": "On November 16, 2024, you can meet people at the following times"}, {"role": "user", "content": "And you tell me"}, {"role": "user", "content": "about"}, {"role": "user", "content": "the solar panel company?"}] +_____openai.py get_chat_completions * chunks: +___________________________openai.py * tool_call_id: +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +___________________________openai.py * tool_call_id: call_jSwnaZ6kGhloYewfltQWjitZ +2024-11-18 20:36:55.720 | INFO | pipecat.processors.aggregators.openai_llm_context:call_function:195 - Calling function get_knowledge_base with arguments {'question': 'the solar panel company', 'reason': 'GENERAL_QUESTION'} +_---_ai_services.py process_frame * frame: FunctionCallInProgressFrame#3 +___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : FunctionCallInProgressFrame#3 +2024-11-18 20:36:55.721 | DEBUG | pipecat.services.openai:process_frame:515 - FunctionCallInProgressFrame: FunctionCallInProgressFrame#3 +2024-11-18 20:36:55.721 | INFO | __main__:get_knowledge_base:240 - Invoking `get_knowledge_base` tool with argument {'question': 'the solar panel company', 'reason': 'GENERAL_QUESTION'} diff --git a/examples/foundational/bigly.py b/examples/foundational/bigly.py index aa72e2b4b..06f24cc7c 100644 --- a/examples/foundational/bigly.py +++ b/examples/foundational/bigly.py @@ -22,17 +22,26 @@ from openai.types.chat import ChatCompletionToolParam from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer, VADParams -from pipecat.frames.frames import EndFrame, LLMMessagesFrame, TextFrame +from pipecat.frames.frames import ( + BotSpeakingFrame, + EndFrame, + Frame, + InputAudioRawFrame, + LLMMessagesFrame, + TTSAudioRawFrame, + TextFrame, + UserStoppedSpeakingFrame, +) from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.deepgram import DeepgramSTTService from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper -from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper load_dotenv(override=True) @@ -41,12 +50,13 @@ logger.add(sys.stderr, level="DEBUG") PARTICIPANT_ID = [""] # this will get filled in later DEEPGRAM_API_KEY = os.getenv("DEEPGRAM_API_KEY") -DAILY_API_KEY = os.getenv("DAILY_API_KEY") +print(f"_____bigly.py * DEEPGRAM_API_KEY: {DEEPGRAM_API_KEY}") +DAILY_API_KEY = os.getenv("DAILY_BOTS_API_KEY") CARTESIA_API_KEY = os.getenv("CARTESIA_API_KEY") DAILY_ROOM_NAME = "bigs" #### ENSURE THIS ROOM HAS enable_dialout SET (and exp) -TO = "+16104204483" +TO = "+12097135125" # Daily bot that pretends to be a customer asking about solar panels # FROM_DAILY_CALLER_ID = "+13373378501" QUESTION_AFFIRMATION = [ @@ -75,6 +85,24 @@ VOICEMAIL_EXAMPLES = [ ] +class DebugProcessor(FrameProcessor): + def __init__(self, name, **kwargs): + self._name = name + super().__init__(**kwargs) + + async def process_frame(self, frame: Frame, direction: FrameDirection): + await super().process_frame(frame, direction) + if not ( + isinstance(frame, InputAudioRawFrame) + or isinstance(frame, BotSpeakingFrame) + or isinstance(frame, UserStoppedSpeakingFrame) + or isinstance(frame, TTSAudioRawFrame) + or isinstance(frame, TextFrame) + ): + logger.debug(f"--- DebugProcessor {self._name}: {frame} {direction}") + await self.push_frame(frame, direction) + + async def configure(aiohttp_session: aiohttp.ClientSession): (url, token, _) = await configure_with_args(aiohttp_session) return (url, token) @@ -99,7 +127,7 @@ async def configure_with_args( args, unknown = parser.parse_known_args() ##### - url = f"https://pc-34b1bdc94a7741719b57b2efb82d658e.daily.co/{DAILY_ROOM_NAME}" + url = f"https://pc-5b722fad4e9b47df8faa50cf3626267d.daily.co/{DAILY_ROOM_NAME}" # url = f"https://biglysales-team.daily.co/{DAILY_ROOM_NAME}" key = DAILY_API_KEY print(f"_____bigly.py * key: {key}") @@ -229,6 +257,7 @@ async def transfer_call( context: OpenAILLMContext, result_callback, ) -> None: + print(f"_____bigly.py * transfer_call * _args: {_args}") await result_callback("CALL TRANSFERED") @@ -426,20 +455,25 @@ async def main(): messages = [ { "role": "system", - "content": """Main Prompt""", + "content": """You are a friendly sales person for a solar panel company. Your responses will be converted to audio. Please do not include any special characters in your response other than '!' or '?'. """, }, ] context = OpenAILLMContext(messages, tools) context_aggregator = llm.create_context_aggregator(context) + dp_post_llm = DebugProcessor('post_llm') + dp_post_tts = DebugProcessor('post_tts') + pipeline = Pipeline( [ transport.input(), # Transport user input stt, context_aggregator.user(), # User responses llm, # LLM + dp_post_llm, # Debug Processor tts, # TTS + # dp_post_tts, # Debug Processor transport.output(), # Transport bot output context_aggregator.assistant(), # Assistant spoken responses ] @@ -484,9 +518,9 @@ async def main(): def _handle_dialout_completion(task: asyncio.Task) -> None: asyncio.create_task(_dialout_task_exception(task)) - if state == "joined": - task = transport.input().get_event_loop().create_task(_dialout_retry_handler()) - task.add_done_callback(_handle_dialout_completion) + # if state == "joined": + # task = transport.input().get_event_loop().create_task(_dialout_retry_handler()) + # task.add_done_callback(_handle_dialout_completion) # Event handler for on_first_participant_joined @transport.event_handler("on_first_participant_joined") diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index 5c374a0c0..dcc6e0fa9 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -289,7 +289,7 @@ class TTSService(AIService): async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) - print(f"_---_ai_services.py process_frame * frame: {frame}") + # print(f"_---_ai_services.py process_frame * frame: {frame}") if isinstance(frame, TextFrame): await self._process_text_frame(frame) diff --git a/src/pipecat/services/openai.py b/src/pipecat/services/openai.py index 2c2c44667..bf8344de3 100644 --- a/src/pipecat/services/openai.py +++ b/src/pipecat/services/openai.py @@ -242,7 +242,7 @@ class BaseOpenAILLMService(LLMService): # yield a frame containing the function name and the arguments. tool_call = chunk.choices[0].delta.tool_calls[0] - print(f"___________________________openai.py * tool_call_id: {tool_call_id}") + print(f"___________________________openai.py * tool_call_id: {tool_call_id} {tool_call.function.arguments}") if tool_call.index != func_idx: functions_list.append(function_name) arguments_list.append(arguments) @@ -507,7 +507,7 @@ class OpenAIAssistantContextAggregator(LLMAssistantContextAggregator): async def process_frame(self, frame, direction): await super().process_frame(frame, direction) - print(f"___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : {frame}") + # print(f"___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : {frame}") # See note above about not calling push_frame() here. if isinstance(frame, StartInterruptionFrame): self._function_calls_in_progress.clear() @@ -530,8 +530,8 @@ class OpenAIAssistantContextAggregator(LLMAssistantContextAggregator): elif isinstance(frame, OpenAIImageMessageFrame): self._pending_image_frame_message = frame await self._push_aggregation() - else: - print(f"___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : {frame}") + # else: + # print(f"___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : {frame}") async def _push_aggregation(self): if not (