Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I send the STT results and the LLM output to the client #481

Open
yeyupiaoling opened this issue Sep 20, 2024 · 0 comments
Open

How do I send the STT results and the LLM output to the client #481

yeyupiaoling opened this issue Sep 20, 2024 · 0 comments

Comments

@yeyupiaoling
Copy link

yeyupiaoling commented Sep 20, 2024

  • pipecat-ai 0.0.42.dev63
  • Ubuntu 22.04
  • Client:Android

I wanted to be able to display a transcript of the conversation on the client, so I needed pipecat-ai to be able to send STT results and LLM output to the client.

What should I set?

My code snippet is as follows:

async with aiohttp.ClientSession() as session:
    transport = DailyTransport(
        room_url,
        token,
        bot_name="Bot",
        params=DailyParams(
            audio_out_enabled=True,
            transcription_enabled=False,
            vad_enabled=True,
            vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)),
            vad_audio_passthrough=True,
        ),
    )
    stt = AzureSTTService(name="STT", **configs.azure_stt)
    tts = AzureTTSService(name="TTS", **configs.azure_tts)
    llm = OpenAILLMService(name="LLM", **configs.llm)

    messages = [{"role": "system", 'content': get_system_prompt()}]

    tma_in = LLMUserResponseAggregator(messages)
    tma_out = LLMAssistantResponseAggregator(messages)

    pipeline = Pipeline(
        [
            transport.input(),  # Transport user input
            stt,  # Speech-to-text
            tma_in,  # User responses
            llm,  # LLM
            tts,  # TTS
            transport.output(),  # Transport bot output
            tma_out,  # Assistant spoken responses
        ]
    )

    task = PipelineTask(
        pipeline,
        PipelineParams(
            allow_interruptions=True,
            enable_metrics=False,
            report_only_initial_ttfb=False,
        ),
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant