Book discovery with conversational memory
Summary
A 2023 assistant for a bookstore.
Readers needed help finding books through conversation, with preferences carried across interactions.
An assistant using book-content retrieval, hierarchical summaries and stored conversation summaries, served through a serverless backend.
Tech Stack
- Python
- LangChain
- Pinecone
- OpenAI API
- AWS Lambda
Project workstreams
- 01
2 Weeks
Solution Architecture Design
Solution ArchitectDRL's Knowledge AI Agent Default Deployment
Dev Ops - 02
4 Weeks
Data Integration Pipelines Development
Data Engineer,Dev OpsData Cleaning & Preprocessing
2x NLP Engineers - 03
3 Weeks
Agent Case-Specific Customization
System Engineer,Data Engineer,NLP EngineerVector Search Use-Cases Optimization
Data Engineer,NLP Engineer - 04
1 Week
Integration, Testing & Deployment
System Engineer, Data Engineer,NLP Engineer,Dev Ops
TECH CHALLENGE
-
Books, by their very nature, contain layered and multifaceted information. The challenge was to design a system that could understand and navigate this hierarchy, from high-level themes and plot summaries to intricate details like character motivations or specific events. The agent should be able to delve into any layer of a book's content based on the user's query.
-
Beyond just knowing the events of a book, the agent has to comprehend the personalities of the main characters. This means understanding their motivations, relationships, growth arcs, and how they react in various situations. Deep, nuanced knowledge is essential for answering questions about character traits or predicting hypothetical scenarios.
-
The agent is expected to understand individual books and draw comparisons between them. Whether grouping books by similar themes, comparing character arcs across different novels, or ranking events based on their significance, the system has to be adept at comparative literary analysis.
-
Users might ask the agent to rank books or characters based on criteria such as moral complexity, romance, or suspense. This required the agent's flexible understanding, allowing it to rank concepts based on varying user-defined criteria dynamically.
-
One of the most challenging aspects is ensuring the agent remembers past interactions. This 'memory' would allow it to provide contextually relevant recommendations, building on previous conversations. Implementing such continuity in a conversational agent, especially dealing with vast literary data, is a significant technical hurdle.
SOLUTION
-
Addressing the complex hierarchical knowledge challenge began with LangChain, a framework designed to prototype conversational agents rapidly. This allowed the team to quickly iterate and refine the agent's capabilities, ensuring it could navigate the intricate layers of book content, from overarching themes to minute details. We've used a couple of "map-reduce" techniques. Reduce being summarization that was relatively quickly adapted and iterated over with LangChain. Similarly, past conversation history is transformed into memories.
-
GPT-3.5 powered the core of the Conversational Agent's knowledge and response generation. Its expansive knowledge base was crucial for character personality derivation and comparative analysis. Meanwhile, the ada-002 algorithm created embeddings, enabling the agent to understand, compare, group, and dynamically rank literary concepts based on user-defined criteria.
-
Pinecone was employed to manage the vast literary data and ensure the agent could quickly and accurately retrieve relevant information. This vector database was instrumental in storing the hierarchical knowledge, providing the agent could seamlessly delve into any depth of a book's content.
- The API-based application used AWS serverless services for request handling and usage-based resource allocation.
Outcome
A conversational discovery workflow built with the retrieval and model tooling available in 2023.
Published
