BookWyrm Client¶
A Python client library for the BookWyrm API, providing citation finding, text summarization, phrasal analysis, and PDF extraction capabilities.
Features¶
- Citation Finding: Find relevant citations for questions in text chunks
- Text Summarization: Hierarchical summarization with support for custom Pydantic models
- Phrasal Analysis: Extract phrases and chunks from text using NLP
- PDF Extraction: Extract structured text data from PDF files
- File Classification: Automatically detect file types and formats
- Streaming Support: Real-time progress updates for long-running operations
- Async Support: Full async/await support with
AsyncBookWyrmClient
Installation¶
Quick Start¶
from bookwyrm import BookWyrmClient
# Initialize client
client = BookWyrmClient(api_key="your-api-key")
# Find citations
from bookwyrm.models import TextSpan
chunks = [TextSpan(text="Your text here", start_char=0, end_char=14)]
citations = []
for stream_response in client.stream_citations(
chunks=chunks,
question="What is this about?"
):
if hasattr(stream_response, 'citation'):
citations.append(stream_response.citation)
elif hasattr(stream_response, 'total_citations'):
print(f"Found {stream_response.total_citations} citations")
Documentation¶
- Getting Started - Installation and basic usage
- Client Guide - Python client library tutorial with examples
- CLI Guide - Comprehensive CLI tutorial with examples
- Examples - Code examples for common use cases
- CLI Reference - Command-line interface documentation
- API Reference - Detailed API documentation
- Contributing - How to contribute to the project
API Key¶
Get your API key from https://api.bookwyrm.ai and set it as an environment variable:
Or pass it directly to the client: