Overview
LemonSlice offers integration with Pipecat, an open-source framework for building multimodal conversational agents by Daily. TheLemonSliceTransport connects your Pipecat app to a LemonSlice avatar, enabling real-time voice conversations with synchronized video. The LemonSlice agent joins as a participant alongside the Pipecat bot and human user. It receives audio from the Pipecat pipeline’s TTS layer and renders synchronized video and audio.
Prerequisites
Before integrating LemonSlice with Pipecat, ensure you have the following:-
LemonSlice agent information
Either a base image URL or a LemonSlice Agent ID.
- Agent base image — a publicly accessible image URL of your avatar, focused on the face. The image should be 368 × 560 pixels. LemonSlice will automatically center-crop your image to the target aspect ratio if the dimensions do not match the expected values. Best results are achieved with anthropomorphic images where the face and mouth are clearly identifiable.
-
LemonSlice Agent ID
Selected voices and personalities for a LemonSlice agent will be ignored when using the Pipecat plugin.
-
Pipecat Python Application
- Either your own existing application, or follow the Pipecat quickstart to create one.
Integration Guide
Authenticate
- Create a LemonSlice API key
- In your Pipecat app, set
LEMONSLICE_API_KEYin your .env file
Create the LemonSlice transport layer
Create an instance of Parameters for
Parameters for
LemonSliceTransport by providing your bot name, LemonSlice API key, session request, and additional parameters.LemonSliceTransport:| Parameter | Description |
|---|---|
bot_name | The name of the Pipecat bot instance. |
api_key | LemonSlice API key for authentication. |
session | An aiohttp.ClientSession for making async HTTP requests. |
session_request | Session creation parameters. See LemonSliceNewSessionRequest below. |
params | (Optional) Transport configuration. |
LemonSliceNewSessionRequest.| Parameter | Description |
|---|---|
agent_image_url | A URL to an avatar image to use. Provide either agent_id or agent_image_url, not both. |
agent_id | The ID of the LemonSlice agent. Provide either agent_id or agent_image_url, not both. |
agent_prompt | (Optional) A high-level system prompt that subtly influences the avatar’s movements, expressions, and emotional demeanor during the talking state. |
agent_idle_prompt | (Optional) A high-level system prompt that influences the avatar’s movements, expressions, and emotional demeanor during the idle state. |
idle_timeout | (Optional) Idle timeout in seconds. Defaults to 60. If a negative number is provided, the session will have no idle timeout. |
daily_room_url | (Optional) Daily room URL to use. If not provided, LemonSlice will create a new room. |
daily_token | (Optional) Daily token for authenticating with the room. |
Insert the LemonSlice transport layer into the pipeline
Add the LemonSlice transport layer to your processing pipeline.
The LemonSlice avatar participant is automatically filtered out from
transport.on_client_connected and transport.on_client_disconnected events. Only human participant connections trigger these event handlers.Notes
- LemonSlice uses Daily as the underlying transport layer, so all Daily features and configuration options are available through the inherited
DailyParams. - The transport automatically manages interruptions and sends appropriate control messages (
interrupt,response_started,response_finished) to the LemonSlice session. - The LemonSlice avatar’s microphone is automatically muted to prevent audio feedback loops.
- The Daily video UI should filter out the Pipecat bot participant from being displayed. This participant only exists to facilitate passing audio between the user, Pipecat, and LemonSlice.
