An AI-powered writing assistant that combines the wisdom of Walt Whitman, the mysticism of Lon Milo DuQuette, and the wonder of Carl Sagan.
Walt Bot is a sophisticated FastAPI application featuring agentic RAG (Retrieval-Augmented Generation) with LangGraph, vector similarity search, and Named Entity Recognition to help writers organize, search, and draw insights from their creative work.
- Agentic Routing: Automatically routes queries to the appropriate knowledge base (passage archives, freewriting, or general chat)
- Context-Aware Responses: Retrieves relevant context from vector stores before generating responses
- Conversational Memory: Maintains conversation history for coherent multi-turn dialogues
- Dual Collection System: Separate vector stores for structured passages and freewriting
- Semantic Search: ChromaDB-powered similarity search with Ollama embeddings
- Smart Text Chunking: Automatic text splitting with configurable overlap for optimal retrieval
- Raw Text Ingestion: Direct upload of freewriting with automatic chunking and hashing
- Entity Extraction: Identifies people, organizations, locations, and dates using BERT-based NER
- NER-Powered Search: Query your writing based on extracted entities
- Entity Aggregation: Consolidated view of all entities found in retrieved passages
- Hierarchical Organization: Journals contain multiple passages
- CRUD Operations: Full create, read, update, delete functionality
- Timestamp Tracking: Automatic creation and update timestamps
- In-Memory Database: Fast, lightweight storage (easily adaptable to PostgreSQL/SQLite)
- Visual State Machines: Graph-based workflows for complex AI operations
- Conditional Routing: Dynamic path selection based on query content
- State Persistence: MemorySaver checkpointing for stateful conversations
- Modular Node Architecture: Reusable, composable processing nodes
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Server โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Routers โ
โ โโโ /journals - Journal CRUD operations โ
โ โโโ /passages - Passage CRUD operations โ
โ โโโ /vector-ops - Vector DB operations + NER โ
โ โโโ /langgraph - Agentic chat endpoint โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ LangGraph โ โ Vector DB โ โ NER Pipeline โ
โ Services โ โ Service โ โ (Transformers) โ
โโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโโค
โ โข Main graph โโโโโถโ โข ChromaDB โ โ โข BERT NER Model โ
โ โข NER graph โ โ โข Embeddings โ โ โข Entity Extract โ
โ โข Text graph โ โ โข Collectionsโ โ โข Aggregation โ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Ollama (Local) โ
โโโโโโโโโโโโโโโโโโโค
โ โข Mistral LLM โ
โ โข Nomic Embed โ
โโโโโโโโโโโโโโโโโโโ
User Query
โ
โผ
โโโโโโโโโโโโโโโ
โ Route Node โโโโฌโโ[passages]โโโโถ Extract Passages โโโ
โโโโโโโโโโโโโโโ โ โ
โโโ[freewriting]โโถ Extract Text โโโโโโโค
โ โ
โโโ[chat]โโโโโโโโโถ General Chat โ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโ
โ Answer Generation โ
โ with Context โ
โโโโโโโโโโโโโโโโโโโโโ
โ
โผ
Response
- Python 3.11+ (3.13 recommended)
- Ollama installed and running locally
- 4GB+ RAM recommended
-
Clone the repository
git clone https://github.com/yourusername/walt-bot.git cd walt-bot -
Install Ollama models
ollama pull mistral ollama pull nomic-embed-text
-
Install dependencies
pip install -r requirements.txt
-
Run the server
uvicorn app.main:app --reload --port 8080
-
Access the API
- API: http://127.0.0.1:8080
- Interactive Docs: http://127.0.0.1:8080/docs
- Alternative Docs: http://127.0.0.1:8080/redoc
POST /langgraph/chat
Intelligent routing-based chat with automatic context retrieval.
{
"input": "What did I write about in my dream journal?"
}Response:
{
"route": "passages",
"answer": "In your dream journal, you explored...",
"sources": [...],
"message_memory": [...]
}POST /vector-ops/ingest-text
Content-Type: multipart/form-data
curl -X POST "http://127.0.0.1:8080/vector-ops/ingest-text" \
-F "text=Your freewriting content here..."POST /vector-ops/ingest-json
[
{
"id": "passage_001",
"text": "The cosmos is within us...",
"metadata": {
"author": "Carl Sagan",
"source": "Cosmos"
}
}
]POST /vector-ops/search-text
{
"query": "What did I write about the stars?",
"k": 5
}POST /vector-ops/ner-search-text
Extract entities from relevant passages and answer based on them.
{
"query": "Who are the people I mentioned?",
"k": 10
}Response:
{
"answer": "Based on the entities found...",
"entities": {
"PERSON": ["Walt Whitman", "Carl Sagan"],
"ORG": ["NASA"],
"LOC": ["New York"],
"DATE": ["2026"],
"OTHER": []
},
"query": "Who are the people I mentioned?"
}POST /journals/
{
"id": 1,
"title": "My Creative Writing",
"created_at": "2026-01-15T10:30:00"
}POST /passages/journals/{journal_id}/new_passage
{
"id": 1,
"journal_id": 1,
"title": "Midnight Thoughts",
"content": "The stars whispered secrets...",
"created_at": "2026-01-15T23:45:00"
}GET /passages/journals/{journal_id}/passages/
Create a .env file (optional):
OLLAMA_BASE_URL=http://localhost:11434
CHROMA_PERSIST_DIR=app/chroma_storeEdit langgraph_service.py or vector_langgraph_service.py:
llm = ChatOllama(
model="mistral", # Change model here
temperature=0.2 # Adjust creativity (0.0 - 1.0)
)Two collections are used:
passage_archive- Structured passages from journalsfreewriting- Raw text chunks from freewriting uploads
walt-bot/
โโโ app/
โ โโโ main.py # FastAPI application
โ โโโ models/
โ โ โโโ journal_model.py # Journal Pydantic model
โ โ โโโ passage_model.py # Passage Pydantic model
โ โโโ routers/
โ โ โโโ journals.py # Journal CRUD endpoints
โ โ โโโ passages.py # Passage CRUD endpoints
โ โ โโโ langgraph_ops.py # Agentic chat endpoint
โ โ โโโ vector_ops.py # Vector DB + NER endpoints
โ โโโ services/
โ โ โโโ langgraph_service.py # Main agentic graph
โ โ โโโ vector_langgraph_service.py # Vector-specific graphs
โ โ โโโ vectordb_service.py # ChromaDB + NER operations
โ โโโ chroma_store/ # Vector DB persistence
โโโ requirements.txt
โโโ README.md
Upload freewriting, then ask Walt Bot to help you identify themes, characters, or plot points.
# Upload your writing
curl -X POST "http://localhost:8080/vector-ops/ingest-text" \
-F "text@my_novel_draft.txt"
# Ask for insights
curl -X POST "http://localhost:8080/langgraph/chat" \
-H "Content-Type: application/json" \
-d '{"input": "What are the recurring themes in my writing?"}'Store research notes as passages and use semantic search to find connections.
import requests
# Ingest research notes
passages = [
{"id": "note_001", "text": "Quantum entanglement allows...", "metadata": {"topic": "physics"}},
{"id": "note_002", "text": "Poetic meter in Walt Whitman...", "metadata": {"topic": "poetry"}}
]
requests.post("http://localhost:8080/vector-ops/ingest-json", json=passages)
# Search across topics
response = requests.post(
"http://localhost:8080/vector-ops/search-text",
json={"query": "connections between physics and poetry", "k": 5}
)Find all mentions of specific people, places, or organizations.
response = requests.post(
"http://localhost:8080/vector-ops/ner-search-text",
json={"query": "Who are the scientists I've written about?", "k": 20}
)
print(response.json()["entities"]["PERSON"])- Routers: Handle HTTP requests/responses, minimal business logic
- Services: Core business logic, LangGraph workflows, DB operations
- Models: Pydantic models for data validation
-
Define node function in
langgraph_service.py:def my_new_node(state: GraphState) -> GraphState: # Process state return {"new_field": result}
-
Add to graph builder:
build.add_node("my_node", my_new_node) build.add_edge("previous_node", "my_node")
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain & LangGraph - For the amazing agentic AI framework
- Ollama - For making local LLMs accessible
- ChromaDB - For the vector database
- Hugging Face - For the transformers and NER models
- Walt Whitman, Carl Sagan, Lon Milo DuQuette - For inspiring the personality of Walt Bot
- Add unit tests, integration tests, and smoke tests
- Add support for document upload (PDF, DOCX)
- Implement user authentication and multi-user support
- Add conversation export functionality
- Support for additional LLM providers (Anthropic, OpenAI)
- Web UI for easier interaction
- PostgreSQL/SQLite backend option
- Batch processing for large document collections
- Fine-tuned embeddings for creative writing
- Graph visualization of entity relationships
Project Link: https://github.com/sciencefixion/AH_walt_bot
Built with โค๏ธ by writers, for writers