More fixes for missing packages

This commit is contained in:
Mark Backman
2024-12-12 13:25:13 -05:00
parent b5d5a0e923
commit 276fd86ecb
10 changed files with 208 additions and 12 deletions

View File

@@ -4,12 +4,74 @@ build:
os: ubuntu-22.04
tools:
python: '3.12'
jobs:
pre_build:
# Commands to run before the build
- python -m pip install --upgrade pip
- pip install wheel setuptools
post_create_environment:
# Install system dependencies required by some packages
- apt-get update
- apt-get install -y portaudio19-dev python3-pyaudio
post_build:
# Commands to run after the build
- echo "Build completed"
sphinx:
configuration: docs/api/conf.py
fail_on_warning: false # Set to true if you want builds to fail on warnings
python:
install:
- requirements: docs/api/requirements.txt
- requirements: docs/api/requirements-base.txt
# Try to install Riva first, fall back to PlayHT if it fails
- requirements: docs/api/requirements-riva.txt || true
- requirements: docs/api/requirements-playht.txt || true
- method: pip
path: .
extra_requirements:
- anthropic
- assemblyai
- aws
- azure
- canonical
- cartesia
- deepgram
- elevenlabs
- fal
- fireworks
- gladia
- google
- grok
- groq
- krisp
- langchain
- livekit
- lmnt
- moondream
- nim
- noisereduce
- openai
- openpipe
- silero
- simli
- soundfile
- websocket
- whisper
formats:
- pdf
- epub
- htmlzip
# Cache dependencies to speed up builds
search:
ranking:
api/*: 5
getting-started/*: 4
guides/*: 3
# Configure submodules if needed
submodules:
include: all
recursive: true

View File

@@ -40,6 +40,31 @@ autodoc_default_options = {
"show-inheritance": True,
}
# Mock imports for optional dependencies
autodoc_mock_imports = [
"riva",
"livekit",
"pyht",
"anthropic",
"assemblyai",
"boto3",
"azure",
"cartesia",
"deepgram",
"elevenlabs",
"fal",
"gladia",
"google",
"krisp",
"langchain",
"lmnt",
"noisereduce",
"openai",
"openpipe",
"simli",
"soundfile",
]
# HTML output settings
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
@@ -47,6 +72,39 @@ autodoc_typehints = "description"
html_show_sphinx = False
def verify_modules():
"""Verify that required modules are available."""
required_modules = {
"services": [
"assemblyai",
"aws",
"cartesia",
"deepgram",
"google",
"lmnt",
"riva",
"simli",
],
"serializers": ["livekit"],
"vad": ["silero", "vad_analyzer"],
}
missing = []
for category, modules in required_modules.items():
for module in modules:
try:
__import__(f"pipecat.{category}.{module}")
logger.info(f"Successfully imported pipecat.{category}.{module}")
except ImportError as e:
missing.append(f"pipecat.{category}.{module}")
logger.warning(
f"Optional module not available: pipecat.{category}.{module} - {str(e)}"
)
if missing:
logger.warning(f"Some optional modules are not available: {missing}")
def clean_title(title: str) -> str:
"""Automatically clean module titles."""
# Remove everything after space (like 'module', 'processor', etc.)
@@ -151,3 +209,7 @@ def setup(app):
except Exception as e:
logger.error(f"Error generating API documentation: {e}", exc_info=True)
# Run module verification
verify_modules()

View File

@@ -22,6 +22,7 @@ Core Components
* :mod:`Frames <pipecat.frames>`
* :mod:`Processors <pipecat.processors>`
* :mod:`Pipeline <pipecat.pipeline>`
* :mod:`Services <pipecat.services>`
Audio Processing
~~~~~~~~~~~~~~~~

View File

@@ -0,0 +1,36 @@
# Sphinx dependencies
sphinx>=8.1.3
sphinx-rtd-theme
sphinx-markdown-builder
sphinx-autodoc-typehints
toml
# Install all extras individually to ensure they're properly resolved
pipecat-ai[anthropic]
pipecat-ai[assemblyai]
pipecat-ai[aws]
pipecat-ai[azure]
pipecat-ai[canonical]
pipecat-ai[cartesia]
pipecat-ai[deepgram]
pipecat-ai[elevenlabs]
pipecat-ai[fal]
pipecat-ai[fireworks]
pipecat-ai[gladia]
pipecat-ai[google]
pipecat-ai[grok]
pipecat-ai[groq]
pipecat-ai[krisp]
pipecat-ai[langchain]
pipecat-ai[livekit]
pipecat-ai[lmnt]
pipecat-ai[moondream]
pipecat-ai[nim]
pipecat-ai[noisereduce]
pipecat-ai[openai]
pipecat-ai[openpipe]
pipecat-ai[silero]
pipecat-ai[simli]
pipecat-ai[soundfile]
pipecat-ai[websocket]
pipecat-ai[whisper]

View File

@@ -0,0 +1,3 @@
# Force specific grpcio version for PlayHT
grpcio>=1.68.0
pipecat-ai[playht]

View File

@@ -0,0 +1,3 @@
# Force specific grpcio version for Riva
grpcio==1.65.4
pipecat-ai[riva]

View File

@@ -1,6 +0,0 @@
sphinx>=8.1.3
sphinx-rtd-theme
sphinx-markdown-builder
sphinx-autodoc-typehints
toml
pipecat-ai[anthropic,assemblyai,aws,azure,canonical,cartesia,deepgram,elevenlabs,fal,fireworks,gladia,google,grok,groq,krisp,langchain,lmnt,moondream,nim,noisereduce,openai,openpipe,playht,riva,silero,simli,soundfile,websocket,whisper]

36
docs/api/rtd-test.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
set -e
# Configuration
DOCS_DIR=$(pwd)
PROJECT_ROOT=$(cd ../../ && pwd)
TEST_DIR="/tmp/rtd-test-$(date +%Y%m%d_%H%M%S)"
echo "Creating test directory: $TEST_DIR"
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"
# Create single virtual environment
python -m venv venv
source venv/bin/activate
echo "Installing base dependencies..."
pip install --upgrade pip wheel setuptools
pip install -r "$DOCS_DIR/requirements-base.txt"
# Try to install optional dependencies, but don't fail if they don't work
echo "Installing Riva dependencies..."
pip install -r "$DOCS_DIR/requirements-riva.txt" || echo "Failed to install Riva dependencies"
echo "Installing PlayHT dependencies..."
pip install -r "$DOCS_DIR/requirements-playht.txt" || echo "Failed to install PlayHT dependencies"
echo "Building documentation..."
cd "$DOCS_DIR"
sphinx-build -b html . "_build/html"
echo "Build complete. Check _build/html directory for output."
# Print installed packages for verification
echo "Installed packages:"
pip freeze

View File

@@ -66,11 +66,11 @@ openpipe = [ "openpipe~=4.38.0" ]
playht = [ "pyht~=0.1.8", "websockets~=13.1" ]
riva = [ "nvidia-riva-client~=2.17.0" ]
silero = [ "onnxruntime~=1.20.1" ]
simli = [ "simli-ai~=0.1.7"]
soundfile = [ "soundfile~=0.12.1" ]
together = [ "openai~=1.57.2" ]
websocket = [ "websockets~=13.1", "fastapi~=0.115.0" ]
whisper = [ "faster-whisper~=1.1.0" ]
simli = [ "simli-ai~=0.1.7"]
[tool.setuptools.packages.find]
# All the following settings are optional:

View File

@@ -11,7 +11,7 @@ import json
import re
from asyncio import CancelledError
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List, Optional, Union
from loguru import logger
from PIL import Image
@@ -75,8 +75,7 @@ class AnthropicContextAggregatorPair:
class AnthropicLLMService(LLMService):
"""
This class implements inference with Anthropic's AI models.
"""This class implements inference with Anthropic's AI models.
Can provide a custom client via the `client` kwarg, allowing you to
use `AsyncAnthropicBedrock` and `AsyncAnthropicVertex` clients
@@ -328,7 +327,7 @@ class AnthropicLLMContext(OpenAILLMContext):
tools: list[dict] | None = None,
tool_choice: dict | None = None,
*,
system: str | NotGiven = NOT_GIVEN,
system: Union[str, NotGiven] = NOT_GIVEN,
):
super().__init__(messages=messages, tools=tools, tool_choice=tool_choice)