{ "openapi": "3.0.0", "info": { "title": "AI Crohn Coach RAG API", "version": "2.0.0", "description": "This API provides REST endpoints with Server-Sent Events (SSE) streaming capabilities for interactive chat" }, "paths": { "/upload": { "post": { "summary": "Upload PDFs", "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "files": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } }, "responses": { "200": { "description": "Files uploaded successfully" } } } }, "/chat": { "post": { "summary": "Chat Inference with streaming", "description": "Send a request to the chat API. The API will respond with a stream of Server-Sent Events (SSE) by default, or a single JSON response if stream is set to false.", "requestBody": { "content": { "application/json; charset=utf-8": { "schema": { "type": "object", "properties": { "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": ["user", "coach"] }, "content": { "type": "string", "example": "Explique-moi comme si j'avais 5 ans. Qu'est-ce que la maladie de Crohn et comment savoir si je l'ai ?" } }, "required": ["role", "content"] }, "example": [ {"role": "user", "content": "Bonjour le bro!"}, {"role": "coach", "content": "Salut."}, {"role": "user", "content": "Explique-moi comme si j'avais 5 ans. Qu'est-ce que la maladie de Crohn et comment savoir si je l'ai ?"} ] }, "language": { "type": "string", "enum": ["french", "italian", "english", "german", "auto"], "default": "auto", "description": "The language for the response. Must be one of: french, italian, english, german. Defaults to auto if not specified, which will try to infer the language." }, "temperature": { "type": "number", "format": "float", "description": "The temperature for the response. Must be a float between 0 and 1. Defaults to 0.7 if not specified.", "default": 0.7, "minimum": 0, "maximum": 1, "exclusiveMaximum": false, "exclusiveMinimum": false, "example": 0.7 }, "reasoning": { "type": "boolean", "description": "Whether to use reasoning for the response. Defaults to false if not specified. Reasoning allows the model to show its thinking process.", "default": false, "example": false }, "stream": { "type": "boolean", "description": "Whether to return a streaming response. If true, the response will be a stream of Server-Sent Events (SSE). If false, the response will be a single JSON object.", "default": true, "example": true }, "personality": { "type": "string", "enum": ["cool", "cynical", "supportive"], "default": "supportive", "description": "The personality style for AI responses: cool (confident and direct), cynical (critical and pragmatic), or supportive (empathetic and encouraging).", "example": "supportive" } }, "required": ["messages"] } } } }, "responses": { "200": { "description": "Answer returned successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "string" } } } }, "text/event-stream": { "schema": { "type": "object", "properties": { "content": { "type": "string", "description": "A fragment of the response text" }, "full": { "type": "string", "description": "The accumulated response so far" }, "done": { "type": "boolean", "description": "Indicates whether the response is complete" } } } } } } } } }, "/docs": { "delete": { "summary": "Delete all documents", "description": "Removes all documents from the database", "responses": { "200": { "description": "All documents have been successfully deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } } }, "components": { "schemas": { "WebSocketMessage": { "type": "object", "properties": { "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": ["user", "coach"] }, "content": { "type": "string" } } } }, "language": { "type": "string", "enum": ["french", "italian", "english", "german", "auto"] }, "temperature": { "type": "number" }, "reasoning": { "type": "boolean" }, "stream": { "type": "boolean" }, "personality": { "type": "string", "enum": ["cool", "cynical", "supportive"] } } } } }, "x-sse-endpoints": { "/chat": { "description": "Server-Sent Events endpoint for streaming chat responses", "messages": { "fromServer": { "type": "object", "properties": { "content": { "type": "string" }, "full": { "type": "string" }, "done": { "type": "boolean" } } } } } } }