Skip to content

Commit

Permalink
Update doc generation workflow (#862)
Browse files Browse the repository at this point in the history
Co-authored-by: Théo Monnom <[email protected]>
  • Loading branch information
keepingitneil and theomonnom authored Oct 9, 2024
1 parent 4995878 commit 8308729
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 36 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -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"
42 changes: 7 additions & 35 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
11 changes: 11 additions & 0 deletions livekit-agents/livekit/agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from . import (
cli,
ipc,
llm,
multimodal,
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions livekit-agents/livekit/agents/pipeline/pipeline_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Any, List, Literal

import aiohttp

from livekit.agents import tts, utils

from .log import logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8308729

Please sign in to comment.