Skip to content

API Reference

Every RAG pipeline in hemlock-lab exposes the same 4 HTTP endpoints. This section documents the request/response format for each endpoint.


Base URLs

Framework Base URL
LangChain http://localhost:8100
LlamaIndex http://localhost:8101
Unstructured http://localhost:8102
Haystack http://localhost:8103
ColPALI http://localhost:8104
ChromaDB http://localhost:8000
Ollama http://localhost:11434

Pipeline Endpoints

All 5 RAG pipelines expose these endpoints:

Endpoint Method Page
/health GET Health
/extract POST Extract
/ingest POST Ingest
/query POST Query

Quick Reference

Health Check (Any Pipeline)

curl http://localhost:8100/health

Extract Text

curl -X POST http://localhost:8100/extract \
  -F "file=@document.html"

Ingest Document

curl -X POST http://localhost:8100/ingest \
  -F "file=@document.html" \
  -F "collection=my-collection"

Query RAG Chain

curl -X POST http://localhost:8100/query \
  -H "Content-Type: application/json" \
  -d '{"query": "What is the refund policy?", "collection": "my-collection"}'

ChromaDB Native API

For direct ChromaDB access (bypassing the pipeline wrappers):

Endpoint Method Purpose
/api/v1/heartbeat GET Health check
/api/v1/collections GET List collections
/api/v1/collections POST Create collection
/api/v1/collections/{name} DELETE Delete collection
/api/v1/collections/{id}/add POST Add documents
/api/v1/collections/{id}/query POST Query by embedding

Examples

# List collections
curl http://localhost:8000/api/v1/collections | jq '.[].name'

# Count documents in a collection
curl http://localhost:8000/api/v1/collections/noise-corpus/count

Ollama Native API

Endpoint Method Purpose
/api/tags GET List models
/api/embed POST Generate embeddings
/api/generate POST Generate text

Examples

# List models
curl http://localhost:11434/api/tags | jq '.models[].name'

# Generate embedding
curl http://localhost:11434/api/embed \
  -d '{"model": "nomic-embed-text", "input": "test query"}'

# Generate text
curl http://localhost:11434/api/generate \
  -d '{"model": "smollm2:135m", "prompt": "Hello", "stream": false}'

Error Responses

All endpoints return errors in this format:

{
  "error": "description of what went wrong",
  "detail": "optional stack trace or additional info"
}

Common HTTP status codes:

Code Meaning
200 Success
400 Bad request (missing file, invalid JSON)
415 Unsupported file format
500 Internal server error (framework exception)
503 Service unavailable (ChromaDB or Ollama down)

Next Steps

  • Extract — Full /extract endpoint documentation
  • Pipelines — How each framework implements these endpoints