FastAPI
FastAPI is a Python framework for building HTTP APIs.
It supports asynchronous request handling and uses Python type hints for request validation and API documentation.
Endpoints
An API endpoint maps an HTTP method and URL path to application code.
Example endpoints could include:
GET /health POST /ask
A health endpoint can be used to determine whether an application is running.
Request and Response
Clients send HTTP requests to the API.
The API processes the request and returns an HTTP response.
JSON is commonly used for exchanging structured data.
RAG API
In a RAG application, a POST request to /ask can contain a user's question.
The API can pass the question to the retrieval pipeline, obtain relevant document chunks, send the context to an LLM and return the generated answer with its sources.