api
LemonSlice API utilities for session management.
This module provides helper classes for interacting with the LemonSlice API, including session creation and termination.
- class pipecat.transports.lemonslice.api.LemonSliceApi(api_key: str, session: ClientSession)[source]
Bases:
objectHelper class for interacting with the LemonSlice API.
Provides methods for creating and managing sessions with LemonSlice avatars.
- LEMONSLICE_URL = 'https://lemonslice.com/api/liveai/sessions'
- __init__(api_key: str, session: ClientSession)[source]
Initialize the LemonSliceApi client.
- Parameters:
api_key – LemonSlice API key for authentication.
session – An aiohttp session for making HTTP requests.
- async create_session(*, agent_image_url: str | None = None, agent_id: str | None = None, agent_prompt: str | None = None, idle_timeout: int | None = None, daily_room_url: str | None = None, daily_token: str | None = None, connection_properties: dict[str, Any] | None = None, extra_properties: dict[str, Any] | None = None, api_url: str | None = None) dict[source]
Create a new session with the specified agent_id or agent_image_url.
- Parameters:
agent_image_url – The URL to an agent image. Provide either agent_id or agent_image_url.
agent_id – ID of a LemonSlice agent. Provide either agent_id or agent_image_url.
agent_prompt – A high-level system prompt that subtly influences the avatar’s movements, expressions, and emotional demeanor.
idle_timeout – Idle timeout in seconds.
daily_room_url – Daily room URL to use for the session.
daily_token – Daily token for authenticating with the room.
connection_properties – Additional connection properties to pass to the session.
extra_properties – Additional properties to pass to the session.
api_url – LemonSlice API URL override.
- Returns:
Dictionary containing session_id, room_url, and control_url.
- Raises:
ValueError – If neither agent_id nor agent_image_url is provided.