diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 000000000..8c5f924bd --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,59 @@ +name: Publish docs + +on: + workflow_dispatch: + workflow_call: + secrets: + DOCS_DEPLOY_AWS_ACCESS_KEY: {} + DOCS_DEPLOY_AWS_API_SECRET: {} + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + lfs: true + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' # Specify the Python version you want to use + + - name: Create and activate virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install pdoc and other dependencies + run: | + source venv/bin/activate + python -m pip install pdoc3 setuptools + + - name: Install package + run: | + source venv/bin/activate + python -m pip install ./livekit-agents \ + ./livekit-plugins/livekit-plugins-anthropic \ + ./livekit-plugins/livekit-plugins-azure \ + ./livekit-plugins/livekit-plugins-cartesia \ + ./livekit-plugins/livekit-plugins-deepgram \ + ./livekit-plugins/livekit-plugins-elevenlabs \ + ./livekit-plugins/livekit-plugins-google \ + ./livekit-plugins/livekit-plugins-nltk \ + ./livekit-plugins/livekit-plugins-openai + + - name: Build Docs + run: | + source venv/bin/activate + python -m pdoc --skip-errors --html livekit --output-dir docs + + - name: S3 Upload + run: | + source venv/bin/activate + aws s3 cp docs/ s3://livekit-docs/python --recursive + env: + AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_AWS_API_SECRET }} + AWS_DEFAULT_REGION: "us-east-1" \ No newline at end of file diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 2b997895b..045e8f8ce 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -107,38 +107,10 @@ jobs: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - docs: - if: ${{ fromJson(needs.bump.outputs.packages)[0] != null }} - needs: - - bump - - publish - strategy: - matrix: - package: ${{ fromJSON(needs.bump.outputs.packages) }} - - runs-on: ubuntu-latest - env: - package: ${{ matrix.package.name }} - module: $(echo "${{ startsWith(matrix.package.name, 'livekit-plugin') && 'livekit-plugins/' || '' }}${{ matrix.package.name }}" | tr '-' '/') - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - lfs: true - - - name: Install pdoc - run: python -m pip install --upgrade pdoc - - - name: Install package - run: python -m pip install $package/ - - - name: Build Docs - run: python -m pdoc $module --docformat=google --output-dir docs - - - name: S3 Upload - run: aws s3 cp docs/ s3://livekit-docs/$package --recursive - env: - AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_AWS_API_SECRET }} - AWS_DEFAULT_REGION: "us-east-1" + trigger-docs-publish: + name: Publish Docs + needs: publish + uses: ./.github/workflows/publish-docs.yaml + secrets: + DOCS_DEPLOY_AWS_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }} + DOCS_DEPLOY_AWS_API_SECRET: ${{ secrets.DOCS_DEPLOY_AWS_API_SECRET }} diff --git a/livekit-agents/livekit/agents/__init__.py b/livekit-agents/livekit/agents/__init__.py index b475e6b2e..e6f3327bd 100644 --- a/livekit-agents/livekit/agents/__init__.py +++ b/livekit-agents/livekit/agents/__init__.py @@ -13,6 +13,7 @@ # limitations under the License. from . import ( + cli, ipc, llm, multimodal, @@ -57,7 +58,17 @@ "pipeline", "multimodal", "voice_assistant", + "cli", "AssignmentTimeoutError", "ATTRIBUTE_AGENT_STATE", "AgentState", ] + +# 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 diff --git a/livekit-agents/livekit/agents/pipeline/pipeline_agent.py b/livekit-agents/livekit/agents/pipeline/pipeline_agent.py index 27ca5d0b9..5d24bcfc0 100644 --- a/livekit-agents/livekit/agents/pipeline/pipeline_agent.py +++ b/livekit-agents/livekit/agents/pipeline/pipeline_agent.py @@ -124,6 +124,10 @@ class AgentTranscriptionOptions: class VoicePipelineAgent(utils.EventEmitter[EventTypes]): + """ + A pipeline agent (VAD + STT + LLM + TTS) implementation. + """ + MIN_TIME_PLAYED_FOR_COMMIT = 1.5 """Minimum time played for the user speech to be committed to the chat context""" diff --git a/livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/__init__.py b/livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/__init__.py index 464766951..32741b4f3 100644 --- a/livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/__init__.py +++ b/livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/__init__.py @@ -35,3 +35,12 @@ def __init__(self) -> None: Plugin.register_plugin(AnthropicPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/__init__.py b/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/__init__.py index a5884c81e..e8fc41fcb 100644 --- a/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/__init__.py +++ b/livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/__init__.py @@ -27,3 +27,12 @@ def __init__(self): Plugin.register_plugin(AzurePlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-browser/livekit/plugins/browser/__init__.py b/livekit-plugins/livekit-plugins-browser/livekit/plugins/browser/__init__.py index 66009b84e..be8720788 100644 --- a/livekit-plugins/livekit-plugins-browser/livekit/plugins/browser/__init__.py +++ b/livekit-plugins/livekit-plugins-browser/livekit/plugins/browser/__init__.py @@ -27,3 +27,12 @@ def __init__(self): Plugin.register_plugin(BrowserPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/__init__.py b/livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/__init__.py index 1f7001c95..78b70858c 100644 --- a/livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/__init__.py +++ b/livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/__init__.py @@ -28,3 +28,12 @@ def __init__(self): Plugin.register_plugin(CartesiaPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/__init__.py b/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/__init__.py index d554599f0..3174182cc 100644 --- a/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/__init__.py +++ b/livekit-plugins/livekit-plugins-clova/livekit/plugins/clova/__init__.py @@ -19,3 +19,12 @@ def download_files(self): Plugin.register_plugin(ClovaSTTPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/__init__.py b/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/__init__.py index 5e8075b4a..c6f2de7e5 100644 --- a/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/__init__.py +++ b/livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/__init__.py @@ -15,3 +15,12 @@ def __init__(self): Plugin.register_plugin(DeepgramPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/__init__.py b/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/__init__.py index 4fb66ae80..96eb3e958 100644 --- a/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/__init__.py +++ b/livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/__init__.py @@ -37,3 +37,12 @@ def __init__(self): Plugin.register_plugin(ElevenLabsPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/__init__.py b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/__init__.py index 4d7212140..ca754bd30 100644 --- a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/__init__.py +++ b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/__init__.py @@ -29,3 +29,12 @@ def __init__(self): Plugin.register_plugin(GooglePlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-nltk/livekit/plugins/nltk/__init__.py b/livekit-plugins/livekit-plugins-nltk/livekit/plugins/nltk/__init__.py index 16ce6fc35..af91da644 100644 --- a/livekit-plugins/livekit-plugins-nltk/livekit/plugins/nltk/__init__.py +++ b/livekit-plugins/livekit-plugins-nltk/livekit/plugins/nltk/__init__.py @@ -38,3 +38,12 @@ def download_files(self): Plugin.register_plugin(NltkPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/__init__.py b/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/__init__.py index 95135aef8..1a6b7c00d 100644 --- a/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/__init__.py +++ b/livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/__init__.py @@ -47,3 +47,12 @@ def __init__(self) -> None: Plugin.register_plugin(OpenAIPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-playht/livekit/__init__.py b/livekit-plugins/livekit-plugins-playht/livekit/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/livekit-plugins/livekit-plugins-playht/livekit/plugins/__init__.py b/livekit-plugins/livekit-plugins-playht/livekit/plugins/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/__init__.py b/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/__init__.py index 42189c98a..82229c316 100644 --- a/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/__init__.py +++ b/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/__init__.py @@ -22,3 +22,12 @@ def download_files(self) -> None: Plugin.register_plugin(PlayHTPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py b/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py index db257012f..3036d751f 100644 --- a/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py +++ b/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py @@ -5,7 +5,6 @@ from typing import Any, List, Literal import aiohttp - from livekit.agents import tts, utils from .log import logger diff --git a/livekit-plugins/livekit-plugins-rag/livekit/plugins/rag/__init__.py b/livekit-plugins/livekit-plugins-rag/livekit/plugins/rag/__init__.py index 7042c3fa7..2ff06c98b 100644 --- a/livekit-plugins/livekit-plugins-rag/livekit/plugins/rag/__init__.py +++ b/livekit-plugins/livekit-plugins-rag/livekit/plugins/rag/__init__.py @@ -32,3 +32,12 @@ def download_files(self) -> None: Plugin.register_plugin(RAGPlugin()) + +# 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 diff --git a/livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/__init__.py b/livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/__init__.py index 8f3b7baf3..065ecf42f 100644 --- a/livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/__init__.py +++ b/livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/__init__.py @@ -28,3 +28,12 @@ def __init__(self): Plugin.register_plugin(SileroPlugin()) + +# 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