{ "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Coding Challenge: NL Search", "description": "Coding Challenge: Natural Language Search" }, "paths": { "/api/v1/documents": { "post": { "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/upload_document_input" } } } }, "tags": [ "Upload plain text document" ], "summary": "Returns newly created store ID of uploaded document", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/upload_document_output" } } } }, "400": { "description": "Failed. Bad input." } } } }, "/api/v1/search": { "get": { "parameters": [ {"name":"query", "description": "Question, e.g. 'When was Michael born?'", "required": true, "in":"query", "schema": { "type": "string" } } ], "tags": [ "Search documents using Natural Language" ], "summary": "Returns answer to asked question including document store IDs, which contain text the answer is based on", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/search_output" } } } }, "400": { "description": "Failed. Bad input." } } } }, "/api/v1/documents/{id}": { "summary": "Get content of a particular document from document store", "get": { "parameters": [ { "name": "id", "in": "path", "description": "ID of document", "required": true, "schema": { "type": "string" } } ], "tags": [ "Get document" ], "summary": "Returns content of a particular document from document store", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/get_document_output" } } } } } } } }, "components": { "schemas": { "search_output": { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string" }, "score": { "type": "number" }, "id": { "type": "integer" } } } }, "query": { "type": "string", "format": "string" }, "llm": { "type": "string", "format": "string" } } }, "upload_document_input": { "type": "object", "properties": { "text": { "type": "string", "format": "string" } } }, "get_document_output": { "type": "object", "properties": { "chunks": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string" } } } }, "id": { "type": "integer" } } }, "upload_document_output": { "type": "object", "properties": { "id": { "type": "string", "format": "string" } } } } } }