8000 GitHub - HarleyCoops/always-on-ai-assistant: A pattern for an always on AI Assistant powered by Deepseek-V3, RealtimeSTT, and Typer for engineering
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A pattern for an always on AI Assistant powered by Deepseek-V3, RealtimeSTT, and Typer for engineering

Notifications You must be signed in to change notification settings

HarleyCoops/always-on-ai-assistant

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"Always-On" Deepseek AI Assistant

A pattern for an always on AI Assistant powered by Deepseek-V3, RealtimeSTT, and Typer for engineering

Checkout the demo where we walk through using this always-on-ai-assistant.

ada-deepseek-v3.png

Setup

Option 1: Local Setup

  • cp .env.sample .env
    • Update with your keys DEEPSEEK_API_KEY and ELEVEN_API_KEY
  • uv sync
  • (optional) install python 3.11 (uv python install 3.11)

Option 2: Docker Setup (Recommended for Windows)

This Docker setup provides a consistent and isolated environment, which is especially useful for Windows users to avoid common encoding and audio issues.

Why Docker?

  • Environment Consistency: Docker containers ensure that the application runs the same way, regardless of the underlying operating system.
  • UTF-8 Encoding: The container uses UTF-8 encoding by default, resolving character encoding issues encountered on Windows.
  • Audio Support: Docker allows mapping the host's audio devices to the container, enabling seamless use of speech recognition and text-to-speech.
  • Isolation: Unlike virtual environments, Docker containers provide full isolation, including the file system, processes, and network. This prevents conflicts with system-wide packages and settings.

Setup Steps:

  1. Install Docker and Docker Compose:

    • Download and install Docker Desktop which includes both Docker Engine and Docker Compose.
  2. Copy and Update Environment Variables:

    cp .env.sample .env
    # Edit .env to add your DEEPSEEK_API_KEY and ELEVEN_API_KEY
  3. Build and Run the Container:

    docker-compose up --build

Key Changes for Windows Compatibility:

  • Base Image: Uses python:3.11-slim as the base image, providing a lightweight and consistent Python environment.
  • Encoding: Sets LANG and LC_ALL environment variables to C.UTF-8 to enforce UTF-8 encoding within the container.
  • Audio Device Mapping:
    • Maps the host's PulseAudio socket to the container, allowing the use of the host's audio system.
    • Uses host.docker.internal for PulseAudio server address, enabling communication between the container and the host's PulseAudio server.
    • Maps /dev/snd to allow access to audio devices.
  • Dependency Management:
    • Installs system dependencies including pulseaudio, alsa-utils, and portaudio19-dev for audio support.
    • Uses pip directly to install Python dependencies, as the container itself provides an isolated environment, eliminating the need for a separate virtual environment.
  • User Configuration:
    • Creates a non-root user (appuser) within the container for improved security.
  • Entrypoint:
    • Uses python main_typer_assistant.py as the entrypoint, directly invoking the Python script without a virtual environment.

Why No Virtual Environment Inside Docker?

Docker containers already provide an isolated environment similar to virtual environments. Using a virtual environment inside a container adds unnecessary overhead and complexity. The Dockerfile installs all dependencies directly into the container's system Python, ensuring a clean and efficient setup.

Commands

Base Assistant Chat Interface

See main_base_assistant.py for more details. Start a conversational chat session with the base assistant:

# Local
uv run python main_base_assistant.py chat

# Docker
docker-compose run assistant python main_base_assistant.py chat

Typer Assistant Conversational Commands

See main_typer_assistant.py, modules/typer_agent.py, and commands/template.py for more details.

  • --typer-file: file containing typer commands
  • --scratchpad: active memory for you and your assistant
  • --mode: determines what the assistant does with the command: ('default', 'execute', 'execute-no-scratch').
  1. Awaken the assistant
# Local
uv run python main_typer_assistant.py awaken --typer-file commands/template.py --scratchpad scratchpad.md --mode execute

# Docker (this is the default command)
docker-compose up
  1. Speak to the assistant Try this: "Hello! Ada, ping the server wait for a response" (be sure to pronounce 'ada' clearly)

  2. See the command in the scratchpad Open scratchpad.md to see the command that was generated.

Assistant Architecture

See assistant_config.yml for more details.

Typer Assistant

See assistant_config.yml for more details.

  • 🧠 Brain: Deepseek V3
  • 📝 Job (Prompt(s)): prompts/typer-commands.xml
  • 💻 Active Memory (Dynamic Variables): scratchpad.txt
  • 👂 Ears (STT): RealtimeSTT
  • 🎤 Mouth (TTS): ElevenLabs

Base Assistant

See assistant_config.yml for more details.

  • 🧠 Brain: ollama:phi4
  • 📝 Job (Prompt(s)): None
  • 💻 Active Memory (Dynamic Variables): none
  • 👂 Ears (STT): RealtimeSTT
  • 🎤 Mouth (TTS): local

Resources

About

A pattern for an always on AI Assistant powered by Deepseek-V3, RealtimeSTT, and Typer for engineering

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.9%
  • Dockerfile 1.4%
  • Shell 0.7%
0