A FastAPI NLP service in Python for classification, entity extraction, sentiment and summarisation. The summariser is a two-node LangGraph — retrieve, then summarise — that conditions each summary on similar prior examples from Pinecone and writes the result back, so the corpus it draws on grows with use. Long jobs return a task id, poll, and can fire a webhook on completion.

Six endpoints. Classification, entity extraction and sentiment each take a batch of texts, then a synchronous cached summarise, an asynchronous summarise that answers 202 with a task id, and a status read for that id.

The idea is in the asynchronous path, and it is a loop rather than a pipeline. Retrieval pulls similar prior examples out of the vector store, the summariser conditions on them, and the finished summary is written back into the same store — so the examples a new summary draws on are the summaries the service has already produced, and its style converges on itself.

The configuration is pinned tightly enough to reproduce: a 1,536-dimension index on cosine similarity to match text-embedding-3-small, and a chat model behind an OpenAI-compatible endpoint. Long jobs are polled by task id and can fire a webhook when they finish, so a caller never has to hold the connection.