Skip to content

iaalm/xraygpt

Repository files navigation

🔬📖 X-ray GPT

PyPI version Release Building CodeQL Code style: black

Generate kindle-like X-ray for e-books with LLM

🚀 Usage

pip install xraygpt
python -m xraygpt [epub_file]

🤖 LLM Support

Current this tool only support OpenAI (or compatible API like DeepSeek, Kimi, etc.) and Azure OpenAI by setting environment variables.

You can config following environment variables to use different LLM service:

  • OPENAI_API_BASE: OpenAI API or other compatible API base URL
  • OPENAI_API_KEY: OpenAI API key
  • OPENAI_API_VERSION: OpenAI API version
  • AZURE_OPENAI_ENDPOINT: Use Azure OpenAI endpoint instead of standard OpenAI

Model name can be set by command line argument --chat_model and --embedding_model.

📚 E-book Support

Currently only support .epub format. Output format is a .json file as WordDumb style. You can import this file manualy via Calibre. First select the book and click "Open book Folder". Then create/replace worddumb-custom-x-ray.json with the generated json file.

Generating X-Ray DB file is in progress.

🧑‍💻 Dev Setup

pip install -e '.[dev]'

🎩 Static analysis

make format