Skip to content

bookmuse generates personalized reading lists based on user preferences and reading history.

Notifications You must be signed in to change notification settings

chigwell/bookmuse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

bookmuse

PyPI version License: MIT Downloads LinkedIn

A personalized reading list generator that creates tailored book recommendations based on user preferences and reading history.

Overview

bookmuse is a Python package designed to help users discover new books that match their interests. Users provide a text input describing their favorite genres, interests, or books they've enjoyed, and bookmuse produces a structured list of recommended books, including titles, authors, and brief descriptions. This tool streamlines the process of finding your next great read by delivering curated suggestions in a clear and consistent format.

Installation

Install the package via pip:

pip install bookmuse

Usage

from bookmuse import bookmuse

# Example user input describing preferences
user_input = "I'm interested in science fiction and fantasy, especially space operas and epic adventures."

# Using the default LLM (ChatLLM7)
recommendations = bookmuse(user_input)

# Using a custom LLM instance (e.g., OpenAI)
from langchain_openai import ChatOpenAI

llm = ChatOpenAI()
recommendations = bookmuse(user_input, llm=llm)

Parameters

  • user_input (str): The descriptive text of user preferences.
  • llm (BaseChatModel, optional): An instance of a language model. Defaults to ChatLLM7 from langchain_llm7.
  • api_key (str, optional): API key for the language model. If not provided, it attempts to use the LLM7_API_KEY environment variable or defaults to "None".

Details

The package uses ChatLLM7 from the langchain_llm7 library by default. Developers can pass their own language model instances compatible with the expected interface, such as:

from langchain_openai import ChatOpenAI
from bookmuse import bookmuse

llm = ChatOpenAI()
response = bookmuse(user_input, llm=llm)

or

from langchain_anthropic import ChatAnthropic
from bookmuse import bookmuse

llm = ChatAnthropic()
response = bookmuse(user_input, llm=llm)

or

from langchain_google_genai import ChatGoogleGenerativeAI
from bookmuse import bookmuse

llm = ChatGoogleGenerativeAI()
response = bookmuse(user_input, llm=llm)

Rate Limits

For most use cases, the default free-tier rate limits of LLM7 are sufficient. For higher rate limits, set your API key via the environment variable LLM7_API_KEY or pass it directly:

recommendations = bookmuse(user_input, api_key="your_api_key")

You can register for a free API key at https://token.llm7.io/.

Support & Issues

If you encounter any issues or have questions, please open an issue on the GitHub repository:
https://github.com/chigwell/bookmuse

Author

Eugene Evstafev
Email: hi@eugene.plus
GitHub: chigwell