What it does The Books Plugin is a NestJS-based chatbot plugin that uses the Hugging Face API to provide intelligent book recommendations. It:

Takes user queries about books or reading preferences Uses a Tree of Thoughts (ToT) approach to analyze the request from multiple angles Provides structured book recommendations with titles, authors, and descriptions Explains the reasoning behind each recommendation

How we built it

Core Technology Stack:

NestJS framework for the plugin architecture TypeScript for type safety and better code organization Hugging Face's API with the flan-t5-large model Tree of Thoughts implementation for reasoning

Plugin Structure:

Base plugin class extending BaseBlockPlugin Settings configuration for API key management Multiple processing stages for thought generation and evaluation Error handling and response formatting

Challenges we ran into

Integration Issues:

Initially had type mismatches with the settings object Had to handle complex response cleaning from the LLM Needed to manage API timeouts and rate limits

Reasoning Quality:

Initial responses included unnecessary clarifying questions Had to carefully structure prompts to get direct recommendations Needed to balance between detailed responses and response time

Accomplishments that we're proud of

Successfully implemented Tree of Thoughts reasoning in a chatbot plugin Created a modular and maintainable codebase Developed a scoring system for evaluating recommendation approaches Built type-safe integration with the existing plugin system

What we learned

Importance of proper prompt engineering for LLMs How to implement Tree of Thoughts in a practical application Techniques for evaluating and scoring AI-generated thoughts Strategies for handling API responses and error cases

What's next for books plugin Potential future improvements:

Add support for multiple LLM models with model switching Implement caching for frequently requested recommendations Add user preference tracking for better personalization Expand evaluation criteria for thought scoring Add support for book series and related works Implement book availability checking through integration with book APIs Add collaborative filtering based on user feedback

Built With

Share this project:

Updates