-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Enhance Voice Agent with Multilingual, Vision Detection Support and CI Improvements #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c57dc4e
docs: update doc following refactory
chcavignx 28f4ab2
chore: Directories improvments, Update Build Configuration and Lintin…
chcavignx 50cb70b
feat: Implement Multilingual Voice Agent with LLM Integration and Enh…
chcavignx 6a7ab09
feat: Implement Offline LLM Integration for Voice Agent
chcavignx 6fcc3d3
feat: add camera support and libs to face and objetc recognition, tes…
chcavignx 057c2db
core: update comments for functions
chcavignx 9a144be
core: Update CI/CD Python, Refactor Codebase, and Adjust Test Coverage
chcavignx 0797ceb
core: Update CI Test Workflow
chcavignx fda32a2
core: Update CI Test Workflow
chcavignx f14e23e
core: fix model path for insightface detector
chcavignx 091b733
core: fix model insightface detector path for tests
chcavignx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # <type>(<scope>): <subject> | ||
| # | ||
| # <body> | ||
| # | ||
| # <footer> | ||
|
|
||
| # Type: feat, fix, docs, style, refactor, perf, test, chore, ci | ||
| # Scope: zone affectée (stt, vision, tts, etc.) | ||
| # Subject: description courte en minuscules | ||
| # Body: explication détaillée (optionnel) | ||
| # Footer: issues fermées (optionnel) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.11 | ||
| 3.13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # English responses configuration for the voice agent | ||
| responses: | ||
| # Exit/Stop commands are placed first to take precedence | ||
| - keywords: ["stop", "exit", "quit"] | ||
| type: "text" | ||
| value: "Goodbye! Returning to wake word detection." | ||
| exit: true | ||
| - keywords: ["bye_bye", "bye"] | ||
| type: "text" | ||
| value: "See you later! Going back to sleep mode." | ||
| exit: true | ||
| - keywords: ["hello", "hi"] | ||
| type: "text" | ||
| value: "Hello! I'm {wake_word}, your AI assistant. How can I help you?" | ||
| - keywords: ["time"] | ||
| type: "action" | ||
| value: "get_time" | ||
| - keywords: ["date"] | ||
| type: "action" | ||
| value: "get_date" | ||
| - keywords: ["lights"] | ||
| type: "action" | ||
| value: "control_lights" | ||
| - keywords: ["music"] | ||
| type: "action" | ||
| value: "play_music" | ||
| - keywords: ["help"] | ||
| type: "text" | ||
| value: "I can respond to simple commands like hello, hi, time, date, lights, music, stop and bye-bye." | ||
| # Empty keywords acts as default / fallback | ||
| - keywords: [] | ||
| type: "llm" | ||
| value: "You said: {user_input}. I'm still learning how to respond to that." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # French responses configuration for the voice agent | ||
| responses: | ||
| # Les commandes d'arrêt sont placées en premier pour être prioritaires | ||
| - keywords: ["arrête", "arrete", "quitter", "stop"] | ||
| type: "text" | ||
| value: "Au revoir ! Retour à l'écoute du mot d'activation." | ||
| exit: true | ||
| - keywords: ["bye_bye", "bye", "salut", "a plus"] | ||
| type: "text" | ||
| value: "À plus tard ! Retour en mode veille." | ||
| exit: true | ||
| - keywords: ["bonjour"] | ||
| type: "text" | ||
| value: "Bonjour! Je suis {wake_word}, votre assistant IA. Comment puis-je vous aider ?" | ||
| - keywords: ["heure"] | ||
| type: "action" | ||
| value: "get_time" | ||
| - keywords: ["date"] | ||
| type: "action" | ||
| value: "get_date" | ||
| - keywords: ["lumière", "lumieres", "lumières"] | ||
| type: "action" | ||
| value: "control_lights" | ||
| - keywords: ["musique"] | ||
| type: "action" | ||
| value: "play_music" | ||
| - keywords: ["aide"] | ||
| type: "text" | ||
| value: "Je peux répondre à des commandes simples comme bonjour, heure, date, lumière, musique, et arrête." | ||
| # Empty keywords acts as default / fallback | ||
| - keywords: [] | ||
| type: "llm" | ||
| value: "Vous avez dit : {user_input}. Je suis encore en train d'apprendre comment répondre à cela." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Offline Large Language Model (LLM) | ||
|
|
||
| The goal is to enable the assistant to generate intelligent responses offline using local language models. | ||
| We have integrated a local LLM client in `src/llm/` that is designed to support both local Ollama and OpenAI-style APIs, configured centrally. | ||
|
|
||
| ## 1. Ollama | ||
|
|
||
| ### Description | ||
| Ollama is a lightweight, extensible framework for building and running language models locally. It provides a simple API and CLI to download, run, and manage models on your device, making it an excellent choice for offline setups on hardware like the Raspberry Pi. | ||
|
|
||
| ### Installation | ||
|
|
||
| 1. **Install Ollama**: | ||
| You can use the provided script or install it directly using the official curl command: | ||
|
|
||
| ```bash | ||
| curl -fsSL https://ollama.com/install.sh | sh | ||
| ``` | ||
| Alternatively, run our provided script: | ||
| ```bash | ||
| ./scripts/install/install_ollama.sh | ||
| ``` | ||
|
|
||
| 2. **Download Models**: | ||
| Once Ollama is installed, you need to pull the models you wish to use offline. For instance, `tinyllama` or `llama3.2:1b` are suitable for lightweight setups. | ||
| ```bash | ||
| ollama pull tinyllama | ||
| ``` | ||
| Alternatively, you can run the preloading script to load a set of default models: | ||
| ```bash | ||
| ./scripts/models/preload_ollama_models.sh | ||
| ``` | ||
|
|
||
| ## 2. LLM Client Library | ||
|
|
||
| The LLM response generation logic is structured as a generic client package in `src/llm/`. | ||
|
|
||
| ### Configuration Layer | ||
|
|
||
| Configuration is managed via `src/utils/config.py` and `config.yaml`. The LLM configuration block includes: | ||
| - `api_type`: Configures the LLM provider (e.g., `ollama` or `openai`). | ||
| - `url`: The endpoint URL (e.g., `http://localhost:11434/api/generate` for Ollama). | ||
| - `model`: The name of the model to use (e.g., `tinyllama`). | ||
| - `api_key`: API key if using a cloud provider (can be null for local Ollama). | ||
| - `timeout`: Request timeout in seconds. | ||
|
|
||
| ### Voice Agent Integration | ||
|
|
||
| The offline voice agent (`examples/VAD/voice_agent_offline.py`) has been updated to use this client library: | ||
| - Added a `ResponsesConfig` configuration block to handle response rules. | ||
| - The agent includes a `use_llm` toggle. If enabled, the agent attempts to generate a response via the LLM API. | ||
| - Support is provided for formatting payloads and forwarding custom overrides when using Ollama. | ||
| - If the LLM generation fails or times out, it gracefully falls back to basic intent matching or a fallback template. | ||
|
|
||
| ### Testing and Examples | ||
|
|
||
| - **Tests**: The `tests/llm/` and `tests/audio/` directories contain unit and integration tests covering Ollama responses, OpenAI completions, headers, timeout settings, request exceptions, and non-200 responses. | ||
| - **Example Script**: A standalone example is provided at `examples/llm/llm_example.py` for end-to-end testing of the LLM library manually using custom prompts or overriding configurations. | ||
|
|
||
| ```bash | ||
| python examples/llm/llm_example.py --prompt "What is the capital of France?" --api-type ollama --model tinyllama | ||
| ``` | ||
|
|
||
| ## 3. HuggingFace Transformers (Alternative) | ||
|
|
||
| An alternative integration for a local LLM involves using HuggingFace Transformers directly. | ||
|
|
||
| **Changes required for Transformers integration:** | ||
| - Update `llm_model_name`, `llm_device` (e.g. `cpu`), and `llm_torch_dtype` in the configuration. | ||
| - Load the model and tokenizer manually. | ||
| - Note: This method is significantly more resource-intensive on the Raspberry Pi compared to Ollama. | ||
|
|
||
| **Manual Verification:** | ||
| ```bash | ||
| pip install torch transformers accelerate | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Vision postprocess key mismatch
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools