A simple RAG API - build a question and answer interface to your own content in minutes
Project description
Fraggle
The simplest RAG API for Python. Build a question and answer interface to your own content in minutes.
pip install fraggle
fraggle index
fraggle serve
curl -X POST http://localhost:8000/api/ask \
-H "Content-Type: application/json" \
-d '{"question": "What is Fraggle?"}'
Fraggle is the successor to my badly named microllama project, modernised with:
- Provider-agnostic LLM support via any-llm
- Modern LangChain (0.3+)
- Simple deployment and usage
Installation
pip install fraggle
Quick Start
- Prepare your content in a
source.jsonfile:
[
{
"content": "Fraggle is a RAG API for building Q&A interfaces.",
"title": "What is Fraggle",
"url": "https://example.com/docs"
},
{
"content": "You can use OpenAI or Anthropic models with Fraggle.",
"title": "Supported Models"
}
]
- Set your API key:
export OPENAI_API_KEY="your-key-here"
# or
export ANTHROPIC_API_KEY="your-key-here"
- Create an index of embeddings:
fraggle index
- Start the API server:
fraggle serve
- Query your content:
curl -X POST http://localhost:8000/api/ask \
-H "Content-Type: application/json" \
-d '{"question": "What is Fraggle?"}'
Configuration
Configure Fraggle with environment variables:
| Variable | Default | Description |
|---|---|---|
SOURCE_JSON_PATH |
source.json |
Path to your content JSON file |
INDEX_PATH |
faiss_index |
Path to store/load the FAISS index |
LLM_PROVIDER |
openai |
LLM provider: openai or anthropic |
LLM_MODEL |
gpt-4o-mini |
Model ID (e.g., gpt-4o, claude-3-5-sonnet-20241022) |
EMBEDDINGS_PROVIDER |
openai |
Embeddings provider |
EMBEDDINGS_MODEL |
text-embedding-3-small |
Embeddings model |
CHUNK_SIZE |
1000 |
Text chunk size for indexing |
CHUNK_OVERLAP |
100 |
Overlap between chunks |
K_CONTEXT_DOCS |
4 |
Number of documents to retrieve |
UVICORN_HOST |
0.0.0.0 |
Host to bind the server to |
UVICORN_PORT |
8000 |
Port to bind the server to |
Using Anthropic Claude
export ANTHROPIC_API_KEY="your-key-here"
export LLM_PROVIDER="anthropic"
export LLM_MODEL="claude-3-5-sonnet-20241022"
fraggle serve
CLI Commands
fraggle serve
Start the API server. Automatically serves the frontend at / if the frontend/ directory exists.
fraggle index
Create a FAISS index from your source documents.
Options:
--source: Path to source JSON file (default: source.json)--output: Path to save the index (default: faiss_index)
fraggle make-front-end
Generate a simple HTML frontend for your Q&A interface.
Options:
--output: Directory for frontend files (default: frontend)
fraggle make-dockerfile
Generate a Dockerfile for containerized deployment.
API Endpoints
POST /api/ask
Non-streaming question answering.
Request:
{
"question": "What is Fraggle?"
}
Response:
{
"answer": "Fraggle is a RAG API for building Q&A interfaces to your content."
}
POST /api/stream
Streaming question answering (Server-Sent Events).
Request:
{
"question": "What is Fraggle?"
}
Response: SSE stream of text chunks.
Deployment
Docker
fraggle make-dockerfile
docker build -t fraggle .
docker run -p 8000:8000 -e OPENAI_API_KEY=your-key fraggle
Pre-building the Index
For faster startup, create the index at build time by uncommenting the RUN fraggle index line in the Dockerfile.
Development
# Clone the repo
git clone https://github.com/tomdyson/fraggle.git
cd fraggle
# Install with uv
uv sync
# Run in development mode
uv run fraggle serve
Comparison with microllama
Fraggle improves on microllama by:
- Provider-agnostic: Use any LLM via any-llm
- Modern dependencies: LangChain 0.3+
- Better naming: Focus on RAG, not LLMs
- Same simple API and deployment story
License
MIT
Publishing a New Version
Fraggle uses GitHub Actions to automatically publish to PyPI when you push a version tag:
# 1. Update the version in pyproject.toml
# 2. Commit and tag the release
git add pyproject.toml
git commit -m "Bump version to 0.1.x"
git tag v0.1.x
git push && git push --tags
The GitHub Actions workflow will automatically build and publish to PyPI.
First-time setup: Configure PyPI Trusted Publishing at https://pypi.org/manage/account/publishing/ with:
- PyPI Project Name:
fraggle - Owner:
tomdyson - Repository:
fraggle - Workflow:
publish.yml - Environment:
pypi
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fraggle-0.1.5.tar.gz.
File metadata
- Download URL: fraggle-0.1.5.tar.gz
- Upload date:
- Size: 103.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b4fc2f1af18d60a38190f977b1d9c5d11f83b50b1defb23c7bf57d99342e222
|
|
| MD5 |
12b5aa038f0c5756be5e063e8f8959b1
|
|
| BLAKE2b-256 |
805fd9cd8738b6663a7882ff4b250aa74c9213eed4946ddb3c5e09501471c6d6
|
Provenance
The following attestation bundles were made for fraggle-0.1.5.tar.gz:
Publisher:
publish.yml on tomdyson/fraggle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fraggle-0.1.5.tar.gz -
Subject digest:
0b4fc2f1af18d60a38190f977b1d9c5d11f83b50b1defb23c7bf57d99342e222 - Sigstore transparency entry: 630018569
- Sigstore integration time:
-
Permalink:
tomdyson/fraggle@f1284da2f3eff69aa3b3dd91843ae159a47970ef -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/tomdyson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1284da2f3eff69aa3b3dd91843ae159a47970ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file fraggle-0.1.5-py3-none-any.whl.
File metadata
- Download URL: fraggle-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb87cae025f88d136187474dca0fe1a7b66223af90bd72311bdf05ed59878478
|
|
| MD5 |
a4425bc04421a30e8542d2a020f84224
|
|
| BLAKE2b-256 |
47f7cc80790f4e31df736cada3897385dd88764c29c2654e1853c4010d4bffde
|
Provenance
The following attestation bundles were made for fraggle-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on tomdyson/fraggle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fraggle-0.1.5-py3-none-any.whl -
Subject digest:
fb87cae025f88d136187474dca0fe1a7b66223af90bd72311bdf05ed59878478 - Sigstore transparency entry: 630018572
- Sigstore integration time:
-
Permalink:
tomdyson/fraggle@f1284da2f3eff69aa3b3dd91843ae159a47970ef -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/tomdyson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1284da2f3eff69aa3b3dd91843ae159a47970ef -
Trigger Event:
push
-
Statement type: