Undocumented
Function | get |
# GET `/api/attributes/<attribute_name>` |
Function | get |
# GET `/api/catalog` |
Function | get |
# GET `/api/docs` |
Function | get |
# GET `/api/document/<name>` |
Function | get |
# GET `/api/notes/<post_title>` |
Function | post |
# POST `/api/attribute` |
Function | post |
A decorator to each POST endpoints. Calls the post_auth_check to checks wheter or not the request is authenticated. |
Function | post |
# POST `/api/note` |
Function | post |
# POST `/api/compile/attribute` |
Function | post |
# POST `/api/compile/catalog` |
Function | post |
# POST `/api/document` |
Function | stream |
# POST `/api/query` |
Function | stream |
A decorator to each the 'api/stream' endpoint. Calls the stream_auth_check to checks wheter or not the request is authenticated. |
Variable | post |
A method variable called before each POST request. It must return a bool that indicates wether or not the request can be made. By default always returns `False` unless `allow_post` is set to `True` in the `qA_Ap... |
Variable | server |
A Bottle server instance. It is accessible as `qA_Ap.server`. |
Variable | stream |
A method variable called before each `api/stream` endpoint request. It must return a bool that indicates wether or not the request can be made. By default always returns `True`. Redefine this variable to implement your stream endpoint authentication... |
# GET `/api/attributes/<attribute_name>` Returns all existing values for the specified attribute as JSON. ## 200 response: ```json [ "attribute1", "attribute2", ... ] ``` ## Error response: ```json {"error": "<error message>"} ```
# GET `/api/catalog` Returns the catalog as JSON. The catalog is a list of all documents with their metadata and a short excerpt. ## 200 response: ```json [ { "title": "Document Title", "metadata": { "links": ["link1", "link2"], "attributes": ["attribute1", "attribute2"], }, "excerpt": "This is a short excerpt of the document..." }, ... ] ```
# GET `/api/document/<name>` Returns a document by name. Returns an error message if the document is not found or if an error occurs. ## 200 response: ```json { "title": "Document Title", "content": "Full content of the document...", "metadata": { "links": ["link1", "link2"], "attributes": ["attribute1", "attribute2"], } } ``` ## Error response: ```json {"error": "<error message>"} ```
# GET `/api/notes/<post_title>` Returns all notes for a document as JSON. ## 200 response: ```json [ { "note_title": "User1", "content": "Note content...", "metadata": { "rating": 5, } }, ... ] ``` ## Error response: ```json {"error": "<error message>"} ```
# POST `/api/attribute` Registers new attribute values. All the attribute values already existing are ignored. If the attribute type does not exist, it is created with the new values. ## Request body: ```json { "attribute": str, // the attribute name "values": list[str] } ``` ## 200 response: ```json { "success": true, "message": "attribute '<attribute>' registered" } ``` ## Error response: ```json {"error": "<error message>"} ```
A decorator to each POST endpoints. Calls the post_auth_check to checks wheter or not the request is authenticated.
# POST `/api/note` Registers a new note. ## Request body: ```json { "post_title": "Document Title", "note_title": "User1", "content": <yaml str> | <str> "medias": <list[str]>, "metadata": <dict[str,str]>" } ``` ## 200 response: ```json { "success": true, "message": "<note_title> commented on the document <post_title>" } ``` ## Error response: ```json {"error": "<error message>"} ```
# POST `/api/compile/attribute` Triggers a rebuild of an attribute values list from the catalog. ## Request body: ```json { "attributes": <list[str]> } ``` ## 200 response: ```json { "success": true, "message": "Catalog compiled successfully" } ``` ## Error response: ```json {"error": "<error message>"} ```
# POST `/api/compile/catalog` Triggers a rebuild of the catalog from all documents. ## 200 response: ```json { "success": true, "message": "Catalog compiled successfully" } ``` ## Error response: ```json {"error": "<error message>"} ```
# POST `/api/document` Registers a new document. ## Request body: ```json { "title": <str>, "medias": <list[str]>, "content": <yaml str> | <str> "metadata": <dict[str,str]> } ``` If no `metadata` field is given the document content can be in YAML format with optional metadata prefixed. ## Document content example with metadata: ```yaml medias: - image1.png - image2.png tags: - tag1 - tag2 ### This is the text content of the document. ``` If the `metadata` field is given, the yaml formatted fields are prefixed to the content automatically. ## 200 response: ```json { "success": true, "message": "The document <post_title> is created" } ``` ## Error response: ```json {"error": "<error message>"} ```
# POST `/api/query` Streams a response from the LLM for a given prompt. The history is a list of entry containing the role and content of messages. Example: ```json [ { "role": "user", "content": "Why is the sky blue?" }, { "role": "assistant", "content": "The sky is blue because of the way the Earth's atmosphere scatters sunlight." }, ... ] ``` ## Request body: ```json { "prompt": <str>, "history": <list[dict[str,str]]> (default None) "metadata": <bool> (default: true) // whether to include retrieved documents metadata in the response } ``` ## Streamed response: ``` <LLM response chunks> ```
A decorator to each the 'api/stream' endpoint. Calls the stream_auth_check to checks wheter or not the request is authenticated.
A method variable called before each POST request. It must return a bool that indicates wether or not the request can be made. By default always returns `False` unless `allow_post` is set to `True` in the `qA_Ap.init()` method. Redefine this variable to implement your authentication. ```qA_Ap.server.post_auth_check = your_method```
A method variable called before each `api/stream` endpoint request. It must return a bool that indicates wether or not the request can be made. By default always returns `True`. Redefine this variable to implement your stream endpoint authentication. ```qA_Ap.server.stream_auth_check = your_method```