Hernando Abella

Customer Support Knowledge Assistant · Step 4 of 7

Design the API and keep secrets server-side

Create a FastAPI endpoint that accepts a question and returns an answer, sources, and a status. Validate length and reject empty input.

Understand

A backend API isolates provider credentials and gives clients a stable interface.

Build

Load provider credentials from environment variables, set timeouts, and return sanitized errors. Use a mock generator while testing the route shape.

Check

The API contract is stable and no key or raw provider exception appears in a client response.

Try it

Decide whether you need rate limiting before exposing the endpoint publicly.