{ "openapi": "3.1.0", "info": { "title": "Agentic-RAG API", "description": "Intelligent document analysis over ArXiv papers via two-stage RAG + SmolAgents.", "version": "0.1.0" }, "paths": { "/api/v1/auth/register": { "post": { "tags": [ "auth" ], "summary": "Register", "operationId": "register_api_v1_auth_register_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RegisterRequest" } } }, "required": true }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserProfile" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/auth/login": { "post": { "tags": [ "auth" ], "summary": "Login", "operationId": "login_api_v1_auth_login_post", "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/Body_login_api_v1_auth_login_post" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TokenResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/auth/me": { "get": { "tags": [ "auth" ], "summary": "Me", "operationId": "me_api_v1_auth_me_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserProfile" } } } } }, "security": [ { "OAuth2PasswordBearer": [] } ] } }, "/api/v1/query": { "post": { "tags": [ "query" ], "summary": "Submit Query", "operationId": "submit_query_api_v1_query_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/QueryRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/QueryResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "OAuth2PasswordBearer": [] } ] } }, "/api/v1/query/history": { "get": { "tags": [ "query" ], "summary": "Query History", "operationId": "query_history_api_v1_query_history_get", "security": [ { "OAuth2PasswordBearer": [] } ], "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "default": 20, "title": "Limit" } }, { "name": "offset", "in": "query", "required": false, "schema": { "type": "integer", "default": 0, "title": "Offset" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/QueryHistoryItem" }, "title": "Response Query History Api V1 Query History Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/query/{query_id}/visualization": { "get": { "tags": [ "query" ], "summary": "Get Visualization", "operationId": "get_visualization_api_v1_query__query_id__visualization_get", "security": [ { "OAuth2PasswordBearer": [] } ], "parameters": [ { "name": "query_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Query Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VizPollResponse" } } } }, "404": { "description": "Visualization not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/query/{query_id}/evaluation": { "get": { "tags": [ "query" ], "summary": "Get Evaluation", "operationId": "get_evaluation_api_v1_query__query_id__evaluation_get", "security": [ { "OAuth2PasswordBearer": [] } ], "parameters": [ { "name": "query_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Query Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EvalPollResponse" } } } }, "404": { "description": "Evaluation not found or provider disabled" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/settings": { "get": { "tags": [ "settings" ], "summary": "Get App Settings", "description": "Return current application settings. Sensitive API keys are partially masked (first 4 chars + ****).", "operationId": "get_app_settings_api_v1_settings_get", "security": [ { "OAuth2PasswordBearer": [] } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppSettingsResponse" } } } } } }, "put": { "tags": [ "settings" ], "summary": "Update App Settings", "description": "Write changes to .env and hot-reload. Fields containing a masked placeholder (value ends with '****') are skipped.", "operationId": "update_app_settings_api_v1_settings_put", "security": [ { "OAuth2PasswordBearer": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppSettingsUpdateRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response — returns updated settings (keys still masked)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppSettingsResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/health": { "get": { "tags": [ "health" ], "summary": "Health", "operationId": "health_api_v1_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } } }, "components": { "schemas": { "Body_login_api_v1_auth_login_post": { "properties": { "grant_type": { "anyOf": [ { "type": "string", "pattern": "^password$" }, { "type": "null" } ], "title": "Grant Type" }, "username": { "type": "string", "title": "Username" }, "password": { "type": "string", "format": "password", "title": "Password" }, "scope": { "type": "string", "title": "Scope", "default": "" }, "client_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Client Id" }, "client_secret": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "format": "password", "title": "Client Secret" } }, "type": "object", "required": [ "username", "password" ], "title": "Body_login_api_v1_auth_login_post" }, "Citation": { "properties": { "index": { "type": "integer", "title": "Index" }, "title": { "type": "string", "title": "Title" }, "source_url": { "type": "string", "title": "Source Url" }, "full_citation": { "type": "string", "title": "Full Citation" } }, "type": "object", "required": [ "index", "title", "source_url", "full_citation" ], "title": "Citation" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "QueryHistoryItem": { "properties": { "id": { "type": "string", "title": "Id" }, "query_text": { "type": "string", "title": "Query Text" }, "response_text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Response Text" }, "model_provider": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Model Provider" }, "agent_steps": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Agent Steps" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "query_text", "response_text", "model_provider", "agent_steps", "created_at" ], "title": "QueryHistoryItem" }, "QueryRequest": { "properties": { "query": { "type": "string", "title": "Query" } }, "type": "object", "required": [ "query" ], "title": "QueryRequest" }, "QueryResponse": { "properties": { "id": { "type": "string", "title": "Id" }, "query": { "type": "string", "title": "Query" }, "answer": { "type": "string", "title": "Answer" }, "citations": { "items": { "$ref": "#/components/schemas/Citation" }, "type": "array", "title": "Citations" }, "chart_data": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Chart Data" }, "model_provider": { "type": "string", "title": "Model Provider" }, "agent_steps": { "type": "integer", "title": "Agent Steps" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "query", "answer", "citations", "chart_data", "model_provider", "agent_steps", "created_at" ], "title": "QueryResponse" }, "RegisterRequest": { "properties": { "email": { "type": "string", "format": "email", "title": "Email" }, "password": { "type": "string", "title": "Password" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Display Name" }, "role": { "type": "string", "title": "Role", "default": "guest" } }, "type": "object", "required": [ "email", "password" ], "title": "RegisterRequest" }, "TokenResponse": { "properties": { "access_token": { "type": "string", "title": "Access Token" }, "token_type": { "type": "string", "title": "Token Type", "default": "bearer" } }, "type": "object", "required": [ "access_token" ], "title": "TokenResponse" }, "UserProfile": { "properties": { "id": { "type": "string", "title": "Id" }, "email": { "type": "string", "title": "Email" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Display Name" }, "is_active": { "type": "boolean", "title": "Is Active" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "email", "display_name", "is_active", "created_at" ], "title": "UserProfile" }, "VizPollResponse": { "properties": { "status": { "type": "string", "enum": ["pending", "complete", "error"], "title": "Status" }, "chart_data": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Chart Data" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error" } }, "type": "object", "required": ["status", "chart_data"], "title": "VizPollResponse" }, "EvalPollResponse": { "properties": { "status": { "type": "string", "enum": ["pending", "complete"], "title": "Status" }, "scores": { "anyOf": [ { "type": "object", "properties": { "relevance_score": { "anyOf": [{"type": "number"}, {"type": "null"}] }, "groundedness_score": { "anyOf": [{"type": "number"}, {"type": "null"}] }, "answer_relevance_score": { "anyOf": [{"type": "number"}, {"type": "null"}] } } }, { "type": "null" } ], "title": "Scores" } }, "type": "object", "required": ["status", "scores"], "title": "EvalPollResponse" }, "AppSettingsResponse": { "properties": { "model_provider": { "type": "string", "title": "Model Provider" }, "openai_api_key": { "type": "string", "title": "OpenAI API Key (masked)" }, "openai_model": { "type": "string", "title": "OpenAI Model" }, "azure_openai_api_key": { "type": "string", "title": "Azure API Key (masked)" }, "azure_openai_endpoint": { "type": "string", "title": "Azure Endpoint" }, "azure_openai_deployment": { "type": "string", "title": "Azure Deployment" }, "azure_openai_api_version": { "type": "string", "title": "Azure API Version" }, "google_api_key": { "type": "string", "title": "Google API Key (masked)" }, "gemini_model": { "type": "string", "title": "Gemini Model" }, "trulens_provider": { "type": "string", "title": "TruLens Provider" }, "trulens_strategy": { "type": "string", "title": "TruLens Strategy" }, "trulens_sample_rate": { "type": "integer", "title": "TruLens Sample Rate" }, "trulens_feedback_timeout": { "type": "number", "title": "TruLens Feedback Timeout" }, "viz_model_provider": { "type": "string", "title": "Viz Model Provider" }, "viz_model_name": { "type": "string", "title": "Viz Model Name" }, "viz_azure_deployment": { "type": "string", "title": "Viz Azure Deployment" }, "viz_azure_api_version": { "type": "string", "title": "Viz Azure API Version" } }, "type": "object", "required": [ "model_provider", "openai_api_key", "openai_model", "azure_openai_api_key", "azure_openai_endpoint", "azure_openai_deployment", "azure_openai_api_version", "google_api_key", "gemini_model", "trulens_provider", "trulens_strategy", "trulens_sample_rate", "trulens_feedback_timeout", "viz_model_provider", "viz_model_name", "viz_azure_deployment", "viz_azure_api_version" ], "title": "AppSettingsResponse" }, "AppSettingsUpdateRequest": { "properties": { "model_provider": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Model Provider" }, "openai_api_key": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "OpenAI API Key" }, "openai_model": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "OpenAI Model" }, "azure_openai_api_key": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Azure API Key" }, "azure_openai_endpoint": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Azure Endpoint" }, "azure_openai_deployment": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Azure Deployment" }, "azure_openai_api_version": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Azure API Version" }, "google_api_key": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Google API Key" }, "gemini_model": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Gemini Model" }, "trulens_provider": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "TruLens Provider" }, "trulens_strategy": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "TruLens Strategy" }, "trulens_sample_rate": { "anyOf": [{"type": "integer"}, {"type": "null"}], "title": "TruLens Sample Rate" }, "trulens_feedback_timeout": { "anyOf": [{"type": "number"}, {"type": "null"}], "title": "TruLens Feedback Timeout" }, "viz_model_provider": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Viz Model Provider" }, "viz_model_name": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Viz Model Name" }, "viz_azure_deployment": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Viz Azure Deployment" }, "viz_azure_api_version": { "anyOf": [{"type": "string"}, {"type": "null"}], "title": "Viz Azure API Version" } }, "type": "object", "title": "AppSettingsUpdateRequest" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } }, "securitySchemes": { "OAuth2PasswordBearer": { "type": "oauth2", "flows": { "password": { "scopes": {}, "tokenUrl": "/api/v1/auth/login" } } } } } }