Skip to content

mmmcorpsvit/fastapi-openapi-jsonl-rag

Repository files navigation

openapi-rag (enhanced)

Convert FastAPI/OpenAPI openapi.json into JSONL chunks (id, text, metadata) optimized for RAG pipelines (embeddings + hybrid search).

This enhanced version provides:

  • Parametric configuration via ConverterConfig (token vs char chunking, chunk sizes, overlap, expand refs, emit raw schemas)
  • FastAPI router with query-parameter overrides
  • CLI with flags, unit tests, mypy + ruff CI workflow
  • Optional tokenization using tiktoken when available (graceful fallback otherwise)

Quickstart

Install dev extras for tokenization & dev tools:

pip install .[dev]

CLI:

openapi-rag example_openapi.json -o api.jsonl --expand-refs --emit-raw-schemas

FastAPI router:

from fastapi import FastAPI
from openapi_rag.fastapi_integration import router as rag_router

app = FastAPI()
app.include_router(rag_router)
# visit /openapi-rag.jsonl

Contributing

Run tests and linters:

pip install .[dev]
ruff check .
mypy openapi_rag
pytest -q

About

Convert FastAPI/OpenAPI openapi.json into JSONL chunks (id, text, metadata) optimized for RAG pipelines (embeddings + hybrid search).

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages