voice-agent-core


Namevoice-agent-core JSON
Version 1.2.2 PyPI version JSON
download
home_pageNone
SummaryA conversational voice companion bot framework for Python. Plug in any LLM and voice tools to create your own assistant.
upload_time2025-10-09 05:34:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) [2025] [Darshan BR] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords voice assistant llm ai companion bot speech recognition text to speech
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Voice Agent Core

A flexible, conversational voice companion bot framework for Python. Easily build your own AI assistant by plugging in any LLM (OpenAI, Gemini, etc.) and using built-in voice tools. Great for personal productivity, home automation, or just having a friendly AI to talk to!

## Features
- **Conversational AI:** Integrate any LLM (OpenAI, Gemini, etc.) for smart, natural conversations.
- **Speech Recognition:** Uses Whisper and SpeechRecognition for accurate voice input.
- **Text-to-Speech:** Responds with high-quality voice using TTS APIs and local fallback.
- **Extensible Tools:** Add your own Python functions as tools (play music, check weather, control apps, etc.).
- **Easy API:** Just provide an LLM handler and start your bot!

## Requirements
- Python 3.8+
- System dependencies for audio:
  - **Linux:** `sudo apt-get install portaudio19-dev ffmpeg`
  - **macOS:** `brew install portaudio ffmpeg`
  - **Windows:** Install [FFmpeg](https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/) and ensure it's in your PATH.

## Installation
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install voice-agent-core
```

## Quick Start: Your Own Companion Bot
Create a Python file (e.g., `my_bot.py`):
```python
from voice_agent_core import VoiceCompanionBot
import datetime

def my_llm_handler(text):
    if "date" in text or "time" in text:
        now = datetime.datetime.now()
        return {"type": "text_response", "content": f"The current date and time is: {now}"}
    else:
        return {"type": "text_response", "content": "I am your companion bot! You said: " + text}

bot = VoiceCompanionBot(llm_handler=my_llm_handler)
bot.listen_and_respond()
```
Run it:
```bash
python my_bot.py
```
Speak to your bot! It will respond with the date/time or echo your message.

## Advanced: Use Any LLM (OpenAI Example)
```python
from voice_agent_core import VoiceCompanionBot
import openai

def openai_llm_handler(text):
    response = openai.ChatCompletion.create(
        model="gpt-4",
        messages=[{"role": "system", "content": "You are a helpful, friendly voice companion."},
                  {"role": "user", "content": text}]
    )
    return {"type": "text_response", "content": response.choices[0].message['content']}

bot = VoiceCompanionBot(llm_handler=openai_llm_handler)
bot.listen_and_respond()
```

## Adding Custom Tools
You can add your own Python functions as tools. For example:
```python
def get_weather(location):
    # Your weather API logic here
    return f"Weather in {location}: Sunny!"

tools = {"get_weather": get_weather}
bot = VoiceCompanionBot(llm_handler=my_llm_handler, tools=tools)
```
Your LLM handler should return:
```python
{"type": "function_call", "call": {"name": "get_weather", "args": {"location": "London"}}}
```
The bot will call your tool and speak the result.

## API Overview
- `VoiceCompanionBot(llm_handler, tools=None, speak_func=None, listen_func=None)`
  - `llm_handler(text)`: function that takes user speech and returns a dict:
    - `{ "type": "function_call", "call": {"name": ..., "args": {...}} }`
    - `{ "type": "text_response", "content": ... }`
  - `tools`: dict of tool name to function (optional)
  - `speak_func`: custom TTS function (optional)
  - `listen_func`: custom speech recognition function (optional)
- `bot.listen_and_respond()`: starts the main loop


## License
MIT

---
For more details, see the API reference and examples above. Enjoy building your own AI companion!



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "voice-agent-core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "voice assistant, LLM, AI, companion bot, speech recognition, text to speech",
    "author": null,
    "author_email": "Darshan <darshanbr081@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d9/51/ea72e7c53541fdc7aa20099245c7bed78ecd967f54aeb5c5abf81afd8ae1/voice_agent_core-1.2.2.tar.gz",
    "platform": null,
    "description": "# Voice Agent Core\n\nA flexible, conversational voice companion bot framework for Python. Easily build your own AI assistant by plugging in any LLM (OpenAI, Gemini, etc.) and using built-in voice tools. Great for personal productivity, home automation, or just having a friendly AI to talk to!\n\n## Features\n- **Conversational AI:** Integrate any LLM (OpenAI, Gemini, etc.) for smart, natural conversations.\n- **Speech Recognition:** Uses Whisper and SpeechRecognition for accurate voice input.\n- **Text-to-Speech:** Responds with high-quality voice using TTS APIs and local fallback.\n- **Extensible Tools:** Add your own Python functions as tools (play music, check weather, control apps, etc.).\n- **Easy API:** Just provide an LLM handler and start your bot!\n\n## Requirements\n- Python 3.8+\n- System dependencies for audio:\n  - **Linux:** `sudo apt-get install portaudio19-dev ffmpeg`\n  - **macOS:** `brew install portaudio ffmpeg`\n  - **Windows:** Install [FFmpeg](https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/) and ensure it's in your PATH.\n\n## Installation\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\npip install voice-agent-core\n```\n\n## Quick Start: Your Own Companion Bot\nCreate a Python file (e.g., `my_bot.py`):\n```python\nfrom voice_agent_core import VoiceCompanionBot\nimport datetime\n\ndef my_llm_handler(text):\n    if \"date\" in text or \"time\" in text:\n        now = datetime.datetime.now()\n        return {\"type\": \"text_response\", \"content\": f\"The current date and time is: {now}\"}\n    else:\n        return {\"type\": \"text_response\", \"content\": \"I am your companion bot! You said: \" + text}\n\nbot = VoiceCompanionBot(llm_handler=my_llm_handler)\nbot.listen_and_respond()\n```\nRun it:\n```bash\npython my_bot.py\n```\nSpeak to your bot! It will respond with the date/time or echo your message.\n\n## Advanced: Use Any LLM (OpenAI Example)\n```python\nfrom voice_agent_core import VoiceCompanionBot\nimport openai\n\ndef openai_llm_handler(text):\n    response = openai.ChatCompletion.create(\n        model=\"gpt-4\",\n        messages=[{\"role\": \"system\", \"content\": \"You are a helpful, friendly voice companion.\"},\n                  {\"role\": \"user\", \"content\": text}]\n    )\n    return {\"type\": \"text_response\", \"content\": response.choices[0].message['content']}\n\nbot = VoiceCompanionBot(llm_handler=openai_llm_handler)\nbot.listen_and_respond()\n```\n\n## Adding Custom Tools\nYou can add your own Python functions as tools. For example:\n```python\ndef get_weather(location):\n    # Your weather API logic here\n    return f\"Weather in {location}: Sunny!\"\n\ntools = {\"get_weather\": get_weather}\nbot = VoiceCompanionBot(llm_handler=my_llm_handler, tools=tools)\n```\nYour LLM handler should return:\n```python\n{\"type\": \"function_call\", \"call\": {\"name\": \"get_weather\", \"args\": {\"location\": \"London\"}}}\n```\nThe bot will call your tool and speak the result.\n\n## API Overview\n- `VoiceCompanionBot(llm_handler, tools=None, speak_func=None, listen_func=None)`\n  - `llm_handler(text)`: function that takes user speech and returns a dict:\n    - `{ \"type\": \"function_call\", \"call\": {\"name\": ..., \"args\": {...}} }`\n    - `{ \"type\": \"text_response\", \"content\": ... }`\n  - `tools`: dict of tool name to function (optional)\n  - `speak_func`: custom TTS function (optional)\n  - `listen_func`: custom speech recognition function (optional)\n- `bot.listen_and_respond()`: starts the main loop\n\n\n## License\nMIT\n\n---\nFor more details, see the API reference and examples above. Enjoy building your own AI companion!\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) [2025] [Darshan BR]\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "A conversational voice companion bot framework for Python. Plug in any LLM and voice tools to create your own assistant.",
    "version": "1.2.2",
    "project_urls": {
        "BugTracker": "https://github.com/Darshan0312/Voice_agent/issues",
        "Homepage": "https://github.com/Darshan0312/Voice_Agent"
    },
    "split_keywords": [
        "voice assistant",
        " llm",
        " ai",
        " companion bot",
        " speech recognition",
        " text to speech"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c5004d0feebbd2e4d3f80ef916f406fe8c9bbbdd235f760391e243035a7788f6",
                "md5": "a2f0d3edf6d05407b043482764e921d1",
                "sha256": "862042a56e4e3db75933442d81d3c16de2584444f4ae8789832ca569bfea8b19"
            },
            "downloads": -1,
            "filename": "voice_agent_core-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a2f0d3edf6d05407b043482764e921d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10658,
            "upload_time": "2025-10-09T05:34:01",
            "upload_time_iso_8601": "2025-10-09T05:34:01.232277Z",
            "url": "https://files.pythonhosted.org/packages/c5/00/4d0feebbd2e4d3f80ef916f406fe8c9bbbdd235f760391e243035a7788f6/voice_agent_core-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d951ea72e7c53541fdc7aa20099245c7bed78ecd967f54aeb5c5abf81afd8ae1",
                "md5": "1476de739099c7d7bea135eeac88608e",
                "sha256": "5a1d72d02f0ea48acd39e4be30325e8855d6d841c718e8e0c0877faafbc38fcf"
            },
            "downloads": -1,
            "filename": "voice_agent_core-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1476de739099c7d7bea135eeac88608e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10473,
            "upload_time": "2025-10-09T05:34:04",
            "upload_time_iso_8601": "2025-10-09T05:34:04.798973Z",
            "url": "https://files.pythonhosted.org/packages/d9/51/ea72e7c53541fdc7aa20099245c7bed78ecd967f54aeb5c5abf81afd8ae1/voice_agent_core-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-09 05:34:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Darshan0312",
    "github_project": "Voice_agent",
    "github_not_found": true,
    "lcname": "voice-agent-core"
}
        
Elapsed time: 0.62188s