Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions livekit-agents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ groq = ["livekit-plugins-groq>=1.5.8"]
hamming = ["livekit-plugins-hamming>=1.5.8"]
hedra = ["livekit-plugins-hedra>=1.5.8"]
hume = ["livekit-plugins-hume>=1.5.8"]
inception = ["livekit-plugins-inception>=1.5.8"]
inworld = ["livekit-plugins-inworld>=1.5.8"]
keyframe = ["livekit-plugins-keyframe>=1.5.8"]
langchain = ["livekit-plugins-langchain>=1.5.8"]
Expand Down
15 changes: 15 additions & 0 deletions livekit-plugins/livekit-plugins-inception/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Inception plugin for LiveKit Agents

Support for LLM with [Inception](https://www.inceptionlabs.ai/) Mercury 2, a diffusion language model.

See [https://docs.livekit.io/agents/integrations/llm/](https://docs.livekit.io/agents/integrations/llm/) for more information.

## Installation

```bash
pip install livekit-plugins-inception
```

## Pre-requisites

For credentials, you'll need an Inception account and API key. Credentials can be passed directly or via `INCEPTION_API_KEY` environment variable.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Inception plugin for LiveKit Agents

Support for LLM with Inception Mercury 2, a diffusion language model.
"""

from livekit.agents import Plugin

from .llm import LLM
from .log import logger
from .models import InceptionChatModels, InceptionReasoningEffort
from .version import __version__

__all__ = ["LLM", "InceptionChatModels", "InceptionReasoningEffort", "__version__"]


class InceptionPlugin(Plugin):
def __init__(self) -> None:
super().__init__(__name__, __version__, __package__, logger)


Plugin.register_plugin(InceptionPlugin())

# Cleanup docs of unexported modules
_module = dir()
NOT_IN_ALL = [m for m in _module if m not in __all__]

__pdoc__ = {}

for n in NOT_IN_ALL:
__pdoc__[n] = False
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import os
from typing import Any

import httpx
import openai

from livekit.agents.llm import ToolChoice
from livekit.agents.types import (
NOT_GIVEN,
NotGivenOr,
)
from livekit.agents.utils import is_given
from livekit.plugins.openai import LLM as OpenAILLM

from .models import InceptionChatModels, InceptionReasoningEffort


class LLM(OpenAILLM):
def __init__(
self,
*,
model: str | InceptionChatModels = "mercury-2",
api_key: NotGivenOr[str] = NOT_GIVEN,
base_url: NotGivenOr[str] = "https://api.inceptionlabs.ai/v1",
client: openai.AsyncClient | None = None,
user: NotGivenOr[str] = NOT_GIVEN,
temperature: NotGivenOr[float] = NOT_GIVEN,
parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
top_p: NotGivenOr[float] = NOT_GIVEN,
timeout: httpx.Timeout | None = None,
max_retries: NotGivenOr[int] = NOT_GIVEN,
reasoning_effort: NotGivenOr[InceptionReasoningEffort] = NOT_GIVEN,
realtime: NotGivenOr[bool] = NOT_GIVEN,
):
"""
Create a new instance of Inception LLM.

``api_key`` must be set to your Inception API key, either using the argument or by setting
the ``INCEPTION_API_KEY`` environmental variable.

``reasoning_effort`` controls the depth of reasoning: "instant" is fastest with minimal
reasoning, "low", "medium", and "high" offer progressively deeper reasoning.

``realtime`` reduces wait time for the first diffusion block (TTFT).
"""
inception_api_key = _get_api_key(api_key)

# Inception-specific params go in extra_body so reasoning_effort="instant" (not in
# OpenAI's ReasoningEffort type) and realtime are passed through without type conflicts.
extra_body: dict[str, Any] = {}
if is_given(reasoning_effort):
extra_body["reasoning_effort"] = reasoning_effort
if is_given(realtime):
extra_body["realtime"] = realtime

super().__init__(
model=model,
api_key=inception_api_key,
base_url=base_url,
client=client,
user=user,
temperature=temperature,
parallel_tool_calls=parallel_tool_calls,
tool_choice=tool_choice,
top_p=top_p,
timeout=timeout,
max_retries=max_retries,
extra_body=extra_body if extra_body else NOT_GIVEN,
_strict_tool_schema=False,
)


def _get_api_key(key: NotGivenOr[str]) -> str:
inception_api_key = key if is_given(key) else os.environ.get("INCEPTION_API_KEY")
if not inception_api_key:
raise ValueError(
"INCEPTION_API_KEY is required, either as argument or set "
"INCEPTION_API_KEY environmental variable"
)
return inception_api_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import logging

logger = logging.getLogger("livekit.plugins.inception")
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import Literal

InceptionChatModels = Literal[
"mercury-2",
"mercury",
"mercury-coder",
]

InceptionReasoningEffort = Literal["instant", "low", "medium", "high"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2026 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.5.8"
44 changes: 44 additions & 0 deletions livekit-plugins/livekit-plugins-inception/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "livekit-plugins-inception"
dynamic = ["version"]
description = "Inception plugin for LiveKit Agents"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.10.0"
authors = [{ name = "LiveKit", email = "hello@livekit.io" }]
keywords = ["voice", "ai", "realtime", "audio", "video", "livekit", "inception", "mercury"]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Video",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
]
dependencies = [
"livekit-agents[openai]>=1.5.8",
]

[project.urls]
Documentation = "https://docs.livekit.io"
Website = "https://livekit.io/"
Source = "https://github.com/livekit/agents"

[tool.hatch.version]
path = "livekit/plugins/inception/version.py"

[tool.hatch.build.targets.wheel]
packages = ["livekit"]

[tool.hatch.build.targets.sdist]
include = ["/livekit"]

[tool.uv]
exclude-newer = "7 days"
exclude-newer-package = { livekit = "0 days", livekit-agents = "0 days" }
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ livekit-plugins-groq = { workspace = true }
livekit-plugins-hedra = { workspace = true }
livekit-plugins-hamming = { workspace = true }
livekit-plugins-hume = { workspace = true }
livekit-plugins-inception = { workspace = true }
livekit-plugins-inworld = { workspace = true }
livekit-plugins-krisp = { workspace = true }
livekit-plugins-keyframe = { workspace = true }
Expand Down
19 changes: 17 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading