Skip to content

SchulteDev/ConversationalAI4J

Repository files navigation

ConversationalAI4J

Java Spring Boot Gradle Conventional Commits Quality Gate Status Test

A Java library for voice-enabled conversational AI. Speak to an LLM through your browser and get intelligent spoken responses.

Status

Project Status

This project is in early alpha stage. Features are functional but may contain bugs and APIs may change.

This project was vibe coded, serving as a PoC for PhoneBlock -> "Enhance PhoneBlock-AB with Local AI for Intelligent Scam Call Conversations"

Project Status

Quick Start

git clone https://github.com/SchulteDev/ConversationalAI4J.git
cd ConversationalAI4J

# Complete voice AI system
# First start NEEDS A FEW MINUTES to download the models
docker-compose up --build
# → http://localhost:8080

Library Usage

// Text chat
ConversationalAI ai = ConversationalAI.builder()
    .withOllamaModel("llama3.2:3b")
    .build();
String response = ai.chat("Hello!");

// Voice chat
ConversationalAI voiceAI = ConversationalAI.builder()
  .withOllamaModel("llama3.2:3b")
  .withSpeech()
  .build();
byte[] audioResponse = voiceAI.voiceChat(audioBytes);

Voice Demo

  1. Click microphone button to start recording
  2. Speak your message
  3. Click microphone again to stop and send
  4. AI responds with both text and synthesized speech

Pipeline: Browser Audio → FFmpeg Decoding → Whisper.cpp → Ollama → Piper TTS

Browser Compatibility: Works with modern browsers (Chrome, Firefox, Safari) using MediaRecorder API. Supports WebM/Opus and WAV formats with server-side FFmpeg decoding.

Configuration

Variable Default Purpose
OLLAMA_BASE_URL http://localhost:11434 Ollama server
SPEECH_ENABLED false Enable voice features
WHISPER_MODEL_PATH /app/models/whisper/ggml-base.en.bin Whisper STT model path
PIPER_MODEL_PATH /app/models/piper/en_US-amy-medium.onnx Piper TTS model path
PIPER_CONFIG_PATH /app/models/piper/en_US-amy-medium.onnx.json Piper TTS config path

See CONTRIBUTING.md for development setup and ARCHITECTURE.md for technical details.

About

Java library for conversational AI running locally

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •