Move function registration into the ConversationFlowProcessor class

This commit is contained in:
Mark Backman
2024-11-15 10:54:18 -05:00
parent 0c1070433f
commit 1b74560f9d
2 changed files with 45 additions and 25 deletions

View File

@@ -135,9 +135,6 @@ async def main():
tts = DeepgramTTSService(api_key=os.getenv("DEEPGRAM_API_KEY"), voice="aura-helios-en")
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4")
# Initialize conversation flow processor
flow_processor = ConversationFlowProcessor(flow_config)
# Get initial tools from the first node
initial_tools = flow_config["nodes"]["start"]["functions"]
@@ -184,6 +181,12 @@ async def main():
task = PipelineTask(pipeline, PipelineParams(allow_interruptions=True))
# Initialize conversation flow processor
flow_processor = ConversationFlowProcessor(flow_config, task)
# Register functions with LLM service
await flow_processor.register_functions(llm)
@transport.event_handler("on_first_participant_joined")
async def on_first_participant_joined(transport, participant):
await transport.capture_participant_transcription(participant["id"])