Skip to main content

A simple RAG API - build a question and answer interface to your own content in minutes

Project description

Fraggle

A simple RAG (Retrieval-Augmented Generation) API - build a question and answer interface to your own content in minutes.

Fraggle is the spiritual successor to microllama, modernized with:

  • Provider-agnostic LLM support via any-llm
  • Modern LangChain (0.3+)
  • Support for OpenAI and Anthropic models
  • Simple deployment and usage

Installation

pip install fraggle

Quick Start

  1. Prepare your content in a source.json file:
[
  {
    "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"
  }
]
  1. Set your API key:
export OPENAI_API_KEY="your-key-here"
# or
export ANTHROPIC_API_KEY="your-key-here"
  1. Create the search index:
fraggle index
  1. Start the server:
fraggle serve
  1. 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 pip install -e .

# Run in development mode
fraggle serve --reload

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

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

fraggle-0.1.0.tar.gz (95.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fraggle-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file fraggle-0.1.0.tar.gz.

File metadata

  • Download URL: fraggle-0.1.0.tar.gz
  • Upload date:
  • Size: 95.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for fraggle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1de38befd35cf2a795170eca8b468a3566c05da6699fa698d06277ceae38841
MD5 553bffe8693bc7d07398591ac6bc502f
BLAKE2b-256 6badcff0d37e882cb2d6c9a3d6649cbdf2cee4491ee832b2c90cef6e98a57e5c

See more details on using hashes here.

File details

Details for the file fraggle-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fraggle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for fraggle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04769727d4ce0228597e35da79ea47704922d659d8375b6a1c7153af96fdc6ec
MD5 bcaefd28d275e1bc184223b45e7fbb8e
BLAKE2b-256 b9de5f99c9b5be6e943526f61ff720b0d69f4641eadefc60d1a35fae5587d450

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page