pyproject.toml: use project optional dependencies and pin them

This commit is contained in:
Aleix Conchillo Flaqué
2024-04-03 15:06:16 -07:00
parent 2f59e38a7a
commit 128d350abc
4 changed files with 363 additions and 35 deletions

View File

@@ -4,12 +4,8 @@ Build things like this:
[![AI-powered voice patient intake for healthcare](https://img.youtube.com/vi/lDevgsp9vn0/0.jpg)](https://www.youtube.com/watch?v=lDevgsp9vn0)
**`dailyai` started as a toolkit for implementing generative AI voice bots.** Things like personal coaches, meeting assistants, story-telling toys for kids, customer support bots, and snarky social companions.
In 2023 a *lot* of us got excited about the possibility of having open-ended conversations with LLMs. It became clear pretty quickly that we were all solving the same [low-level problems](https://www.daily.co/blog/how-to-talk-to-an-llm-with-your-voice/):
- low-latency, reliable audio transport
- echo cancellation
@@ -48,7 +44,7 @@ If you'd like to [implement a service]((https://github.com/daily-co/daily-ai-sdk
## Getting started
Today, the easiest way to get started with `dailyai` is to use [Daily](https://www.daily.co/) as your transport service. This toolkit started life as an internal SDK at Daily and millions of minutes of AI conversation have been served using it and its earlier prototype incarnations. (The [transport base class](https://github.com/daily-co/daily-ai-sdk/blob/main/src/dailyai/services/base_transport_service.py) is easy to extend, though, so feel free to submit PRs if you'd like to implement another transport service.)
Today, the easiest way to get started with `dailyai` is to use [Daily](https://www.daily.co/) as your transport service. This toolkit started life as an internal SDK at Daily and millions of minutes of AI conversation have been served using it and its earlier prototype incarnations. (The [transport base class](https://github.com/daily-co/daily-ai-sdk/blob/main/src/dailyai/transports/abstract_transport.py) is easy to extend, though, so feel free to submit PRs if you'd like to implement another transport service.)
```
# install the module
@@ -58,6 +54,18 @@ pip install dailyai
cp dot-env.template .env
```
By default, in order to minimize dependencies, only the basic framework functionality is available. Some third-party AI services require additional
dependencies that you can install with:
```
pip install dailyai[option,...]
```
Your project may or may not need these, so they're made available as optional requirements. Here is a list:
- **AI services**: `anthropic`, `azure`, `fal`, `openai`, `playht`, `silero`, `whisper`
- **Transports**: `daily`, `local`, `websocket`
## Code examples
There are two directories of examples:
@@ -65,6 +73,12 @@ There are two directories of examples:
- [foundational](https://github.com/daily-co/daily-ai-sdk/tree/main/examples/foundational) — demos that build on each other, introducing one or two concepts at a time
- [starter apps](https://github.com/daily-co/daily-ai-sdk/tree/main/examples/starter-apps) — complete applications that you can use as starting points for development
Before running the examples you need to install the dependencies (which will install all the dependencies to run all of the examples):
```
pip install -r requirements.txt
```
To run the example below you need to sign up for a [free Daily account](https://dashboard.daily.co/u/signup) and create a Daily room (so you can hear the LLM talking). After that, join the room's URL directly from a browser tab and run:
```
@@ -76,14 +90,14 @@ python examples/foundational/02-llm-say-one-thing.py
_Note that you may need to set up a virtual environment before following the instructions below. For instance, you might need to run the following from the root of the repo:_
```
python3 -m venv env
source env/bin/activate
python3 -m venv venv
source venv/bin/activate
```
From the root of this repo, run the following:
```
pip install -r requirements.txt
pip install -r requirements.txt -r requirements-dev.txt
python -m build
```
@@ -101,13 +115,7 @@ pip install path_to_this_repo
### Running tests
To run tests you need to install `pytest`:
```
pip install pytest
```
Then, from the root directory, run:
From the root directory, run:
```
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests

View File

@@ -20,28 +20,29 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence"
]
dependencies = [
"aiohttp",
"anthropic",
"azure-cognitiveservices-speech",
"daily-python",
"fal",
"faster_whisper",
"flask",
"flask_cors",
"google-cloud-texttospeech",
"numpy",
"openai",
"Pillow",
"pyht",
"python-dotenv",
"typing-extensions",
"websockets"
"aiohttp==3.9.3",
"numpy==1.26.4",
"Pillow==10.2.0",
"typing-extensions==4.10.0",
]
[project.urls]
Source = "https://github.com/daily-co/daily-ai-sdk"
Website = "https://daily.co"
[project.optional-dependencies]
anthropic = [ "anthropic==0.20.0" ]
azure = [ "azure-cognitiveservices-speech==1.36.0" ]
daily = [ "daily-python==0.7.2" ]
examples = [ "python-dotenv==1.0.1", "flask==3.0.2", "flask_cors==4.0.0" ]
fal = [ "fal==0.12.3" ]
local = [ "pyaudio==0.2.14" ]
openai = [ "openai==1.14.2" ]
playht = [ "pyht==0.0.26" ]
silero = [ "torch==2.2.1", "torchaudio==2.2.1" ]
websocket = [ "websockets==12.0" ]
whisper = [ "faster_whisper==1.0.1" ]
[tool.setuptools.packages.find]
# All the following settings are optional:
where = ["src"]

4
requirements-dev.txt Normal file
View File

@@ -0,0 +1,4 @@
autopep8==2.0.4
build==1.0.3
pip-tools==7.4.1
pytest==8.1.1

View File

@@ -1,4 +1,319 @@
autopep8==2.0.4
build==1.0.3
packaging==23.2
pyproject_hooks==1.0.0
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --all-extras pyproject.toml
#
aiohttp==3.9.3
# via dailyai (pyproject.toml)
aiosignal==1.3.1
# via aiohttp
anthropic==0.20.0
# via dailyai (pyproject.toml)
anyio==4.3.0
# via
# anthropic
# httpx
# openai
# starlette
async-timeout==4.0.3
# via aiohttp
attrs==23.2.0
# via
# aiohttp
# fal
av==11.0.0
# via faster-whisper
azure-cognitiveservices-speech==1.36.0
# via dailyai (pyproject.toml)
blinker==1.7.0
# via flask
certifi==2024.2.2
# via
# httpcore
# httpx
# requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# fal
# flask
colorama==0.4.6
# via fal
coloredlogs==15.0.1
# via onnxruntime
ctranslate2==4.1.0
# via faster-whisper
daily-python==0.7.2
# via dailyai (pyproject.toml)
deprecated==1.2.14
# via opentelemetry-api
dill==0.3.7
# via fal
distlib==0.3.8
# via virtualenv
distro==1.9.0
# via
# anthropic
# openai
exceptiongroup==1.2.0
# via anyio
fal==0.12.3
# via dailyai (pyproject.toml)
fastapi==0.99.1
# via fal
faster-whisper==1.0.1
# via dailyai (pyproject.toml)
filelock==3.13.3
# via
# huggingface-hub
# pyht
# torch
# triton
# virtualenv
flask==3.0.2
# via
# dailyai (pyproject.toml)
# flask-cors
flask-cors==4.0.0
# via dailyai (pyproject.toml)
flatbuffers==24.3.25
# via onnxruntime
frozenlist==1.4.1
# via
# aiohttp
# aiosignal
fsspec==2024.3.1
# via
# huggingface-hub
# torch
grpc-interceptor==0.15.4
# via fal
grpcio==1.62.1
# via
# fal
# grpc-interceptor
# isolate
# isolate-proto
# pyht
h11==0.14.0
# via httpcore
httpcore==1.0.5
# via httpx
httpx==0.27.0
# via
# anthropic
# fal
# openai
huggingface-hub==0.22.2
# via
# faster-whisper
# tokenizers
humanfriendly==10.0
# via coloredlogs
idna==3.6
# via
# anyio
# httpx
# requests
# yarl
importlib-metadata==7.0.0
# via opentelemetry-api
isolate[build]==0.12.7
# via
# fal
# isolate-proto
isolate-proto==0.3.3
# via fal
itsdangerous==2.1.2
# via flask
jinja2==3.1.3
# via
# flask
# torch
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.5
# via
# jinja2
# werkzeug
mdurl==0.1.2
# via markdown-it-py
mpmath==1.3.0
# via sympy
msgpack==1.0.8
# via fal
multidict==6.0.5
# via
# aiohttp
# yarl
networkx==3.2.1
# via torch
numpy==1.26.4
# via
# ctranslate2
# dailyai (pyproject.toml)
# onnxruntime
nvidia-cublas-cu12==12.1.3.1
# via
# nvidia-cudnn-cu12
# nvidia-cusolver-cu12
# torch
nvidia-cuda-cupti-cu12==12.1.105
# via torch
nvidia-cuda-nvrtc-cu12==12.1.105
# via torch
nvidia-cuda-runtime-cu12==12.1.105
# via torch
nvidia-cudnn-cu12==8.9.2.26
# via torch
nvidia-cufft-cu12==11.0.2.54
# via torch
nvidia-curand-cu12==10.3.2.106
# via torch
nvidia-cusolver-cu12==11.4.5.107
# via torch
nvidia-cusparse-cu12==12.1.0.106
# via
# nvidia-cusolver-cu12
# torch
nvidia-nccl-cu12==2.19.3
# via torch
nvidia-nvjitlink-cu12==12.4.127
# via
# nvidia-cusolver-cu12
# nvidia-cusparse-cu12
nvidia-nvtx-cu12==12.1.105
# via torch
onnxruntime==1.17.1
# via faster-whisper
openai==1.14.2
# via dailyai (pyproject.toml)
opentelemetry-api==1.24.0
# via
# fal
# opentelemetry-sdk
opentelemetry-sdk==1.24.0
# via fal
opentelemetry-semantic-conventions==0.45b0
# via opentelemetry-sdk
packaging==24.0
# via
# fal
# huggingface-hub
# onnxruntime
pathspec==0.11.2
# via fal
pillow==10.2.0
# via
# dailyai (pyproject.toml)
# fal
platformdirs==4.2.0
# via
# isolate
# virtualenv
portalocker==2.8.2
# via fal
protobuf==4.25.3
# via
# isolate
# isolate-proto
# onnxruntime
# pyht
pyaudio==0.2.14
# via dailyai (pyproject.toml)
pydantic==1.10.15
# via
# anthropic
# fal
# fastapi
# openai
pygments==2.17.2
# via rich
pyht==0.0.26
# via dailyai (pyproject.toml)
pyjwt==2.8.0
# via fal
python-dateutil==2.9.0.post0
# via fal
python-dotenv==1.0.1
# via dailyai (pyproject.toml)
pyyaml==6.0.1
# via
# ctranslate2
# huggingface-hub
# isolate
requests==2.31.0
# via
# huggingface-hub
# pyht
rich==13.7.1
# via fal
six==1.16.0
# via python-dateutil
sniffio==1.3.1
# via
# anthropic
# anyio
# httpx
# openai
starlette==0.27.0
# via fastapi
structlog==22.3.0
# via fal
sympy==1.12
# via
# onnxruntime
# torch
tblib==3.0.0
# via isolate
tokenizers==0.15.2
# via
# anthropic
# faster-whisper
torch==2.2.1
# via
# dailyai (pyproject.toml)
# torchaudio
torchaudio==2.2.1
# via dailyai (pyproject.toml)
tqdm==4.66.2
# via
# huggingface-hub
# openai
triton==2.2.0
# via torch
types-python-dateutil==2.9.0.20240316
# via fal
typing-extensions==4.10.0
# via
# anthropic
# anyio
# dailyai (pyproject.toml)
# fal
# fastapi
# huggingface-hub
# openai
# opentelemetry-sdk
# pydantic
# torch
urllib3==2.2.1
# via requests
virtualenv==20.25.1
# via isolate
websockets==12.0
# via
# dailyai (pyproject.toml)
# fal
werkzeug==3.0.2
# via flask
wrapt==1.16.0
# via deprecated
yarl==1.9.4
# via aiohttp
zipp==3.18.1
# via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# setuptools