edgevoiceai 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. edgevoiceai-0.1.1/LICENSE +22 -0
  2. edgevoiceai-0.1.1/PKG-INFO +271 -0
  3. edgevoiceai-0.1.1/README.md +227 -0
  4. edgevoiceai-0.1.1/edgevoiceai/__init__.py +105 -0
  5. edgevoiceai-0.1.1/edgevoiceai/agent.py +454 -0
  6. edgevoiceai-0.1.1/edgevoiceai/audio/__init__.py +20 -0
  7. edgevoiceai-0.1.1/edgevoiceai/audio/device.py +243 -0
  8. edgevoiceai-0.1.1/edgevoiceai/audio/media.py +122 -0
  9. edgevoiceai-0.1.1/edgevoiceai/audio/player.py +128 -0
  10. edgevoiceai-0.1.1/edgevoiceai/audio/stream.py +155 -0
  11. edgevoiceai-0.1.1/edgevoiceai/audio/vad.py +117 -0
  12. edgevoiceai-0.1.1/edgevoiceai/config.py +61 -0
  13. edgevoiceai-0.1.1/edgevoiceai/docs.py +110 -0
  14. edgevoiceai-0.1.1/edgevoiceai/guardrails/__init__.py +11 -0
  15. edgevoiceai-0.1.1/edgevoiceai/guardrails/farewell.py +106 -0
  16. edgevoiceai-0.1.1/edgevoiceai/guardrails/topic_guard.py +63 -0
  17. edgevoiceai-0.1.1/edgevoiceai/memory/__init__.py +19 -0
  18. edgevoiceai-0.1.1/edgevoiceai/memory/extractor.py +159 -0
  19. edgevoiceai-0.1.1/edgevoiceai/memory/message.py +59 -0
  20. edgevoiceai-0.1.1/edgevoiceai/memory/stores/__init__.py +13 -0
  21. edgevoiceai-0.1.1/edgevoiceai/memory/stores/base.py +89 -0
  22. edgevoiceai-0.1.1/edgevoiceai/memory/stores/memory.py +68 -0
  23. edgevoiceai-0.1.1/edgevoiceai/memory/stores/sqlite.py +213 -0
  24. edgevoiceai-0.1.1/edgevoiceai/notifications/__init__.py +15 -0
  25. edgevoiceai-0.1.1/edgevoiceai/notifications/whatsapp.py +460 -0
  26. edgevoiceai-0.1.1/edgevoiceai/protocol/__init__.py +15 -0
  27. edgevoiceai-0.1.1/edgevoiceai/protocol/gemini.py +162 -0
  28. edgevoiceai-0.1.1/edgevoiceai/rag/__init__.py +24 -0
  29. edgevoiceai-0.1.1/edgevoiceai/rag/chunk.py +48 -0
  30. edgevoiceai-0.1.1/edgevoiceai/rag/embeddings/__init__.py +11 -0
  31. edgevoiceai-0.1.1/edgevoiceai/rag/embeddings/base.py +35 -0
  32. edgevoiceai-0.1.1/edgevoiceai/rag/embeddings/gemini.py +186 -0
  33. edgevoiceai-0.1.1/edgevoiceai/rag/retriever.py +138 -0
  34. edgevoiceai-0.1.1/edgevoiceai/rag/stores/__init__.py +15 -0
  35. edgevoiceai-0.1.1/edgevoiceai/rag/stores/base.py +71 -0
  36. edgevoiceai-0.1.1/edgevoiceai/rag/stores/memory.py +209 -0
  37. edgevoiceai-0.1.1/edgevoiceai/rag/stores/pinecone.py +236 -0
  38. edgevoiceai-0.1.1/edgevoiceai/rag/stores/qdrant.py +261 -0
  39. edgevoiceai-0.1.1/edgevoiceai/tests/__init__.py +0 -0
  40. edgevoiceai-0.1.1/edgevoiceai/tests/test_core.py +196 -0
  41. edgevoiceai-0.1.1/edgevoiceai/tests/test_memory.py +199 -0
  42. edgevoiceai-0.1.1/edgevoiceai/tests/test_rag.py +206 -0
  43. edgevoiceai-0.1.1/edgevoiceai/tests/test_tools.py +194 -0
  44. edgevoiceai-0.1.1/edgevoiceai/tests/test_whatsapp.py +247 -0
  45. edgevoiceai-0.1.1/edgevoiceai/tools/__init__.py +18 -0
  46. edgevoiceai-0.1.1/edgevoiceai/tools/audio_tool.py +130 -0
  47. edgevoiceai-0.1.1/edgevoiceai/tools/base.py +110 -0
  48. edgevoiceai-0.1.1/edgevoiceai/tools/notification_tool.py +177 -0
  49. edgevoiceai-0.1.1/edgevoiceai/tools/rag_tool.py +167 -0
  50. edgevoiceai-0.1.1/edgevoiceai/tools/registry.py +109 -0
  51. edgevoiceai-0.1.1/edgevoiceai/tools/sensor_tool.py +89 -0
  52. edgevoiceai-0.1.1/edgevoiceai.egg-info/PKG-INFO +271 -0
  53. edgevoiceai-0.1.1/edgevoiceai.egg-info/SOURCES.txt +56 -0
  54. edgevoiceai-0.1.1/edgevoiceai.egg-info/dependency_links.txt +1 -0
  55. edgevoiceai-0.1.1/edgevoiceai.egg-info/requires.txt +23 -0
  56. edgevoiceai-0.1.1/edgevoiceai.egg-info/top_level.txt +1 -0
  57. edgevoiceai-0.1.1/pyproject.toml +80 -0
  58. edgevoiceai-0.1.1/setup.cfg +4 -0
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hasmukh Mer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: edgevoiceai
3
+ Version: 0.1.1
4
+ Summary: A modular, full-duplex conversational Voice AI framework for edge devices (Raspberry Pi) and laptops (macOS, Linux, Windows).
5
+ Author-email: Hasmukh Mer <mhgn0001@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/merhasmukh/edgevoiceai
8
+ Project-URL: Documentation, https://merhasmukh.github.io/edgevoiceai
9
+ Project-URL: Repository, https://github.com/merhasmukh/edgevoiceai.git
10
+ Project-URL: Issues, https://github.com/merhasmukh/edgevoiceai/issues
11
+ Keywords: voice-ai,realtime,full-duplex,gemini-live,raspberry-pi,barge-in,rag,edge-computing
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
21
+ Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: websockets>=12.0
26
+ Requires-Dist: pyaudio>=0.2.14
27
+ Requires-Dist: httpx>=0.27.0
28
+ Provides-Extra: qdrant
29
+ Requires-Dist: qdrant-client>=1.11.0; extra == "qdrant"
30
+ Provides-Extra: pinecone
31
+ Requires-Dist: pinecone>=5.0.0; extra == "pinecone"
32
+ Provides-Extra: media
33
+ Requires-Dist: pygame>=2.5.0; extra == "media"
34
+ Provides-Extra: docs
35
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
36
+ Requires-Dist: mkdocstrings[python]>=0.28.0; extra == "docs"
37
+ Provides-Extra: all
38
+ Requires-Dist: qdrant-client>=1.11.0; extra == "all"
39
+ Requires-Dist: pinecone>=5.0.0; extra == "all"
40
+ Requires-Dist: pygame>=2.5.0; extra == "all"
41
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "all"
42
+ Requires-Dist: mkdocstrings[python]>=0.28.0; extra == "all"
43
+ Dynamic: license-file
44
+
45
+ # EdgeVoiceAI
46
+
47
+ <p align="center">
48
+ <strong>A modular, full-duplex conversational voice AI framework for Python 3.10+</strong><br>
49
+ <em>Built for edge devices (Raspberry Pi, Linux) and laptops (macOS, Windows) powered by Google Gemini Live.</em>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="https://pypi.org/project/edgevoiceai/"><img src="https://img.shields.io/pypi/v/edgevoiceai.svg" alt="PyPI version"></a>
54
+ <a href="https://pypi.org/project/edgevoiceai/"><img src="https://img.shields.io/pypi/pyversions/edgevoiceai.svg" alt="Python Versions"></a>
55
+ <a href="https://github.com/merhasmukh/edgevoiceai/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
56
+ <a href="https://merhasmukh.github.io/edgevoiceai/"><img src="https://img.shields.io/badge/docs-MkDocs-teal.svg" alt="Documentation"></a>
57
+ </p>
58
+
59
+ ---
60
+
61
+ ## 🌟 Overview
62
+
63
+ **EdgeVoiceAI** is a developer-first Python library designed to build low-latency, full-duplex conversational voice assistants from scratch. It connects physical hardware microphones and speakers directly with Google Gemini's real-time bidirectional streaming API (`bidiGenerateContent`), enabling natural spoken interactions with instant turn-taking and conversational barge-in interruptions.
64
+
65
+ Unlike traditional voice wrappers that chain disjointed Speech-To-Text (STT) $\rightarrow$ LLM $\rightarrow$ Text-To-Speech (TTS) pipelines with noticeable latency, EdgeVoiceAI operates over a single, continuous, bidirectional audio WebSocket connection.
66
+
67
+ ---
68
+
69
+ ## 🏗️ Architecture
70
+
71
+ <p align="center">
72
+ <img src="https://raw.githubusercontent.com/merhasmukh/edgevoiceai/main/docs/assets/architecture.svg" alt="EdgeVoiceAI Architecture" width="100%">
73
+ </p>
74
+
75
+ ```text
76
+ +-----------------------------------------------------------------------+
77
+ | Client Device (macOS / Linux / Windows / Raspberry Pi) |
78
+ | |
79
+ | [🎙️ MicrophoneStream (16kHz Native Mono PCM)] |
80
+ | │ |
81
+ | ▼ |
82
+ | [⚡ VoiceActivityDetector (Energy Gating & Syllable Onset)] |
83
+ | │ |
84
+ | ▼ |
85
+ | [📤 WebSockets Client (realtimeInput audio frames)] |
86
+ | │ ▲ |
87
+ +────────────────┼──────────────────────────────────────┼───────────────+
88
+ │ │
89
+ │ 16kHz PCM Stream │
90
+ ▼ │
91
+ +───────────────────────────────────────────────────────┼───────────────+
92
+ | Google Gemini Live Service │ |
93
+ | (gemini-2.0-flash-exp / live) │ |
94
+ +───────────────────────────────────────────────────────┼───────────────+
95
+ │ │
96
+ │ 24kHz Streaming Audio & Tool Calls │
97
+ ▼ │
98
+ +────────────────┼──────────────────────────────────────┼───────────────+
99
+ | ▼ |
100
+ | [📥 WebSockets Receiver (serverContent)] |
101
+ | │ |
102
+ | ├─────────────────────────────┐ |
103
+ | ▼ ▼ |
104
+ | [🔊 AudioPlayer (24kHz PCM)] [🔧 Tool Dispatcher (ToolRegistry)] |
105
+ | • <50ms Instant Barge-In Cancel │ |
106
+ | • Acoustic Echo Suppression ▼ |
107
+ | [🧠 Memory & Vector Stores] |
108
+ | (SQLite / Qdrant / Pinecone) |
109
+ +-----------------------------------------------------------------------+
110
+ ```
111
+
112
+ ---
113
+
114
+ ## ✨ Key Features
115
+
116
+ - **⚡ Ultra-Low Latency & Instant Barge-In**: Real-time 16kHz continuous streaming. When you speak while the assistant responds, playback clears instantly (<50ms) to yield the floor naturally.
117
+ - **🧩 Self-Describing Tools with Prompt Composition**: Each tool declares its own JSON schema, execution callback, and prompt etiquette instructions (`prompt_instruction`). The framework automatically synthesizes these instructions into the agent's system prompt.
118
+ - **🎙️ Cross-Platform Audio Engine**: Powered by PortAudio with automatic hardware enumeration across macOS (CoreAudio), Linux / Raspberry Pi (ALSA/PulseAudio), and Windows (WASAPI/MME).
119
+ - **🔍 Plug-and-Play RAG Integration**: Built-in `RAGRetriever` with chunking and native vector store backends for `InMemoryVectorStore`, `QdrantVectorStore`, and `PineconeVectorStore`.
120
+ - **🛡️ Conversational Guardrails**: Turn-aware farewell detectors, topic safety guards, and entity memory management.
121
+ - **📲 Built-in Notification Tools**: Two-turn confirmation WhatsApp dispatch tool with phone number normalization.
122
+
123
+ ---
124
+
125
+ ## 📦 Installation
126
+
127
+ ### 1. Install System Audio Dependencies (PortAudio)
128
+
129
+ EdgeVoiceAI uses PortAudio for native, cross-platform audio streaming.
130
+
131
+ - **macOS**:
132
+ ```bash
133
+ brew install portaudio
134
+ ```
135
+ - **Linux / Raspberry Pi**:
136
+ ```bash
137
+ sudo apt-get update
138
+ sudo apt-get install -y portaudio19-dev libasound2-dev python3-pyaudio
139
+ ```
140
+ - **Windows**:
141
+ Pre-compiled wheels are included automatically via `pyaudio`.
142
+
143
+ ### 2. Install EdgeVoiceAI via pip
144
+
145
+ ```bash
146
+ # Core package
147
+ pip install edgevoiceai
148
+
149
+ # With specific optional extras
150
+ pip install "edgevoiceai[qdrant]" # Qdrant vector store support
151
+ pip install "edgevoiceai[pinecone]" # Pinecone vector store support
152
+ pip install "edgevoiceai[media]" # Pygame audio sound effects
153
+
154
+ # Or install all extras
155
+ pip install "edgevoiceai[all]"
156
+ ```
157
+
158
+ ---
159
+
160
+ ## 🚀 5-Minute Quickstart
161
+
162
+ ### 1. Set Your Gemini API Key
163
+
164
+ ```bash
165
+ export GEMINI_API_KEY="your-google-ai-studio-api-key"
166
+ ```
167
+
168
+ ### 2. Run a Full-Duplex Voice Assistant
169
+
170
+ ```python
171
+ import asyncio
172
+ import os
173
+ from edgevoiceai import (
174
+ BaseTool,
175
+ InMemoryMemoryStore,
176
+ ToolExecutionContext,
177
+ ToolRegistry,
178
+ ToolResult,
179
+ VoiceAgent,
180
+ VoiceConfig,
181
+ )
182
+
183
+
184
+ # Define a custom tool with prompt instructions
185
+ class BookAppointmentTool(BaseTool):
186
+ @property
187
+ def name(self) -> str:
188
+ return "book_appointment"
189
+
190
+ @property
191
+ def description(self) -> str:
192
+ return "Schedules a consultation appointment for the user."
193
+
194
+ @property
195
+ def parameters_schema(self) -> dict:
196
+ return {
197
+ "type": "object",
198
+ "properties": {
199
+ "name": {"type": "string", "description": "Customer name"},
200
+ "date": {"type": "string", "description": "Date of appointment (YYYY-MM-DD)"},
201
+ "time": {"type": "string", "description": "Time (e.g. 10:00 AM)"},
202
+ },
203
+ "required": ["name", "date", "time"],
204
+ }
205
+
206
+ @property
207
+ def prompt_instruction(self) -> str:
208
+ return (
209
+ "When scheduling, ask for the customer's name, desired date, and preferred time. "
210
+ "Always verbally confirm all details before executing book_appointment."
211
+ )
212
+
213
+ async def execute(self, params: dict, context: ToolExecutionContext) -> ToolResult:
214
+ name = params.get("name")
215
+ date = params.get("date")
216
+ time = params.get("time")
217
+ # In a real app, write to database or calendar API
218
+ return ToolResult(
219
+ success=True,
220
+ data={"status": "confirmed", "booking_id": "APT-1001"},
221
+ user_message=f"Appointment booked for {name} on {date} at {time}.",
222
+ )
223
+
224
+
225
+ async def main():
226
+ api_key = os.environ.get("GEMINI_API_KEY")
227
+ if not api_key:
228
+ raise ValueError("Please set the GEMINI_API_KEY environment variable.")
229
+
230
+ # Configure the voice session
231
+ config = VoiceConfig(
232
+ api_key=api_key,
233
+ voice_name="Puck", # Puck, Charon, Aoede, Fenrir, Kore
234
+ system_instruction=(
235
+ "You are a friendly, concise voice assistant. "
236
+ "Keep responses natural, conversational, and direct."
237
+ ),
238
+ )
239
+
240
+ # Register tools and memory
241
+ registry = ToolRegistry()
242
+ registry.register(BookAppointmentTool())
243
+ memory = InMemoryMemoryStore()
244
+
245
+ agent = VoiceAgent(config=config, tools=registry, memory_store=memory)
246
+
247
+ print("🎙️ Starting Voice Assistant... Speak into your microphone!")
248
+ try:
249
+ await agent.start()
250
+ except KeyboardInterrupt:
251
+ print("\nStopping...")
252
+ finally:
253
+ await agent.stop()
254
+
255
+
256
+ if __name__ == "__main__":
257
+ asyncio.run(main())
258
+ ```
259
+
260
+ ---
261
+
262
+ ## 📖 Documentation
263
+
264
+ Comprehensive documentation, tutorials, architecture deep-dives, and API references are available at:
265
+ **[https://merhasmukh.github.io/edgevoiceai/](https://merhasmukh.github.io/edgevoiceai/)**
266
+
267
+ ---
268
+
269
+ ## 📄 License
270
+
271
+ This project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,227 @@
1
+ # EdgeVoiceAI
2
+
3
+ <p align="center">
4
+ <strong>A modular, full-duplex conversational voice AI framework for Python 3.10+</strong><br>
5
+ <em>Built for edge devices (Raspberry Pi, Linux) and laptops (macOS, Windows) powered by Google Gemini Live.</em>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://pypi.org/project/edgevoiceai/"><img src="https://img.shields.io/pypi/v/edgevoiceai.svg" alt="PyPI version"></a>
10
+ <a href="https://pypi.org/project/edgevoiceai/"><img src="https://img.shields.io/pypi/pyversions/edgevoiceai.svg" alt="Python Versions"></a>
11
+ <a href="https://github.com/merhasmukh/edgevoiceai/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
12
+ <a href="https://merhasmukh.github.io/edgevoiceai/"><img src="https://img.shields.io/badge/docs-MkDocs-teal.svg" alt="Documentation"></a>
13
+ </p>
14
+
15
+ ---
16
+
17
+ ## 🌟 Overview
18
+
19
+ **EdgeVoiceAI** is a developer-first Python library designed to build low-latency, full-duplex conversational voice assistants from scratch. It connects physical hardware microphones and speakers directly with Google Gemini's real-time bidirectional streaming API (`bidiGenerateContent`), enabling natural spoken interactions with instant turn-taking and conversational barge-in interruptions.
20
+
21
+ Unlike traditional voice wrappers that chain disjointed Speech-To-Text (STT) $\rightarrow$ LLM $\rightarrow$ Text-To-Speech (TTS) pipelines with noticeable latency, EdgeVoiceAI operates over a single, continuous, bidirectional audio WebSocket connection.
22
+
23
+ ---
24
+
25
+ ## 🏗️ Architecture
26
+
27
+ <p align="center">
28
+ <img src="https://raw.githubusercontent.com/merhasmukh/edgevoiceai/main/docs/assets/architecture.svg" alt="EdgeVoiceAI Architecture" width="100%">
29
+ </p>
30
+
31
+ ```text
32
+ +-----------------------------------------------------------------------+
33
+ | Client Device (macOS / Linux / Windows / Raspberry Pi) |
34
+ | |
35
+ | [🎙️ MicrophoneStream (16kHz Native Mono PCM)] |
36
+ | │ |
37
+ | ▼ |
38
+ | [⚡ VoiceActivityDetector (Energy Gating & Syllable Onset)] |
39
+ | │ |
40
+ | ▼ |
41
+ | [📤 WebSockets Client (realtimeInput audio frames)] |
42
+ | │ ▲ |
43
+ +────────────────┼──────────────────────────────────────┼───────────────+
44
+ │ │
45
+ │ 16kHz PCM Stream │
46
+ ▼ │
47
+ +───────────────────────────────────────────────────────┼───────────────+
48
+ | Google Gemini Live Service │ |
49
+ | (gemini-2.0-flash-exp / live) │ |
50
+ +───────────────────────────────────────────────────────┼───────────────+
51
+ │ │
52
+ │ 24kHz Streaming Audio & Tool Calls │
53
+ ▼ │
54
+ +────────────────┼──────────────────────────────────────┼───────────────+
55
+ | ▼ |
56
+ | [📥 WebSockets Receiver (serverContent)] |
57
+ | │ |
58
+ | ├─────────────────────────────┐ |
59
+ | ▼ ▼ |
60
+ | [🔊 AudioPlayer (24kHz PCM)] [🔧 Tool Dispatcher (ToolRegistry)] |
61
+ | • <50ms Instant Barge-In Cancel │ |
62
+ | • Acoustic Echo Suppression ▼ |
63
+ | [🧠 Memory & Vector Stores] |
64
+ | (SQLite / Qdrant / Pinecone) |
65
+ +-----------------------------------------------------------------------+
66
+ ```
67
+
68
+ ---
69
+
70
+ ## ✨ Key Features
71
+
72
+ - **⚡ Ultra-Low Latency & Instant Barge-In**: Real-time 16kHz continuous streaming. When you speak while the assistant responds, playback clears instantly (<50ms) to yield the floor naturally.
73
+ - **🧩 Self-Describing Tools with Prompt Composition**: Each tool declares its own JSON schema, execution callback, and prompt etiquette instructions (`prompt_instruction`). The framework automatically synthesizes these instructions into the agent's system prompt.
74
+ - **🎙️ Cross-Platform Audio Engine**: Powered by PortAudio with automatic hardware enumeration across macOS (CoreAudio), Linux / Raspberry Pi (ALSA/PulseAudio), and Windows (WASAPI/MME).
75
+ - **🔍 Plug-and-Play RAG Integration**: Built-in `RAGRetriever` with chunking and native vector store backends for `InMemoryVectorStore`, `QdrantVectorStore`, and `PineconeVectorStore`.
76
+ - **🛡️ Conversational Guardrails**: Turn-aware farewell detectors, topic safety guards, and entity memory management.
77
+ - **📲 Built-in Notification Tools**: Two-turn confirmation WhatsApp dispatch tool with phone number normalization.
78
+
79
+ ---
80
+
81
+ ## 📦 Installation
82
+
83
+ ### 1. Install System Audio Dependencies (PortAudio)
84
+
85
+ EdgeVoiceAI uses PortAudio for native, cross-platform audio streaming.
86
+
87
+ - **macOS**:
88
+ ```bash
89
+ brew install portaudio
90
+ ```
91
+ - **Linux / Raspberry Pi**:
92
+ ```bash
93
+ sudo apt-get update
94
+ sudo apt-get install -y portaudio19-dev libasound2-dev python3-pyaudio
95
+ ```
96
+ - **Windows**:
97
+ Pre-compiled wheels are included automatically via `pyaudio`.
98
+
99
+ ### 2. Install EdgeVoiceAI via pip
100
+
101
+ ```bash
102
+ # Core package
103
+ pip install edgevoiceai
104
+
105
+ # With specific optional extras
106
+ pip install "edgevoiceai[qdrant]" # Qdrant vector store support
107
+ pip install "edgevoiceai[pinecone]" # Pinecone vector store support
108
+ pip install "edgevoiceai[media]" # Pygame audio sound effects
109
+
110
+ # Or install all extras
111
+ pip install "edgevoiceai[all]"
112
+ ```
113
+
114
+ ---
115
+
116
+ ## 🚀 5-Minute Quickstart
117
+
118
+ ### 1. Set Your Gemini API Key
119
+
120
+ ```bash
121
+ export GEMINI_API_KEY="your-google-ai-studio-api-key"
122
+ ```
123
+
124
+ ### 2. Run a Full-Duplex Voice Assistant
125
+
126
+ ```python
127
+ import asyncio
128
+ import os
129
+ from edgevoiceai import (
130
+ BaseTool,
131
+ InMemoryMemoryStore,
132
+ ToolExecutionContext,
133
+ ToolRegistry,
134
+ ToolResult,
135
+ VoiceAgent,
136
+ VoiceConfig,
137
+ )
138
+
139
+
140
+ # Define a custom tool with prompt instructions
141
+ class BookAppointmentTool(BaseTool):
142
+ @property
143
+ def name(self) -> str:
144
+ return "book_appointment"
145
+
146
+ @property
147
+ def description(self) -> str:
148
+ return "Schedules a consultation appointment for the user."
149
+
150
+ @property
151
+ def parameters_schema(self) -> dict:
152
+ return {
153
+ "type": "object",
154
+ "properties": {
155
+ "name": {"type": "string", "description": "Customer name"},
156
+ "date": {"type": "string", "description": "Date of appointment (YYYY-MM-DD)"},
157
+ "time": {"type": "string", "description": "Time (e.g. 10:00 AM)"},
158
+ },
159
+ "required": ["name", "date", "time"],
160
+ }
161
+
162
+ @property
163
+ def prompt_instruction(self) -> str:
164
+ return (
165
+ "When scheduling, ask for the customer's name, desired date, and preferred time. "
166
+ "Always verbally confirm all details before executing book_appointment."
167
+ )
168
+
169
+ async def execute(self, params: dict, context: ToolExecutionContext) -> ToolResult:
170
+ name = params.get("name")
171
+ date = params.get("date")
172
+ time = params.get("time")
173
+ # In a real app, write to database or calendar API
174
+ return ToolResult(
175
+ success=True,
176
+ data={"status": "confirmed", "booking_id": "APT-1001"},
177
+ user_message=f"Appointment booked for {name} on {date} at {time}.",
178
+ )
179
+
180
+
181
+ async def main():
182
+ api_key = os.environ.get("GEMINI_API_KEY")
183
+ if not api_key:
184
+ raise ValueError("Please set the GEMINI_API_KEY environment variable.")
185
+
186
+ # Configure the voice session
187
+ config = VoiceConfig(
188
+ api_key=api_key,
189
+ voice_name="Puck", # Puck, Charon, Aoede, Fenrir, Kore
190
+ system_instruction=(
191
+ "You are a friendly, concise voice assistant. "
192
+ "Keep responses natural, conversational, and direct."
193
+ ),
194
+ )
195
+
196
+ # Register tools and memory
197
+ registry = ToolRegistry()
198
+ registry.register(BookAppointmentTool())
199
+ memory = InMemoryMemoryStore()
200
+
201
+ agent = VoiceAgent(config=config, tools=registry, memory_store=memory)
202
+
203
+ print("🎙️ Starting Voice Assistant... Speak into your microphone!")
204
+ try:
205
+ await agent.start()
206
+ except KeyboardInterrupt:
207
+ print("\nStopping...")
208
+ finally:
209
+ await agent.stop()
210
+
211
+
212
+ if __name__ == "__main__":
213
+ asyncio.run(main())
214
+ ```
215
+
216
+ ---
217
+
218
+ ## 📖 Documentation
219
+
220
+ Comprehensive documentation, tutorials, architecture deep-dives, and API references are available at:
221
+ **[https://merhasmukh.github.io/edgevoiceai/](https://merhasmukh.github.io/edgevoiceai/)**
222
+
223
+ ---
224
+
225
+ ## 📄 License
226
+
227
+ This project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,105 @@
1
+ """
2
+ Voice AI Framework.
3
+ A modular, full-duplex conversational voice framework for edge devices and servers.
4
+ Supports Raspberry Pi, Linux, macOS, and Windows on Python 3.10+.
5
+ """
6
+
7
+ from edgevoiceai.agent import VoiceAgent
8
+ from edgevoiceai.audio.device import AudioDeviceManager, AudioDeviceInfo
9
+ from edgevoiceai.audio.media import MediaAudioPlayer
10
+ from edgevoiceai.audio.player import AudioPlayer
11
+ from edgevoiceai.audio.stream import MicrophoneStream
12
+ from edgevoiceai.audio.vad import VADConfig, VoiceActivityDetector, compute_rms
13
+ from edgevoiceai.config import VoiceConfig
14
+ from edgevoiceai.guardrails.farewell import FarewellDetector
15
+ from edgevoiceai.guardrails.topic_guard import TopicGuard
16
+ from edgevoiceai.memory.extractor import EntityExtractor
17
+ from edgevoiceai.memory.message import ChatMessage, ConversationSession
18
+ from edgevoiceai.memory.stores.base import BaseMemoryStore
19
+ from edgevoiceai.memory.stores.memory import InMemoryMemoryStore
20
+ from edgevoiceai.memory.stores.sqlite import SQLiteMemoryStore
21
+ from edgevoiceai.notifications.whatsapp import (
22
+ WhatsAppClient,
23
+ WhatsAppConfig,
24
+ WhatsAppNotificationTool,
25
+ )
26
+ from edgevoiceai.protocol.gemini import GeminiLiveProtocol, ParsedServerMessage
27
+ from edgevoiceai.rag.chunk import DocumentChunk
28
+ from edgevoiceai.rag.embeddings.base import BaseEmbeddingModel
29
+ from edgevoiceai.rag.embeddings.gemini import GeminiEmbeddings
30
+ from edgevoiceai.rag.retriever import RAGRetriever
31
+ from edgevoiceai.rag.stores.base import BaseVectorStore
32
+ from edgevoiceai.rag.stores.memory import InMemoryVectorStore
33
+ from edgevoiceai.rag.stores.pinecone import PineconeVectorStore
34
+ from edgevoiceai.rag.stores.qdrant import QdrantVectorStore
35
+ from edgevoiceai.tools.audio_tool import AudioPlaybackTool
36
+ from edgevoiceai.tools.base import BaseTool, ToolExecutionContext, ToolResult
37
+ from edgevoiceai.tools.notification_tool import (
38
+ TwoTurnConfirmationNotificationTool,
39
+ default_normalize_phone,
40
+ )
41
+ from edgevoiceai.docs import get_site_directory, mount_docs, serve_docs
42
+ from edgevoiceai.tools.rag_tool import KnowledgeBaseTool
43
+ from edgevoiceai.tools.registry import ToolRegistry
44
+ from edgevoiceai.tools.sensor_tool import SensorTelemetryTool
45
+
46
+ __version__ = "0.1.1"
47
+
48
+
49
+ __all__ = [
50
+ # Core Agent & Config
51
+ "VoiceAgent",
52
+ "VoiceConfig",
53
+ # Documentation & Mounting
54
+ "mount_docs",
55
+ "serve_docs",
56
+ "get_site_directory",
57
+ # Tools System
58
+ "BaseTool",
59
+ "ToolRegistry",
60
+ "ToolResult",
61
+ "ToolExecutionContext",
62
+ "KnowledgeBaseTool",
63
+ "AudioPlaybackTool",
64
+ "SensorTelemetryTool",
65
+ "TwoTurnConfirmationNotificationTool",
66
+ "default_normalize_phone",
67
+ # Notifications & WhatsApp
68
+ "WhatsAppConfig",
69
+ "WhatsAppClient",
70
+ "WhatsAppNotificationTool",
71
+
72
+ # Audio Subsystem
73
+ "AudioDeviceManager",
74
+ "AudioDeviceInfo",
75
+ "AudioPlayer",
76
+ "MediaAudioPlayer",
77
+ "MicrophoneStream",
78
+ "VoiceActivityDetector",
79
+ "VADConfig",
80
+ "compute_rms",
81
+ # Guardrails
82
+ "TopicGuard",
83
+ "FarewellDetector",
84
+ # Memory & Context
85
+ "ChatMessage",
86
+ "ConversationSession",
87
+ "BaseMemoryStore",
88
+ "InMemoryMemoryStore",
89
+ "SQLiteMemoryStore",
90
+ "EntityExtractor",
91
+ # Protocol
92
+ "GeminiLiveProtocol",
93
+ "ParsedServerMessage",
94
+ # RAG & Vector Stores
95
+ "DocumentChunk",
96
+ "BaseEmbeddingModel",
97
+ "GeminiEmbeddings",
98
+ "BaseVectorStore",
99
+ "InMemoryVectorStore",
100
+ "QdrantVectorStore",
101
+ "PineconeVectorStore",
102
+ "RAGRetriever",
103
+ ]
104
+
105
+