From 90c34d278fc90ba6a773293db288b317f13c5dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 18 Mar 2024 11:51:06 -0700 Subject: [PATCH 1/3] move src/examples to examples --- README.md | 6 +++--- docs/README.md | 2 +- docs/examples/01-say-one-thing.md | 2 +- docs/examples/README.md | 2 +- .../foundational/01-say-one-thing.py | 0 .../foundational/01a-local-transport.py | 0 .../foundational/02-llm-say-one-thing.py | 0 .../foundational/03-still-frame.py | 0 .../foundational/03a-image-local.py | 0 .../foundational/04-utterance-and-speech.py | 0 .../foundational/05-sync-speech-and-image.py | 0 .../foundational/05a-local-sync-speech-and-text.py | 0 .../foundational/06-listen-and-respond.py | 0 .../foundational/06a-image-sync.py | 0 .../foundational/07-interruptible.py | 0 .../foundational/08-bots-arguing.py | 0 .../foundational/10-wake-word.py | 0 .../foundational/11-sound-effects.py | 0 .../foundational/13-whisper-transcription.py | 0 .../foundational/13a-whisper-local.py | 0 .../foundational/assets/ding1.wav | Bin .../foundational/assets/ding2.wav | Bin .../foundational/assets/sc-default.png | Bin .../foundational/assets/sc-listen-1.png | Bin .../foundational/assets/sc-listen-2.png | Bin .../foundational/assets/sc-talk.png | Bin .../foundational/assets/sc-think-1.png | Bin .../foundational/assets/sc-think-2.png | Bin .../foundational/assets/sc-think-3.png | Bin .../foundational/assets/sc-think-4.png | Bin .../foundational/assets/speaking.png | Bin .../foundational/assets/waiting.png | Bin {src/examples => examples}/image-gen.py | 0 {src/examples => examples}/internal/11a-dial-out.py | 0 {src/examples => examples}/server/Dockerfile | 0 {src/examples => examples}/server/README.md | 0 {src/examples => examples}/server/auth.py | 0 .../server/daily-bot-manager.py | 2 +- .../starter-apps/assets/clack-short-quiet.wav | Bin .../starter-apps/assets/clack-short.wav | Bin .../starter-apps/assets/clack.wav | Bin .../starter-apps/assets/ding.wav | Bin .../starter-apps/assets/ding2.wav | Bin .../starter-apps/assets/ding3.wav | Bin .../starter-apps/assets/grandma-listening.png | Bin .../starter-apps/assets/grandma-writing.png | Bin .../starter-apps/assets/listening.wav | Bin .../starter-apps/assets/robot01.png | Bin .../starter-apps/assets/robot010.png | Bin .../starter-apps/assets/robot011.png | Bin .../starter-apps/assets/robot012.png | Bin .../starter-apps/assets/robot013.png | Bin .../starter-apps/assets/robot014.png | Bin .../starter-apps/assets/robot015.png | Bin .../starter-apps/assets/robot016.png | Bin .../starter-apps/assets/robot017.png | Bin .../starter-apps/assets/robot018.png | Bin .../starter-apps/assets/robot019.png | Bin .../starter-apps/assets/robot02.png | Bin .../starter-apps/assets/robot020.png | Bin .../starter-apps/assets/robot021.png | Bin .../starter-apps/assets/robot022.png | Bin .../starter-apps/assets/robot023.png | Bin .../starter-apps/assets/robot024.png | Bin .../starter-apps/assets/robot025.png | Bin .../starter-apps/assets/robot03.png | Bin .../starter-apps/assets/robot04.png | Bin .../starter-apps/assets/robot05.png | Bin .../starter-apps/assets/robot06.png | Bin .../starter-apps/assets/robot07.png | Bin .../starter-apps/assets/robot08.png | Bin .../starter-apps/assets/robot09.png | Bin .../starter-apps/assets/talking.wav | Bin {src/examples => examples}/starter-apps/chatbot.py | 0 .../starter-apps/patient-intake.py | 0 {src/examples => examples}/starter-apps/storybot.py | 0 .../starter-apps/translator.py | 0 {src/examples => examples}/support/runner.py | 0 78 files changed, 7 insertions(+), 7 deletions(-) rename {src/examples => examples}/foundational/01-say-one-thing.py (100%) rename {src/examples => examples}/foundational/01a-local-transport.py (100%) rename {src/examples => examples}/foundational/02-llm-say-one-thing.py (100%) rename {src/examples => examples}/foundational/03-still-frame.py (100%) rename {src/examples => examples}/foundational/03a-image-local.py (100%) rename {src/examples => examples}/foundational/04-utterance-and-speech.py (100%) rename {src/examples => examples}/foundational/05-sync-speech-and-image.py (100%) rename {src/examples => examples}/foundational/05a-local-sync-speech-and-text.py (100%) rename {src/examples => examples}/foundational/06-listen-and-respond.py (100%) rename {src/examples => examples}/foundational/06a-image-sync.py (100%) rename {src/examples => examples}/foundational/07-interruptible.py (100%) rename {src/examples => examples}/foundational/08-bots-arguing.py (100%) rename {src/examples => examples}/foundational/10-wake-word.py (100%) rename {src/examples => examples}/foundational/11-sound-effects.py (100%) rename {src/examples => examples}/foundational/13-whisper-transcription.py (100%) rename {src/examples => examples}/foundational/13a-whisper-local.py (100%) rename {src/examples => examples}/foundational/assets/ding1.wav (100%) rename {src/examples => examples}/foundational/assets/ding2.wav (100%) rename {src/examples => examples}/foundational/assets/sc-default.png (100%) rename {src/examples => examples}/foundational/assets/sc-listen-1.png (100%) rename {src/examples => examples}/foundational/assets/sc-listen-2.png (100%) rename {src/examples => examples}/foundational/assets/sc-talk.png (100%) rename {src/examples => examples}/foundational/assets/sc-think-1.png (100%) rename {src/examples => examples}/foundational/assets/sc-think-2.png (100%) rename {src/examples => examples}/foundational/assets/sc-think-3.png (100%) rename {src/examples => examples}/foundational/assets/sc-think-4.png (100%) rename {src/examples => examples}/foundational/assets/speaking.png (100%) rename {src/examples => examples}/foundational/assets/waiting.png (100%) rename {src/examples => examples}/image-gen.py (100%) rename {src/examples => examples}/internal/11a-dial-out.py (100%) rename {src/examples => examples}/server/Dockerfile (100%) rename {src/examples => examples}/server/README.md (100%) rename {src/examples => examples}/server/auth.py (100%) rename {src/examples => examples}/server/daily-bot-manager.py (97%) rename {src/examples => examples}/starter-apps/assets/clack-short-quiet.wav (100%) rename {src/examples => examples}/starter-apps/assets/clack-short.wav (100%) rename {src/examples => examples}/starter-apps/assets/clack.wav (100%) rename {src/examples => examples}/starter-apps/assets/ding.wav (100%) rename {src/examples => examples}/starter-apps/assets/ding2.wav (100%) rename {src/examples => examples}/starter-apps/assets/ding3.wav (100%) rename {src/examples => examples}/starter-apps/assets/grandma-listening.png (100%) rename {src/examples => examples}/starter-apps/assets/grandma-writing.png (100%) rename {src/examples => examples}/starter-apps/assets/listening.wav (100%) rename {src/examples => examples}/starter-apps/assets/robot01.png (100%) rename {src/examples => examples}/starter-apps/assets/robot010.png (100%) rename {src/examples => examples}/starter-apps/assets/robot011.png (100%) rename {src/examples => examples}/starter-apps/assets/robot012.png (100%) rename {src/examples => examples}/starter-apps/assets/robot013.png (100%) rename {src/examples => examples}/starter-apps/assets/robot014.png (100%) rename {src/examples => examples}/starter-apps/assets/robot015.png (100%) rename {src/examples => examples}/starter-apps/assets/robot016.png (100%) rename {src/examples => examples}/starter-apps/assets/robot017.png (100%) rename {src/examples => examples}/starter-apps/assets/robot018.png (100%) rename {src/examples => examples}/starter-apps/assets/robot019.png (100%) rename {src/examples => examples}/starter-apps/assets/robot02.png (100%) rename {src/examples => examples}/starter-apps/assets/robot020.png (100%) rename {src/examples => examples}/starter-apps/assets/robot021.png (100%) rename {src/examples => examples}/starter-apps/assets/robot022.png (100%) rename {src/examples => examples}/starter-apps/assets/robot023.png (100%) rename {src/examples => examples}/starter-apps/assets/robot024.png (100%) rename {src/examples => examples}/starter-apps/assets/robot025.png (100%) rename {src/examples => examples}/starter-apps/assets/robot03.png (100%) rename {src/examples => examples}/starter-apps/assets/robot04.png (100%) rename {src/examples => examples}/starter-apps/assets/robot05.png (100%) rename {src/examples => examples}/starter-apps/assets/robot06.png (100%) rename {src/examples => examples}/starter-apps/assets/robot07.png (100%) rename {src/examples => examples}/starter-apps/assets/robot08.png (100%) rename {src/examples => examples}/starter-apps/assets/robot09.png (100%) rename {src/examples => examples}/starter-apps/assets/talking.wav (100%) rename {src/examples => examples}/starter-apps/chatbot.py (100%) rename {src/examples => examples}/starter-apps/patient-intake.py (100%) rename {src/examples => examples}/starter-apps/storybot.py (100%) rename {src/examples => examples}/starter-apps/translator.py (100%) rename {src/examples => examples}/support/runner.py (100%) diff --git a/README.md b/README.md index d852245a2..dc418857a 100644 --- a/README.md +++ b/README.md @@ -60,15 +60,15 @@ cp dot-env.template .env # sign up for a free Daily account, if you don't already have one, and # join the Daily room URL directly from a browser tab, then run one of the # samples -python src/examples/foundational/02-llm-say-one-thing.py +python examples/foundational/02-llm-say-one-thing.py ``` ## Code examples There are two directories of examples: -- [foundational](https://github.com/daily-co/daily-ai-sdk/tree/main/src/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/src/examples/starter-apps) — complete applications that you can use as starting points for development +- [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 diff --git a/docs/README.md b/docs/README.md index c3be534f0..9db83ac11 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,7 +6,7 @@ Learn about the thinking behind the SDK's design. ## [Example Code](examples/) -The repo includes several example apps in the `src/examples` directory. The docs explain how they work. +The repo includes several example apps in the `examples` directory. The docs explain how they work. ## [API Reference](api/) diff --git a/docs/examples/01-say-one-thing.md b/docs/examples/01-say-one-thing.md index 319c89960..3d8231ded 100644 --- a/docs/examples/01-say-one-thing.md +++ b/docs/examples/01-say-one-thing.md @@ -16,7 +16,7 @@ if __name__ == "__main__": ### `configure()` -The `configure()` function comes from `src/examples/foundational/support/runner.py`, and it allows you to configure the examples from the command line directly, or using environment variables: +The `configure()` function comes from `examples/foundational/support/runner.py`, and it allows you to configure the examples from the command line directly, or using environment variables: ```bash python 01-say-one-thing.py -u https://YOUR_DOMAIN.daily.co/YOUR_ROOM -k YOUR_API_KEY diff --git a/docs/examples/README.md b/docs/examples/README.md index ba3f6f45d..dea68ffc9 100644 --- a/docs/examples/README.md +++ b/docs/examples/README.md @@ -1,5 +1,5 @@ # Daily AI SDK Examples -The docs in this folder pair with the example apps located in `src/examples/foundational`. They are designed to serve as a quick references for building different kinds of AI apps. But the examples also build on one another, so it can be really helpful to walk through them in order. +The docs in this folder pair with the example apps located in `examples/foundational`. They are designed to serve as a quick references for building different kinds of AI apps. But the examples also build on one another, so it can be really helpful to walk through them in order. To start, you can learn about the overall structure of the examples in [01 - Say One Thing](01-say-one-thing.md). diff --git a/src/examples/foundational/01-say-one-thing.py b/examples/foundational/01-say-one-thing.py similarity index 100% rename from src/examples/foundational/01-say-one-thing.py rename to examples/foundational/01-say-one-thing.py diff --git a/src/examples/foundational/01a-local-transport.py b/examples/foundational/01a-local-transport.py similarity index 100% rename from src/examples/foundational/01a-local-transport.py rename to examples/foundational/01a-local-transport.py diff --git a/src/examples/foundational/02-llm-say-one-thing.py b/examples/foundational/02-llm-say-one-thing.py similarity index 100% rename from src/examples/foundational/02-llm-say-one-thing.py rename to examples/foundational/02-llm-say-one-thing.py diff --git a/src/examples/foundational/03-still-frame.py b/examples/foundational/03-still-frame.py similarity index 100% rename from src/examples/foundational/03-still-frame.py rename to examples/foundational/03-still-frame.py diff --git a/src/examples/foundational/03a-image-local.py b/examples/foundational/03a-image-local.py similarity index 100% rename from src/examples/foundational/03a-image-local.py rename to examples/foundational/03a-image-local.py diff --git a/src/examples/foundational/04-utterance-and-speech.py b/examples/foundational/04-utterance-and-speech.py similarity index 100% rename from src/examples/foundational/04-utterance-and-speech.py rename to examples/foundational/04-utterance-and-speech.py diff --git a/src/examples/foundational/05-sync-speech-and-image.py b/examples/foundational/05-sync-speech-and-image.py similarity index 100% rename from src/examples/foundational/05-sync-speech-and-image.py rename to examples/foundational/05-sync-speech-and-image.py diff --git a/src/examples/foundational/05a-local-sync-speech-and-text.py b/examples/foundational/05a-local-sync-speech-and-text.py similarity index 100% rename from src/examples/foundational/05a-local-sync-speech-and-text.py rename to examples/foundational/05a-local-sync-speech-and-text.py diff --git a/src/examples/foundational/06-listen-and-respond.py b/examples/foundational/06-listen-and-respond.py similarity index 100% rename from src/examples/foundational/06-listen-and-respond.py rename to examples/foundational/06-listen-and-respond.py diff --git a/src/examples/foundational/06a-image-sync.py b/examples/foundational/06a-image-sync.py similarity index 100% rename from src/examples/foundational/06a-image-sync.py rename to examples/foundational/06a-image-sync.py diff --git a/src/examples/foundational/07-interruptible.py b/examples/foundational/07-interruptible.py similarity index 100% rename from src/examples/foundational/07-interruptible.py rename to examples/foundational/07-interruptible.py diff --git a/src/examples/foundational/08-bots-arguing.py b/examples/foundational/08-bots-arguing.py similarity index 100% rename from src/examples/foundational/08-bots-arguing.py rename to examples/foundational/08-bots-arguing.py diff --git a/src/examples/foundational/10-wake-word.py b/examples/foundational/10-wake-word.py similarity index 100% rename from src/examples/foundational/10-wake-word.py rename to examples/foundational/10-wake-word.py diff --git a/src/examples/foundational/11-sound-effects.py b/examples/foundational/11-sound-effects.py similarity index 100% rename from src/examples/foundational/11-sound-effects.py rename to examples/foundational/11-sound-effects.py diff --git a/src/examples/foundational/13-whisper-transcription.py b/examples/foundational/13-whisper-transcription.py similarity index 100% rename from src/examples/foundational/13-whisper-transcription.py rename to examples/foundational/13-whisper-transcription.py diff --git a/src/examples/foundational/13a-whisper-local.py b/examples/foundational/13a-whisper-local.py similarity index 100% rename from src/examples/foundational/13a-whisper-local.py rename to examples/foundational/13a-whisper-local.py diff --git a/src/examples/foundational/assets/ding1.wav b/examples/foundational/assets/ding1.wav similarity index 100% rename from src/examples/foundational/assets/ding1.wav rename to examples/foundational/assets/ding1.wav diff --git a/src/examples/foundational/assets/ding2.wav b/examples/foundational/assets/ding2.wav similarity index 100% rename from src/examples/foundational/assets/ding2.wav rename to examples/foundational/assets/ding2.wav diff --git a/src/examples/foundational/assets/sc-default.png b/examples/foundational/assets/sc-default.png similarity index 100% rename from src/examples/foundational/assets/sc-default.png rename to examples/foundational/assets/sc-default.png diff --git a/src/examples/foundational/assets/sc-listen-1.png b/examples/foundational/assets/sc-listen-1.png similarity index 100% rename from src/examples/foundational/assets/sc-listen-1.png rename to examples/foundational/assets/sc-listen-1.png diff --git a/src/examples/foundational/assets/sc-listen-2.png b/examples/foundational/assets/sc-listen-2.png similarity index 100% rename from src/examples/foundational/assets/sc-listen-2.png rename to examples/foundational/assets/sc-listen-2.png diff --git a/src/examples/foundational/assets/sc-talk.png b/examples/foundational/assets/sc-talk.png similarity index 100% rename from src/examples/foundational/assets/sc-talk.png rename to examples/foundational/assets/sc-talk.png diff --git a/src/examples/foundational/assets/sc-think-1.png b/examples/foundational/assets/sc-think-1.png similarity index 100% rename from src/examples/foundational/assets/sc-think-1.png rename to examples/foundational/assets/sc-think-1.png diff --git a/src/examples/foundational/assets/sc-think-2.png b/examples/foundational/assets/sc-think-2.png similarity index 100% rename from src/examples/foundational/assets/sc-think-2.png rename to examples/foundational/assets/sc-think-2.png diff --git a/src/examples/foundational/assets/sc-think-3.png b/examples/foundational/assets/sc-think-3.png similarity index 100% rename from src/examples/foundational/assets/sc-think-3.png rename to examples/foundational/assets/sc-think-3.png diff --git a/src/examples/foundational/assets/sc-think-4.png b/examples/foundational/assets/sc-think-4.png similarity index 100% rename from src/examples/foundational/assets/sc-think-4.png rename to examples/foundational/assets/sc-think-4.png diff --git a/src/examples/foundational/assets/speaking.png b/examples/foundational/assets/speaking.png similarity index 100% rename from src/examples/foundational/assets/speaking.png rename to examples/foundational/assets/speaking.png diff --git a/src/examples/foundational/assets/waiting.png b/examples/foundational/assets/waiting.png similarity index 100% rename from src/examples/foundational/assets/waiting.png rename to examples/foundational/assets/waiting.png diff --git a/src/examples/image-gen.py b/examples/image-gen.py similarity index 100% rename from src/examples/image-gen.py rename to examples/image-gen.py diff --git a/src/examples/internal/11a-dial-out.py b/examples/internal/11a-dial-out.py similarity index 100% rename from src/examples/internal/11a-dial-out.py rename to examples/internal/11a-dial-out.py diff --git a/src/examples/server/Dockerfile b/examples/server/Dockerfile similarity index 100% rename from src/examples/server/Dockerfile rename to examples/server/Dockerfile diff --git a/src/examples/server/README.md b/examples/server/README.md similarity index 100% rename from src/examples/server/README.md rename to examples/server/README.md diff --git a/src/examples/server/auth.py b/examples/server/auth.py similarity index 100% rename from src/examples/server/auth.py rename to examples/server/auth.py diff --git a/src/examples/server/daily-bot-manager.py b/examples/server/daily-bot-manager.py similarity index 97% rename from src/examples/server/daily-bot-manager.py rename to examples/server/daily-bot-manager.py index f59d7fc67..64d48e9a9 100644 --- a/src/examples/server/daily-bot-manager.py +++ b/examples/server/daily-bot-manager.py @@ -95,7 +95,7 @@ def start_bot(bot_path, args=None): @app.route("/spin-up-kitty", methods=["GET", "POST"]) def spin_up_kitty(): - return start_bot("./src/examples/foundational/10-wake-word.py") + return start_bot("./examples/foundational/10-wake-word.py") @app.route("/healthz") diff --git a/src/examples/starter-apps/assets/clack-short-quiet.wav b/examples/starter-apps/assets/clack-short-quiet.wav similarity index 100% rename from src/examples/starter-apps/assets/clack-short-quiet.wav rename to examples/starter-apps/assets/clack-short-quiet.wav diff --git a/src/examples/starter-apps/assets/clack-short.wav b/examples/starter-apps/assets/clack-short.wav similarity index 100% rename from src/examples/starter-apps/assets/clack-short.wav rename to examples/starter-apps/assets/clack-short.wav diff --git a/src/examples/starter-apps/assets/clack.wav b/examples/starter-apps/assets/clack.wav similarity index 100% rename from src/examples/starter-apps/assets/clack.wav rename to examples/starter-apps/assets/clack.wav diff --git a/src/examples/starter-apps/assets/ding.wav b/examples/starter-apps/assets/ding.wav similarity index 100% rename from src/examples/starter-apps/assets/ding.wav rename to examples/starter-apps/assets/ding.wav diff --git a/src/examples/starter-apps/assets/ding2.wav b/examples/starter-apps/assets/ding2.wav similarity index 100% rename from src/examples/starter-apps/assets/ding2.wav rename to examples/starter-apps/assets/ding2.wav diff --git a/src/examples/starter-apps/assets/ding3.wav b/examples/starter-apps/assets/ding3.wav similarity index 100% rename from src/examples/starter-apps/assets/ding3.wav rename to examples/starter-apps/assets/ding3.wav diff --git a/src/examples/starter-apps/assets/grandma-listening.png b/examples/starter-apps/assets/grandma-listening.png similarity index 100% rename from src/examples/starter-apps/assets/grandma-listening.png rename to examples/starter-apps/assets/grandma-listening.png diff --git a/src/examples/starter-apps/assets/grandma-writing.png b/examples/starter-apps/assets/grandma-writing.png similarity index 100% rename from src/examples/starter-apps/assets/grandma-writing.png rename to examples/starter-apps/assets/grandma-writing.png diff --git a/src/examples/starter-apps/assets/listening.wav b/examples/starter-apps/assets/listening.wav similarity index 100% rename from src/examples/starter-apps/assets/listening.wav rename to examples/starter-apps/assets/listening.wav diff --git a/src/examples/starter-apps/assets/robot01.png b/examples/starter-apps/assets/robot01.png similarity index 100% rename from src/examples/starter-apps/assets/robot01.png rename to examples/starter-apps/assets/robot01.png diff --git a/src/examples/starter-apps/assets/robot010.png b/examples/starter-apps/assets/robot010.png similarity index 100% rename from src/examples/starter-apps/assets/robot010.png rename to examples/starter-apps/assets/robot010.png diff --git a/src/examples/starter-apps/assets/robot011.png b/examples/starter-apps/assets/robot011.png similarity index 100% rename from src/examples/starter-apps/assets/robot011.png rename to examples/starter-apps/assets/robot011.png diff --git a/src/examples/starter-apps/assets/robot012.png b/examples/starter-apps/assets/robot012.png similarity index 100% rename from src/examples/starter-apps/assets/robot012.png rename to examples/starter-apps/assets/robot012.png diff --git a/src/examples/starter-apps/assets/robot013.png b/examples/starter-apps/assets/robot013.png similarity index 100% rename from src/examples/starter-apps/assets/robot013.png rename to examples/starter-apps/assets/robot013.png diff --git a/src/examples/starter-apps/assets/robot014.png b/examples/starter-apps/assets/robot014.png similarity index 100% rename from src/examples/starter-apps/assets/robot014.png rename to examples/starter-apps/assets/robot014.png diff --git a/src/examples/starter-apps/assets/robot015.png b/examples/starter-apps/assets/robot015.png similarity index 100% rename from src/examples/starter-apps/assets/robot015.png rename to examples/starter-apps/assets/robot015.png diff --git a/src/examples/starter-apps/assets/robot016.png b/examples/starter-apps/assets/robot016.png similarity index 100% rename from src/examples/starter-apps/assets/robot016.png rename to examples/starter-apps/assets/robot016.png diff --git a/src/examples/starter-apps/assets/robot017.png b/examples/starter-apps/assets/robot017.png similarity index 100% rename from src/examples/starter-apps/assets/robot017.png rename to examples/starter-apps/assets/robot017.png diff --git a/src/examples/starter-apps/assets/robot018.png b/examples/starter-apps/assets/robot018.png similarity index 100% rename from src/examples/starter-apps/assets/robot018.png rename to examples/starter-apps/assets/robot018.png diff --git a/src/examples/starter-apps/assets/robot019.png b/examples/starter-apps/assets/robot019.png similarity index 100% rename from src/examples/starter-apps/assets/robot019.png rename to examples/starter-apps/assets/robot019.png diff --git a/src/examples/starter-apps/assets/robot02.png b/examples/starter-apps/assets/robot02.png similarity index 100% rename from src/examples/starter-apps/assets/robot02.png rename to examples/starter-apps/assets/robot02.png diff --git a/src/examples/starter-apps/assets/robot020.png b/examples/starter-apps/assets/robot020.png similarity index 100% rename from src/examples/starter-apps/assets/robot020.png rename to examples/starter-apps/assets/robot020.png diff --git a/src/examples/starter-apps/assets/robot021.png b/examples/starter-apps/assets/robot021.png similarity index 100% rename from src/examples/starter-apps/assets/robot021.png rename to examples/starter-apps/assets/robot021.png diff --git a/src/examples/starter-apps/assets/robot022.png b/examples/starter-apps/assets/robot022.png similarity index 100% rename from src/examples/starter-apps/assets/robot022.png rename to examples/starter-apps/assets/robot022.png diff --git a/src/examples/starter-apps/assets/robot023.png b/examples/starter-apps/assets/robot023.png similarity index 100% rename from src/examples/starter-apps/assets/robot023.png rename to examples/starter-apps/assets/robot023.png diff --git a/src/examples/starter-apps/assets/robot024.png b/examples/starter-apps/assets/robot024.png similarity index 100% rename from src/examples/starter-apps/assets/robot024.png rename to examples/starter-apps/assets/robot024.png diff --git a/src/examples/starter-apps/assets/robot025.png b/examples/starter-apps/assets/robot025.png similarity index 100% rename from src/examples/starter-apps/assets/robot025.png rename to examples/starter-apps/assets/robot025.png diff --git a/src/examples/starter-apps/assets/robot03.png b/examples/starter-apps/assets/robot03.png similarity index 100% rename from src/examples/starter-apps/assets/robot03.png rename to examples/starter-apps/assets/robot03.png diff --git a/src/examples/starter-apps/assets/robot04.png b/examples/starter-apps/assets/robot04.png similarity index 100% rename from src/examples/starter-apps/assets/robot04.png rename to examples/starter-apps/assets/robot04.png diff --git a/src/examples/starter-apps/assets/robot05.png b/examples/starter-apps/assets/robot05.png similarity index 100% rename from src/examples/starter-apps/assets/robot05.png rename to examples/starter-apps/assets/robot05.png diff --git a/src/examples/starter-apps/assets/robot06.png b/examples/starter-apps/assets/robot06.png similarity index 100% rename from src/examples/starter-apps/assets/robot06.png rename to examples/starter-apps/assets/robot06.png diff --git a/src/examples/starter-apps/assets/robot07.png b/examples/starter-apps/assets/robot07.png similarity index 100% rename from src/examples/starter-apps/assets/robot07.png rename to examples/starter-apps/assets/robot07.png diff --git a/src/examples/starter-apps/assets/robot08.png b/examples/starter-apps/assets/robot08.png similarity index 100% rename from src/examples/starter-apps/assets/robot08.png rename to examples/starter-apps/assets/robot08.png diff --git a/src/examples/starter-apps/assets/robot09.png b/examples/starter-apps/assets/robot09.png similarity index 100% rename from src/examples/starter-apps/assets/robot09.png rename to examples/starter-apps/assets/robot09.png diff --git a/src/examples/starter-apps/assets/talking.wav b/examples/starter-apps/assets/talking.wav similarity index 100% rename from src/examples/starter-apps/assets/talking.wav rename to examples/starter-apps/assets/talking.wav diff --git a/src/examples/starter-apps/chatbot.py b/examples/starter-apps/chatbot.py similarity index 100% rename from src/examples/starter-apps/chatbot.py rename to examples/starter-apps/chatbot.py diff --git a/src/examples/starter-apps/patient-intake.py b/examples/starter-apps/patient-intake.py similarity index 100% rename from src/examples/starter-apps/patient-intake.py rename to examples/starter-apps/patient-intake.py diff --git a/src/examples/starter-apps/storybot.py b/examples/starter-apps/storybot.py similarity index 100% rename from src/examples/starter-apps/storybot.py rename to examples/starter-apps/storybot.py diff --git a/src/examples/starter-apps/translator.py b/examples/starter-apps/translator.py similarity index 100% rename from src/examples/starter-apps/translator.py rename to examples/starter-apps/translator.py diff --git a/src/examples/support/runner.py b/examples/support/runner.py similarity index 100% rename from src/examples/support/runner.py rename to examples/support/runner.py From 69c2637a25bd2f8465b2ce6a43483594537723fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 18 Mar 2024 14:05:05 -0700 Subject: [PATCH 2/3] README.md: update examples --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dc418857a..71360aef3 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Currently implemented services: If you'd like to [implement a service]((https://github.com/daily-co/daily-ai-sdk/tree/main/src/dailyai/services)), we welcome PRs! Our goal is to support lots of services in all of the above categories, plus new categories (like real-time video) as they emerge. -## Step 1: Get started +## 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.) @@ -56,11 +56,6 @@ pip install dailyai # set up an .env file with API keys cp dot-env.template .env - -# sign up for a free Daily account, if you don't already have one, and -# join the Daily room URL directly from a browser tab, then run one of the -# samples -python examples/foundational/02-llm-say-one-thing.py ``` ## Code examples @@ -70,7 +65,11 @@ 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 +To run the example below you to sign up for a [free Daily account](https://dashboard.daily.co/u/signup) (so you can hear the LLM talking) and create a Daily room. After that, join the room's URL directly from a browser tab and run: +``` +python examples/foundational/02-llm-say-one-thing.py +``` ## Hacking on the framework itself From a573277a106a7a3050a693daed7bc02316afbf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 18 Mar 2024 15:13:38 -0700 Subject: [PATCH 3/3] examples: copy runner.py and auth.py where needed --- examples/foundational/01-say-one-thing.py | 5 +- examples/foundational/02-llm-say-one-thing.py | 5 +- examples/foundational/03-still-frame.py | 5 +- .../foundational/04-utterance-and-speech.py | 6 +- .../foundational/05-sync-speech-and-image.py | 5 +- .../foundational/06-listen-and-respond.py | 5 +- examples/foundational/06a-image-sync.py | 6 +- examples/foundational/07-interruptible.py | 6 +- examples/foundational/08-bots-arguing.py | 6 +- examples/foundational/10-wake-word.py | 6 +- examples/foundational/11-sound-effects.py | 5 +- .../foundational/13-whisper-transcription.py | 6 +- examples/{support => foundational}/runner.py | 3 - examples/internal/11a-dial-out.py | 5 +- examples/server/auth.py | 3 - examples/server/daily-bot-manager.py | 4 +- examples/starter-apps/chatbot.py | 6 +- examples/starter-apps/patient-intake.py | 6 +- examples/starter-apps/runner.py | 58 +++++++++++++++++++ examples/starter-apps/storybot.py | 6 +- examples/starter-apps/translator.py | 6 +- 21 files changed, 138 insertions(+), 25 deletions(-) rename examples/{support => foundational}/runner.py (97%) create mode 100644 examples/starter-apps/runner.py diff --git a/examples/foundational/01-say-one-thing.py b/examples/foundational/01-say-one-thing.py index e9531ad9a..c92e28419 100644 --- a/examples/foundational/01-say-one-thing.py +++ b/examples/foundational/01-say-one-thing.py @@ -8,7 +8,10 @@ from dailyai.services.daily_transport_service import DailyTransportService from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/02-llm-say-one-thing.py b/examples/foundational/02-llm-say-one-thing.py index 40113404e..0a1ad1432 100644 --- a/examples/foundational/02-llm-say-one-thing.py +++ b/examples/foundational/02-llm-say-one-thing.py @@ -10,7 +10,10 @@ from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService from dailyai.services.open_ai_services import OpenAILLMService -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/03-still-frame.py b/examples/foundational/03-still-frame.py index 3a58f5bb8..fe89ca1df 100644 --- a/examples/foundational/03-still-frame.py +++ b/examples/foundational/03-still-frame.py @@ -8,7 +8,10 @@ from dailyai.services.daily_transport_service import DailyTransportService from dailyai.services.fal_ai_services import FalImageGenService -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/04-utterance-and-speech.py b/examples/foundational/04-utterance-and-speech.py index b35bc0436..86d401b87 100644 --- a/examples/foundational/04-utterance-and-speech.py +++ b/examples/foundational/04-utterance-and-speech.py @@ -11,7 +11,11 @@ from dailyai.services.deepgram_ai_services import DeepgramTTSService from dailyai.pipeline.frames import EndFrame, EndPipeFrame, LLMMessagesQueueFrame, TextFrame from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/05-sync-speech-and-image.py b/examples/foundational/05-sync-speech-and-image.py index f62dd6c00..306aa54d2 100644 --- a/examples/foundational/05-sync-speech-and-image.py +++ b/examples/foundational/05-sync-speech-and-image.py @@ -29,7 +29,10 @@ from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService from dailyai.services.fal_ai_services import FalImageGenService -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/06-listen-and-respond.py b/examples/foundational/06-listen-and-respond.py index 3dd2fc2fa..ff9e95450 100644 --- a/examples/foundational/06-listen-and-respond.py +++ b/examples/foundational/06-listen-and-respond.py @@ -13,7 +13,10 @@ LLMAssistantContextAggregator, LLMUserContextAggregator, ) -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/06a-image-sync.py b/examples/foundational/06a-image-sync.py index 80a4b8929..3b5efdd32 100644 --- a/examples/foundational/06a-image-sync.py +++ b/examples/foundational/06a-image-sync.py @@ -19,7 +19,11 @@ from dailyai.services.open_ai_services import OpenAILLMService from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService from dailyai.services.fal_ai_services import FalImageGenService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/07-interruptible.py b/examples/foundational/07-interruptible.py index af6adb275..f0df4d73f 100644 --- a/examples/foundational/07-interruptible.py +++ b/examples/foundational/07-interruptible.py @@ -14,7 +14,11 @@ from dailyai.services.daily_transport_service import DailyTransportService from dailyai.services.open_ai_services import OpenAILLMService from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/08-bots-arguing.py b/examples/foundational/08-bots-arguing.py index 35cc062e7..42e4d81cc 100644 --- a/examples/foundational/08-bots-arguing.py +++ b/examples/foundational/08-bots-arguing.py @@ -11,7 +11,11 @@ from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService from dailyai.services.fal_ai_services import FalImageGenService from dailyai.pipeline.frames import AudioFrame, EndFrame, ImageFrame, LLMMessagesQueueFrame, TextFrame -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/10-wake-word.py b/examples/foundational/10-wake-word.py index 169d3fbdc..6a8a299b7 100644 --- a/examples/foundational/10-wake-word.py +++ b/examples/foundational/10-wake-word.py @@ -21,7 +21,11 @@ TranscriptionQueueFrame, ) from dailyai.services.ai_services import AIService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/11-sound-effects.py b/examples/foundational/11-sound-effects.py index 5459878d1..50f98c610 100644 --- a/examples/foundational/11-sound-effects.py +++ b/examples/foundational/11-sound-effects.py @@ -21,7 +21,10 @@ ) from typing import AsyncGenerator -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/foundational/13-whisper-transcription.py b/examples/foundational/13-whisper-transcription.py index dfa2f1ae7..89fbcdacf 100644 --- a/examples/foundational/13-whisper-transcription.py +++ b/examples/foundational/13-whisper-transcription.py @@ -3,7 +3,11 @@ from dailyai.services.daily_transport_service import DailyTransportService from dailyai.services.whisper_ai_services import WhisperSTTService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/support/runner.py b/examples/foundational/runner.py similarity index 97% rename from examples/support/runner.py rename to examples/foundational/runner.py index abdbaeee4..6d1a8113d 100644 --- a/examples/support/runner.py +++ b/examples/foundational/runner.py @@ -4,9 +4,6 @@ import urllib import requests -from dotenv import load_dotenv -load_dotenv() - def configure(): parser = argparse.ArgumentParser(description="Daily AI SDK Bot Sample") diff --git a/examples/internal/11a-dial-out.py b/examples/internal/11a-dial-out.py index 9cdad8f84..1ed1339ee 100644 --- a/examples/internal/11a-dial-out.py +++ b/examples/internal/11a-dial-out.py @@ -10,7 +10,10 @@ from dailyai.pipeline.frames import Frame, AudioFrame, LLMResponseEndFrame, LLMMessagesQueueFrame from typing import AsyncGenerator -from examples.support.runner import configure +from runner import configure + +from dotenv import load_dotenv +load_dotenv() sounds = {} sound_files = [ diff --git a/examples/server/auth.py b/examples/server/auth.py index fb80dcc04..7b1f812ec 100644 --- a/examples/server/auth.py +++ b/examples/server/auth.py @@ -1,13 +1,10 @@ import time import urllib -from dotenv import load_dotenv import requests from flask import jsonify import os -load_dotenv() - def get_meeting_token(room_name, daily_api_key, token_expiry): api_path = os.getenv('DAILY_API_PATH') or 'https://api.daily.co/v1' diff --git a/examples/server/daily-bot-manager.py b/examples/server/daily-bot-manager.py index 64d48e9a9..5c2f6f60f 100644 --- a/examples/server/daily-bot-manager.py +++ b/examples/server/daily-bot-manager.py @@ -5,10 +5,10 @@ from flask import Flask, jsonify, request, redirect from flask_cors import CORS -from examples.server.auth import get_meeting_token -from dotenv import load_dotenv +from auth import get_meeting_token +from dotenv import load_dotenv load_dotenv() app = Flask(__name__) diff --git a/examples/starter-apps/chatbot.py b/examples/starter-apps/chatbot.py index 2b3b419b5..6bb4b1271 100644 --- a/examples/starter-apps/chatbot.py +++ b/examples/starter-apps/chatbot.py @@ -23,7 +23,11 @@ from dailyai.services.daily_transport_service import DailyTransportService from dailyai.services.open_ai_services import OpenAILLMService from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") diff --git a/examples/starter-apps/patient-intake.py b/examples/starter-apps/patient-intake.py index 536faab4b..49cb09765 100644 --- a/examples/starter-apps/patient-intake.py +++ b/examples/starter-apps/patient-intake.py @@ -20,7 +20,6 @@ from dailyai.services.open_ai_services import OpenAILLMService from dailyai.services.deepgram_ai_services import DeepgramTTSService from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService -from examples.support.runner import configure from dailyai.pipeline.frames import ( OpenAILLMContextFrame, TranscriptionQueueFrame, @@ -36,6 +35,11 @@ ChatCompletionToolParam, ) +from runner import configure + +from dotenv import load_dotenv +load_dotenv() + logging.basicConfig(format="%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") logger.setLevel(logging.DEBUG) diff --git a/examples/starter-apps/runner.py b/examples/starter-apps/runner.py new file mode 100644 index 000000000..6d1a8113d --- /dev/null +++ b/examples/starter-apps/runner.py @@ -0,0 +1,58 @@ +import argparse +import os +import time +import urllib +import requests + + +def configure(): + parser = argparse.ArgumentParser(description="Daily AI SDK Bot Sample") + parser.add_argument( + "-u", + "--url", + type=str, + required=False, + help="URL of the Daily room to join") + parser.add_argument( + "-k", + "--apikey", + type=str, + required=False, + help="Daily API Key (needed to create an owner token for the room)", + ) + + args, unknown = parser.parse_known_args() + + url = args.url or os.getenv("DAILY_SAMPLE_ROOM_URL") + key = args.apikey or os.getenv("DAILY_API_KEY") + + if not url: + raise Exception( + "No Daily room specified. use the -u/--url option from the command line, or set DAILY_SAMPLE_ROOM_URL in your environment to specify a Daily room URL.") + + if not key: + raise Exception("No Daily API key specified. use the -k/--apikey option from the command line, or set DAILY_API_KEY in your environment to specify a Daily API key, available from https://dashboard.daily.co/developers.") + + # Create a meeting token for the given room with an expiration 1 hour in + # the future. + room_name: str = urllib.parse.urlparse(url).path[1:] + expiration: float = time.time() + 60 * 60 + + res: requests.Response = requests.post( + f"https://api.daily.co/v1/meeting-tokens", + headers={ + "Authorization": f"Bearer {key}"}, + json={ + "properties": { + "room_name": room_name, + "is_owner": True, + "exp": expiration}}, + ) + + if res.status_code != 200: + raise Exception( + f"Failed to create meeting token: {res.status_code} {res.text}") + + token: str = res.json()["token"] + + return (url, token) diff --git a/examples/starter-apps/storybot.py b/examples/starter-apps/storybot.py index e529ef3d4..681ece607 100644 --- a/examples/starter-apps/storybot.py +++ b/examples/starter-apps/storybot.py @@ -25,7 +25,6 @@ UserResponseAggregator, LLMResponseAggregator, ) -from examples.support.runner import configure from dailyai.pipeline.frames import ( EndPipeFrame, LLMMessagesQueueFrame, @@ -43,6 +42,11 @@ ) from dailyai.services.ai_services import FrameLogger, AIService +from runner import configure + +from dotenv import load_dotenv +load_dotenv() + logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai") logger.setLevel(logging.DEBUG) diff --git a/examples/starter-apps/translator.py b/examples/starter-apps/translator.py index 9b8c6410f..7274b3209 100644 --- a/examples/starter-apps/translator.py +++ b/examples/starter-apps/translator.py @@ -18,7 +18,11 @@ from dailyai.services.azure_ai_services import AzureTTSService from dailyai.services.open_ai_services import OpenAILLMService from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService -from examples.support.runner import configure + +from runner import configure + +from dotenv import load_dotenv +load_dotenv() logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s") logger = logging.getLogger("dailyai")