Download the PHP package nahid-hasan/ai-notes without Composer
On this page you can find all versions of the php package nahid-hasan/ai-notes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nahid-hasan/ai-notes
More information about nahid-hasan/ai-notes
Files in nahid-hasan/ai-notes
Package ai-notes
Short Description AI-powered voice notes with semantic search for Laravel
License
Informations about the package ai-notes
๐ง ollama-notes-laravel-package (ai-notes)
Turn your Laravel app into an AI-powered memory system.
Record a voice note or write text. Search it later using natural language โ not keywords. No OpenAI account needed. Runs 100% locally and free with Ollama + Whisper.
Features
- ๐๏ธ Voice notes โ upload audio, Whisper transcribes it automatically
- โ๏ธ Text notes โ store any text, summarized and embedded instantly
- ๐ Semantic search โ find notes by meaning, not just keywords (pgvector)
- ๐ค Ask questions โ RAG-powered Q&A across your entire note history
- โก Queue-first โ all AI processing runs async via Laravel queues
- ๐ Swappable drivers โ Ollama (free/local) or OpenAI (paid)
- ๐ณ Docker included โ full docker-compose setup out of the box
- ๐งช Fake provider โ test without any AI services running
Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^11.0 |
| PostgreSQL | ^14 + pgvector extension |
| Redis | Any |
For the free local AI stack (recommended): Docker is required to run Ollama and Whisper containers.
For OpenAI: just an API key, no Docker needed for AI services.
Installation
1. Install the package
2. Run the install command
This publishes the config file and migrations.
3. Run migrations
This creates the
ai_notestable and enables thepgvectorextension automatically.
Setup: Free Local Stack (Recommended)
This uses Ollama (summarization + embeddings) and Whisper (transcription) โ both running in Docker, zero cost, zero API keys.
Step 1 โ Add Docker services
Copy this into your docker-compose.yml:
For the complete docker-compose.yml with Whisper Dockerfile and Flask server, see Docker Setup below.
Step 2 โ Pull the AI models
First pull is ~2-4GB. After that, restarts are instant.
Step 3 โ Configure your .env
Step 4 โ Start the queue worker
That's it. You're running fully local AI.
Setup: OpenAI (Paid Alternative)
If you prefer OpenAI and already have an API key:
No Ollama or Whisper needed. Everything else works identically.
Note: When switching from Ollama (768 dims) to OpenAI (1536 dims), you need to re-run migrations with the correct dimension. Set
AI_NOTES_VECTOR_DIM=1536in.envbefore migrating.
Usage
Storing Notes
From audio (voice note):
From text:
Checking Processing Status
AI processing is async. Poll the status or use a webhook/event:
Searching Notes
How distance scores work:
| Distance | Meaning |
|---|---|
| 0.0 โ 0.3 | Highly relevant |
| 0.3 โ 0.5 | Related / probably useful |
| 0.5 โ 0.7 | Loosely related |
| 0.7 โ 1.0 | Not really related |
Asking Questions (RAG)
Working with the Model Directly
Complete API Reference
AINote::fromAudio(UploadedFile $file, ?int $userId = null): AINote
Upload an audio file. Queues transcription โ summarization โ embedding.
Returns the note immediately with status = "pending".
AINote::fromText(string $text, ?int $userId = null, ?string $title = null): AINote
Store a text note. Queues summarization โ embedding.
Returns the note immediately with status = "pending".
AINote::search(string $query, int $limit = 5, ?int $userId = null): Collection
Semantic search across all done notes. Returns an Eloquent Collection sorted by relevance. Each result includes a distance attribute.
AINote::ask(string $question, int $contextLimit = 3, ?int $userId = null): string
RAG-powered question answering. Finds the most relevant notes, builds context, and asks the AI to answer your question based on them. Returns a plain string answer.
Configuration
Publish and edit config/ai-notes.php:
Docker Setup
Full docker-compose.yml for a new project using this package:
docker/whisper/Dockerfile:
docker/whisper/server.py:
Testing
The package ships with a FakeAIProvider so your tests never hit real AI services:
Customise fake responses:
Custom AI Driver
Implement the AIProvider contract to use any AI provider:
Register it in a service provider:
Troubleshooting
SQLSTATE: type "vector" does not exist
You're using plain PostgreSQL without pgvector. Use the pgvector/pgvector:pg16 Docker image instead of postgres:16.
Notes stuck on pending status
Your queue worker isn't running. Start it:
Ollama returns empty embeddings
The model isn't pulled yet:
Whisper is slow on first request
Normal โ it loads the model into memory on first call (~10-15 seconds). Subsequent calls are fast.
distance is always high (>0.8) for all results
Your notes were embedded with a different model than your search query. If you switched from Ollama to OpenAI (or vice versa), re-process your notes:
Notes have status = failed
Check storage/logs/laravel.log for the error. Common causes: Ollama not running, Whisper unreachable, or audio file format not supported by Whisper.
Roadmap
- [ ] Livewire/Vue UI component
- [ ] Auto-tagging via AI
- [ ] Vector DB drivers (Pinecone, Weaviate, Qdrant)
- [ ] Realtime recording via browser MediaRecorder API
- [ ] Team/multi-tenant support
- [ ] Note export (PDF, Markdown)
- [ ] Scheduled note digests ("summarize my week")
Contributing
Contributions are welcome. Please:
- Fork the repo
- Create a feature branch:
git checkout -b feature/my-feature - Write tests for your changes
- Submit a PR against
main
License
The MIT License. See LICENSE for details.
All versions of ai-notes with dependencies
laravel/framework Version ^11.0 || ^12.0 || ^13.0
guzzlehttp/guzzle Version ^7.0