Overview
- Product
- AI literary character simulation
- Contribution
- Hybrid retrieval and character behavior
- Stack
- React, Flask, PostgreSQL, ChromaDB
- Focus
- Source grounding and spoiler-aware dialogue
Problem
A character conversation needs a connection to the book.
A literary character interface brings together two constraints. Responses need relevant source material, and that material needs to respect how far the reader has progressed.
Lorely also explores how a character’s internal state can influence a conversation. Retrieval and character behavior therefore need to work together within the same application.
My contribution
I built retrieval around semantic and lexical signals.
I engineered a hybrid RAG pipeline combining semantic embeddings, lexical ranking and reciprocal rank fusion. The pipeline supports source-grounded conversations with spoiler boundaries.
I also implemented a psychological engine based on Dörner’s Psi theory. It models six cognitive parameters and five emotional states to adapt character behavior during dialogue.
Architecture
The interface, application state and retrieval each have a role.
The project uses React for the reading and conversation experience, Flask for application logic, PostgreSQL for relational data and ChromaDB for vector retrieval. Docker supports the development environment.
- React
- Reading and conversation interface
- Flask
- Conversation and character logic
- PostgreSQL
- Structured application data
- ChromaDB
- Embedding-based retrieval
Implementation
Retrieval and spoiler settings shape the conversation context.
Semantic retrieval and lexical ranking provide different relevance signals. Reciprocal rank fusion combines the ranked candidates, while chapter and spoiler controls constrain the material available to the conversation.
Character-state modeling adds another part of the interaction. Character selection, a spoiler boundary and conversation settings connect the interface to retrieval.
- Combine semantic and lexical relevance signals.
- Keep retrieved context within the reader’s spoiler boundary.
- Model cognitive and emotional state as part of character behavior.

Result
One project connects retrieval engineering with a character experience.
Lorely brings a React interface, a hybrid retrieval pipeline and a psychological engine into the same literary conversation platform. The work combines information retrieval with application and interaction design.
The portfolio pairs those engineering details with supplied product showcase artwork.

