diff --git a/.devcontainer/frontend/devcontainer.json b/.devcontainer/backend-dev/devcontainer.json similarity index 78% rename from .devcontainer/frontend/devcontainer.json rename to .devcontainer/backend-dev/devcontainer.json index 4f3c61ce..132645fc 100644 --- a/.devcontainer/frontend/devcontainer.json +++ b/.devcontainer/backend-dev/devcontainer.json @@ -6,7 +6,7 @@ "version": "latest" } }, - "postCreateCommand": "bash .devcontainer/frontend/post_create_command.sh", + "postCreateCommand": "bash .devcontainer/backend-dev/post_create_command.sh", "customizations": { "vscode": { "extensions": ["GitHub.copilot"] diff --git a/.devcontainer/backend-dev/post_create_command.sh b/.devcontainer/backend-dev/post_create_command.sh new file mode 100644 index 00000000..4bbbed54 --- /dev/null +++ b/.devcontainer/backend-dev/post_create_command.sh @@ -0,0 +1,23 @@ +# ensure pre-commit is installed +pre-commit install + +# create python virtual environment +python3 -m venv .venv + +# install python dependencies in /backend +cd backend +pip install -r requirements.txt +cd .. + +# install code in editable mode in /oasst-shared +cd oasst-shared +pip install -e . +cd .. + +# docker compose up for backend-dev +docker compose up backend-dev --build --attach-dependencies -d + +# note: commented out for now, you probably want to manually run this part once in the devcontainer +# run run-local.sh script +# cd scripts/backend-development/ +# bash run-local.sh diff --git a/.devcontainer/frontend-dev/devcontainer.json b/.devcontainer/frontend-dev/devcontainer.json new file mode 100644 index 00000000..539adec1 --- /dev/null +++ b/.devcontainer/frontend-dev/devcontainer.json @@ -0,0 +1,15 @@ +{ + "name": "Open-Assistant", + "image": "mcr.microsoft.com/vscode/devcontainers/universal", + "features": { + "ghcr.io/devcontainers-contrib/features/pre-commit:2": { + "version": "latest" + } + }, + "postCreateCommand": "bash .devcontainer/frontend-dev/post_create_command.sh", + "customizations": { + "vscode": { + "extensions": ["GitHub.copilot"] + } + } +} diff --git a/.devcontainer/frontend/post_create_command.sh b/.devcontainer/frontend-dev/post_create_command.sh similarity index 100% rename from .devcontainer/frontend/post_create_command.sh rename to .devcontainer/frontend-dev/post_create_command.sh diff --git a/backend/README.md b/backend/README.md index 80c39dfd..056e0823 100644 --- a/backend/README.md +++ b/backend/README.md @@ -44,3 +44,18 @@ run `alembic revision --autogenerate -m "..."` ("..." is what you did) in the `/backend` directory. Then edit the newly created file. See [here](https://alembic.sqlalchemy.org/en/latest/tutorial.html) for more information. + +## API Documentation + +Once you have successfully started the backend server, you can access the +default api docs at `localhost:8080/docs`. If you need to update the exported +openapi.json in the docs/ folder you can run below command to `wget` them from +the relevant local fastapi endpoint. This will enable anyone to just see API +docs via something like +[Swagger.io](https://editor.swagger.io/?url=https://raw.githubusercontent.com/LAION-AI/Open-Assistant/main/docs/docs/api/openapi.json) +without having to actually set up and run a development backend. + +```bash +# save openapi.json to docs/docs/api +wget localhost:8080/api/v1/openapi.json -O docs/docs/api/openapi.json +``` diff --git a/docs/docs/api/openapi.json b/docs/docs/api/openapi.json new file mode 100644 index 00000000..c6a985b3 --- /dev/null +++ b/docs/docs/api/openapi.json @@ -0,0 +1,1925 @@ +{ + "openapi": "3.0.2", + "info": { "title": "open-assistant backend", "version": "0.1.0" }, + "paths": { + "/api/v1/tasks/": { + "post": { + "tags": ["tasks"], + "summary": "Request Task", + "description": "Create new task.", + "operationId": "request_task_api_v1_tasks__post", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Request Task Api V1 Tasks Post", + "anyOf": [ + { "$ref": "#/components/schemas/TaskDone" }, + { "$ref": "#/components/schemas/SummarizeStoryTask" }, + { "$ref": "#/components/schemas/RateSummaryTask" }, + { "$ref": "#/components/schemas/InitialPromptTask" }, + { "$ref": "#/components/schemas/ReplyToConversationTask" }, + { "$ref": "#/components/schemas/PrompterReplyTask" }, + { "$ref": "#/components/schemas/AssistantReplyTask" }, + { "$ref": "#/components/schemas/RankInitialPromptsTask" }, + { + "$ref": "#/components/schemas/RankConversationRepliesTask" + }, + { "$ref": "#/components/schemas/RankPrompterRepliesTask" }, + { "$ref": "#/components/schemas/RankAssistantRepliesTask" }, + { "$ref": "#/components/schemas/LabelInitialPromptTask" }, + { + "$ref": "#/components/schemas/LabelConversationReplyTask" + }, + { "$ref": "#/components/schemas/LabelPrompterReplyTask" }, + { "$ref": "#/components/schemas/LabelAssistantReplyTask" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/tasks/{task_id}/ack": { + "post": { + "tags": ["tasks"], + "summary": "Tasks Acknowledge", + "description": "The frontend acknowledges a task.", + "operationId": "tasks_acknowledge_api_v1_tasks__task_id__ack_post", + "parameters": [ + { + "required": true, + "schema": { + "title": "Task Id", + "type": "string", + "format": "uuid" + }, + "name": "task_id", + "in": "path" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskAck" } + } + }, + "required": true + }, + "responses": { + "204": { "description": "Successful Response" }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/tasks/{task_id}/nack": { + "post": { + "tags": ["tasks"], + "summary": "Tasks Acknowledge Failure", + "description": "The frontend reports failure to implement a task.", + "operationId": "tasks_acknowledge_failure_api_v1_tasks__task_id__nack_post", + "parameters": [ + { + "required": true, + "schema": { + "title": "Task Id", + "type": "string", + "format": "uuid" + }, + "name": "task_id", + "in": "path" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskNAck" } + } + }, + "required": true + }, + "responses": { + "204": { "description": "Successful Response" }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/tasks/interaction": { + "post": { + "tags": ["tasks"], + "summary": "Tasks Interaction", + "description": "The frontend reports an interaction.", + "operationId": "tasks_interaction_api_v1_tasks_interaction_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "Interaction", + "anyOf": [ + { "$ref": "#/components/schemas/TextReplyToMessage" }, + { "$ref": "#/components/schemas/MessageRating" }, + { "$ref": "#/components/schemas/MessageRanking" }, + { "$ref": "#/components/schemas/TextLabels" } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskDone" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/tasks/close": { + "post": { + "tags": ["tasks"], + "summary": "Close Collective Task", + "operationId": "close_collective_task_api_v1_tasks_close_post", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskClose" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TaskDone" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/text_labels/": { + "post": { + "tags": ["text_labels"], + "summary": "Label Text", + "description": "Label a piece of text.", + "operationId": "label_text_api_v1_text_labels__post", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/TextLabels" } + } + }, + "required": true + }, + "responses": { + "204": { "description": "Successful Response" }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/text_labels/valid_labels": { + "get": { + "tags": ["text_labels"], + "summary": "Get Valid Lables", + "operationId": "get_valid_lables_api_v1_text_labels_valid_labels_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + } + } + } + }, + "/api/v1/messages/": { + "get": { + "tags": ["messages"], + "summary": "Query Messages", + "description": "Query messages.", + "operationId": "query_messages_api_v1_messages__get", + "parameters": [ + { + "required": false, + "schema": { "title": "Username", "type": "string" }, + "name": "username", + "in": "query" + }, + { + "required": false, + "schema": { "title": "Api Client Id", "type": "string" }, + "name": "api_client_id", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Max Count", + "maximum": 1000.0, + "exclusiveMinimum": 0.0, + "type": "integer", + "default": 10 + }, + "name": "max_count", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Start Date", + "type": "string", + "format": "date-time" + }, + "name": "start_date", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "End Date", + "type": "string", + "format": "date-time" + }, + "name": "end_date", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Only Roots", + "type": "boolean", + "default": false + }, + "name": "only_roots", + "in": "query" + }, + { + "required": false, + "schema": { "title": "Desc", "type": "boolean", "default": true }, + "name": "desc", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Allow Deleted", + "type": "boolean", + "default": false + }, + "name": "allow_deleted", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Query Messages Api V1 Messages Get", + "type": "array", + "items": { "$ref": "#/components/schemas/Message" } + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}": { + "get": { + "tags": ["messages"], + "summary": "Get Message", + "description": "Get a message by its internal ID.", + "operationId": "get_message_api_v1_messages__message_id__get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Message" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + }, + "delete": { + "tags": ["messages"], + "summary": "Mark Message Deleted", + "operationId": "mark_message_deleted_api_v1_messages__message_id__delete", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "204": { "description": "Successful Response" }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}/conversation": { + "get": { + "tags": ["messages"], + "summary": "Get Conv", + "description": "Get a conversation from the tree root and up to the message with given internal ID.", + "operationId": "get_conv_api_v1_messages__message_id__conversation_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Conversation" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}/tree": { + "get": { + "tags": ["messages"], + "summary": "Get Tree", + "description": "Get all messages belonging to the same message tree.", + "operationId": "get_tree_api_v1_messages__message_id__tree_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/MessageTree" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}/children": { + "get": { + "tags": ["messages"], + "summary": "Get Children", + "description": "Get all messages belonging to the same message tree.", + "operationId": "get_children_api_v1_messages__message_id__children_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Get Children Api V1 Messages Message Id Children Get", + "type": "array", + "items": { "$ref": "#/components/schemas/Message" } + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}/descendants": { + "get": { + "tags": ["messages"], + "summary": "Get Descendants", + "description": "Get a subtree which starts with this message.", + "operationId": "get_descendants_api_v1_messages__message_id__descendants_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/MessageTree" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}/longest_conversation_in_tree": { + "get": { + "tags": ["messages"], + "summary": "Get Longest Conv", + "description": "Get the longest conversation from the tree of the message.", + "operationId": "get_longest_conv_api_v1_messages__message_id__longest_conversation_in_tree_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Conversation" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/messages/{message_id}/max_children_in_tree": { + "get": { + "tags": ["messages"], + "summary": "Get Max Children", + "description": "Get message with the most children from the tree of the provided message.", + "operationId": "get_max_children_api_v1_messages__message_id__max_children_in_tree_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/MessageTree" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Message By Frontend Id", + "description": "Get a message by its frontend ID.", + "operationId": "get_message_by_frontend_id_api_v1_frontend_messages__message_id__get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Message" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}/conversation": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Conv By Frontend Id", + "description": "Get a conversation from the tree root and up to the message with given frontend ID.", + "operationId": "get_conv_by_frontend_id_api_v1_frontend_messages__message_id__conversation_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Conversation" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}/tree": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Tree By Frontend Id", + "description": "Get all messages belonging to the same message tree.\nMessage is identified by its frontend ID.", + "operationId": "get_tree_by_frontend_id_api_v1_frontend_messages__message_id__tree_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/MessageTree" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}/children": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Children By Frontend Id", + "description": "Get all messages belonging to the same message tree.", + "operationId": "get_children_by_frontend_id_api_v1_frontend_messages__message_id__children_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Get Children By Frontend Id Api V1 Frontend Messages Message Id Children Get", + "type": "array", + "items": { "$ref": "#/components/schemas/Message" } + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}/descendants": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Descendants By Frontend Id", + "description": "Get a subtree which starts with this message.\nThe message is identified by its frontend ID.", + "operationId": "get_descendants_by_frontend_id_api_v1_frontend_messages__message_id__descendants_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/MessageTree" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}/longest_conversation_in_tree": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Longest Conv By Frontend Id", + "description": "Get the longest conversation from the tree of the message.\nThe message is identified by its frontend ID.", + "operationId": "get_longest_conv_by_frontend_id_api_v1_frontend_messages__message_id__longest_conversation_in_tree_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Conversation" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_messages/{message_id}/max_children_in_tree": { + "get": { + "tags": ["frontend_messages"], + "summary": "Get Max Children By Frontend Id", + "description": "Get message with the most children from the tree of the provided message.\nThe message is identified by its frontend ID.", + "operationId": "get_max_children_by_frontend_id_api_v1_frontend_messages__message_id__max_children_in_tree_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Message Id", "type": "string" }, + "name": "message_id", + "in": "path" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/MessageTree" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/users/{user_id}/messages": { + "get": { + "tags": ["users"], + "summary": "Query User Messages", + "description": "Query user messages.", + "operationId": "query_user_messages_api_v1_users__user_id__messages_get", + "parameters": [ + { + "required": true, + "schema": { + "title": "User Id", + "type": "string", + "format": "uuid" + }, + "name": "user_id", + "in": "path" + }, + { + "required": false, + "schema": { + "title": "Api Client Id", + "type": "string", + "format": "uuid" + }, + "name": "api_client_id", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Max Count", + "maximum": 1000.0, + "exclusiveMinimum": 0.0, + "type": "integer", + "default": 10 + }, + "name": "max_count", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Start Date", + "type": "string", + "format": "date-time" + }, + "name": "start_date", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "End Date", + "type": "string", + "format": "date-time" + }, + "name": "end_date", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Only Roots", + "type": "boolean", + "default": false + }, + "name": "only_roots", + "in": "query" + }, + { + "required": false, + "schema": { "title": "Desc", "type": "boolean", "default": true }, + "name": "desc", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Include Deleted", + "type": "boolean", + "default": false + }, + "name": "include_deleted", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Query User Messages Api V1 Users User Id Messages Get", + "type": "array", + "items": { "$ref": "#/components/schemas/Message" } + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + }, + "delete": { + "tags": ["users"], + "summary": "Mark User Messages Deleted", + "operationId": "mark_user_messages_deleted_api_v1_users__user_id__messages_delete", + "parameters": [ + { + "required": true, + "schema": { + "title": "User Id", + "type": "string", + "format": "uuid" + }, + "name": "user_id", + "in": "path" + } + ], + "responses": { + "204": { "description": "Successful Response" }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_users/{auth_method}/{username}": { + "get": { + "tags": ["frontend_users"], + "summary": "Query Frontend User", + "description": "Query frontend user.", + "operationId": "query_frontend_user_api_v1_frontend_users__auth_method___username__get", + "parameters": [ + { + "required": true, + "schema": { "title": "Auth Method", "type": "string" }, + "name": "auth_method", + "in": "path" + }, + { + "required": true, + "schema": { "title": "Username", "type": "string" }, + "name": "username", + "in": "path" + }, + { + "required": false, + "schema": { + "title": "Api Client Id", + "type": "string", + "format": "uuid" + }, + "name": "api_client_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/User" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/frontend_users/{username}/messages": { + "get": { + "tags": ["frontend_users"], + "summary": "Query Frontend User Messages", + "description": "Query frontend user messages.", + "operationId": "query_frontend_user_messages_api_v1_frontend_users__username__messages_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Username", "type": "string" }, + "name": "username", + "in": "path" + }, + { + "required": false, + "schema": { + "title": "Api Client Id", + "type": "string", + "format": "uuid" + }, + "name": "api_client_id", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Max Count", + "maximum": 1000.0, + "exclusiveMinimum": 0.0, + "type": "integer", + "default": 10 + }, + "name": "max_count", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Start Date", + "type": "string", + "format": "date-time" + }, + "name": "start_date", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "End Date", + "type": "string", + "format": "date-time" + }, + "name": "end_date", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Only Roots", + "type": "boolean", + "default": false + }, + "name": "only_roots", + "in": "query" + }, + { + "required": false, + "schema": { "title": "Desc", "type": "boolean", "default": true }, + "name": "desc", + "in": "query" + }, + { + "required": false, + "schema": { + "title": "Include Deleted", + "type": "boolean", + "default": false + }, + "name": "include_deleted", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Query Frontend User Messages Api V1 Frontend Users Username Messages Get", + "type": "array", + "items": { "$ref": "#/components/schemas/Message" } + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + }, + "delete": { + "tags": ["frontend_users"], + "summary": "Mark Frontend User Messages Deleted", + "operationId": "mark_frontend_user_messages_deleted_api_v1_frontend_users__username__messages_delete", + "parameters": [ + { + "required": true, + "schema": { "title": "Username", "type": "string" }, + "name": "username", + "in": "path" + } + ], + "responses": { + "204": { "description": "Successful Response" }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/stats/": { + "get": { + "tags": ["stats"], + "summary": "Get Message Stats", + "operationId": "get_message_stats_api_v1_stats__get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/SystemStats" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/experimental/leaderboards/create/assistant": { + "get": { + "tags": ["leaderboards"], + "summary": "Get Assistant Leaderboard", + "operationId": "get_assistant_leaderboard_api_v1_experimental_leaderboards_create_assistant_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/experimental/leaderboards/create/prompter": { + "get": { + "tags": ["leaderboards"], + "summary": "Get Prompter Leaderboard", + "operationId": "get_prompter_leaderboard_api_v1_experimental_leaderboards_create_prompter_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + }, + "/api/v1/hf/text_toxicity": { + "get": { + "tags": ["hugging_face"], + "summary": "Get Text Toxicity", + "description": "Get the Message Toxicity from HuggingFace Roberta model.\n\nArgs:\n msg (str): the message that we want to analyze.\n api_client (ApiClient, optional): authentification of the user of the request.\n Defaults to Depends(deps.get_trusted_api_client).\n\nReturns:\n ToxicityClassification: the score of toxicity of the message.", + "operationId": "get_text_toxicity_api_v1_hf_text_toxicity_get", + "parameters": [ + { + "required": true, + "schema": { "title": "Msg", "type": "string" }, + "name": "msg", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "APIKeyQuery": [] }, { "APIKeyHeader": [] }] + } + } + }, + "components": { + "schemas": { + "AssistantReplyTask": { + "title": "AssistantReplyTask", + "required": ["conversation"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["assistant_reply"], + "type": "string", + "default": "assistant_reply" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" } + }, + "description": "A task to prompt the user to act as the assistant." + }, + "Conversation": { + "title": "Conversation", + "type": "object", + "properties": { + "messages": { + "title": "Messages", + "type": "array", + "items": { "$ref": "#/components/schemas/ConversationMessage" }, + "default": [] + } + }, + "description": "Represents a conversation between the prompter and the assistant." + }, + "ConversationMessage": { + "title": "ConversationMessage", + "required": ["text", "is_assistant"], + "type": "object", + "properties": { + "text": { "title": "Text", "type": "string" }, + "is_assistant": { "title": "Is Assistant", "type": "boolean" }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "frontend_message_id": { + "title": "Frontend Message Id", + "type": "string" + } + }, + "description": "Represents a message in a conversation between the user and the assistant." + }, + "HTTPValidationError": { + "title": "HTTPValidationError", + "type": "object", + "properties": { + "detail": { + "title": "Detail", + "type": "array", + "items": { "$ref": "#/components/schemas/ValidationError" } + } + } + }, + "InitialPromptTask": { + "title": "InitialPromptTask", + "type": "object", + "properties": { + "hint": { "title": "Hint", "type": "string" }, + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["initial_prompt"], + "type": "string", + "default": "initial_prompt" + } + }, + "description": "A task to prompt the user to submit an initial prompt to the assistant." + }, + "LabelAssistantReplyTask": { + "title": "LabelAssistantReplyTask", + "required": ["conversation", "message_id", "reply", "valid_labels"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["label_assistant_reply"], + "type": "string", + "default": "label_assistant_reply" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "reply": { "title": "Reply", "type": "string" }, + "valid_labels": { + "title": "Valid Labels", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to label an assistant reply to a conversation." + }, + "LabelConversationReplyTask": { + "title": "LabelConversationReplyTask", + "required": ["conversation", "message_id", "reply", "valid_labels"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["label_conversation_reply"], + "type": "string", + "default": "label_conversation_reply" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "reply": { "title": "Reply", "type": "string" }, + "valid_labels": { + "title": "Valid Labels", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to label a reply to a conversation." + }, + "LabelInitialPromptTask": { + "title": "LabelInitialPromptTask", + "required": ["message_id", "prompt", "valid_labels"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["label_initial_prompt"], + "type": "string", + "default": "label_initial_prompt" + }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "prompt": { "title": "Prompt", "type": "string" }, + "valid_labels": { + "title": "Valid Labels", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to label an initial prompt." + }, + "LabelPrompterReplyTask": { + "title": "LabelPrompterReplyTask", + "required": ["conversation", "message_id", "reply", "valid_labels"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["label_prompter_reply"], + "type": "string", + "default": "label_prompter_reply" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "reply": { "title": "Reply", "type": "string" }, + "valid_labels": { + "title": "Valid Labels", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to label a prompter reply to a conversation." + }, + "Message": { + "title": "Message", + "required": ["text", "is_assistant", "id"], + "type": "object", + "properties": { + "text": { "title": "Text", "type": "string" }, + "is_assistant": { "title": "Is Assistant", "type": "boolean" }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + }, + "frontend_message_id": { + "title": "Frontend Message Id", + "type": "string" + }, + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "parent_id": { + "title": "Parent Id", + "type": "string", + "format": "uuid" + }, + "created_date": { + "title": "Created Date", + "type": "string", + "format": "date-time" + } + }, + "description": "Represents a message in a conversation between the user and the assistant." + }, + "MessageRanking": { + "title": "MessageRanking", + "required": ["user", "message_id", "ranking"], + "type": "object", + "properties": { + "type": { + "title": "Type", + "enum": ["message_ranking"], + "type": "string", + "default": "message_ranking" + }, + "user": { "$ref": "#/components/schemas/User" }, + "message_id": { "title": "Message Id", "type": "string" }, + "ranking": { + "title": "Ranking", + "minItems": 1, + "type": "array", + "items": { "type": "integer" } + } + }, + "description": "A user has given a ranking for a message." + }, + "MessageRating": { + "title": "MessageRating", + "required": ["user", "message_id", "rating"], + "type": "object", + "properties": { + "type": { + "title": "Type", + "enum": ["message_rating"], + "type": "string", + "default": "message_rating" + }, + "user": { "$ref": "#/components/schemas/User" }, + "message_id": { "title": "Message Id", "type": "string" }, + "rating": { + "title": "Rating", + "exclusiveMinimum": 0.0, + "type": "integer" + } + }, + "description": "A user has rated a message." + }, + "MessageTree": { + "title": "MessageTree", + "required": ["id"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "messages": { + "title": "Messages", + "type": "array", + "items": { "$ref": "#/components/schemas/Message" }, + "default": [] + } + }, + "description": "All messages belonging to the same message tree." + }, + "PrompterReplyTask": { + "title": "PrompterReplyTask", + "required": ["conversation"], + "type": "object", + "properties": { + "hint": { "title": "Hint", "type": "string" }, + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["prompter_reply"], + "type": "string", + "default": "prompter_reply" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" } + }, + "description": "A task to prompt the user to submit a reply to the assistant." + }, + "RankAssistantRepliesTask": { + "title": "RankAssistantRepliesTask", + "required": ["conversation", "replies"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["rank_assistant_replies"], + "type": "string", + "default": "rank_assistant_replies" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" }, + "replies": { + "title": "Replies", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to rank a set of assistant replies to a conversation." + }, + "RankConversationRepliesTask": { + "title": "RankConversationRepliesTask", + "required": ["conversation", "replies"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["rank_conversation_replies"], + "type": "string", + "default": "rank_conversation_replies" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" }, + "replies": { + "title": "Replies", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to rank a set of replies to a conversation." + }, + "RankInitialPromptsTask": { + "title": "RankInitialPromptsTask", + "required": ["prompts"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["rank_initial_prompts"], + "type": "string", + "default": "rank_initial_prompts" + }, + "prompts": { + "title": "Prompts", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to rank a set of initial prompts." + }, + "RankPrompterRepliesTask": { + "title": "RankPrompterRepliesTask", + "required": ["conversation", "replies"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["rank_prompter_replies"], + "type": "string", + "default": "rank_prompter_replies" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" }, + "replies": { + "title": "Replies", + "type": "array", + "items": { "type": "string" } + } + }, + "description": "A task to rank a set of prompter replies to a conversation." + }, + "RateSummaryTask": { + "title": "RateSummaryTask", + "required": ["full_text", "summary"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["rate_summary"], + "type": "string", + "default": "rate_summary" + }, + "scale": { + "title": "Scale", + "allOf": [{ "$ref": "#/components/schemas/RatingScale" }], + "default": { "min": 1, "max": 5 } + }, + "full_text": { "title": "Full Text", "type": "string" }, + "summary": { "title": "Summary", "type": "string" } + }, + "description": "A task to rate a summary." + }, + "RatingScale": { + "title": "RatingScale", + "required": ["min", "max"], + "type": "object", + "properties": { + "min": { "title": "Min", "type": "integer" }, + "max": { "title": "Max", "type": "integer" } + } + }, + "ReplyToConversationTask": { + "title": "ReplyToConversationTask", + "required": ["conversation"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["reply_to_conversation"], + "type": "string", + "default": "reply_to_conversation" + }, + "conversation": { "$ref": "#/components/schemas/Conversation" } + }, + "description": "A task to prompt the user to submit a reply to a conversation." + }, + "SummarizeStoryTask": { + "title": "SummarizeStoryTask", + "required": ["story"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["summarize_story"], + "type": "string", + "default": "summarize_story" + }, + "story": { "title": "Story", "type": "string" } + }, + "description": "A task to summarize a story." + }, + "SystemStats": { + "title": "SystemStats", + "type": "object", + "properties": { + "all": { "title": "All", "type": "integer", "default": 0 }, + "active": { "title": "Active", "type": "integer", "default": 0 }, + "deleted": { "title": "Deleted", "type": "integer", "default": 0 }, + "message_trees": { + "title": "Message Trees", + "type": "integer", + "default": 0 + } + } + }, + "TaskAck": { + "title": "TaskAck", + "required": ["message_id"], + "type": "object", + "properties": { + "message_id": { "title": "Message Id", "type": "string" } + }, + "description": "The frontend acknowledges that it has received a task and created a message." + }, + "TaskClose": { + "title": "TaskClose", + "required": ["message_id"], + "type": "object", + "properties": { + "message_id": { "title": "Message Id", "type": "string" } + }, + "description": "The frontend asks to mark task as done" + }, + "TaskDone": { + "title": "TaskDone", + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "type": { + "title": "Type", + "enum": ["task_done"], + "type": "string", + "default": "task_done" + } + }, + "description": "Signals to the frontend that the task is done." + }, + "TaskNAck": { + "title": "TaskNAck", + "required": ["reason"], + "type": "object", + "properties": { "reason": { "title": "Reason", "type": "string" } }, + "description": "The frontend acknowledges that it has received a task but cannot create a message." + }, + "TaskRequest": { + "title": "TaskRequest", + "type": "object", + "properties": { + "type": { + "allOf": [{ "$ref": "#/components/schemas/TaskRequestType" }], + "default": "random" + }, + "user": { + "title": "User", + "allOf": [{ "$ref": "#/components/schemas/User" }], + "nullable": true + }, + "collective": { + "title": "Collective", + "type": "boolean", + "default": false + } + }, + "description": "The frontend asks the backend for a task." + }, + "TaskRequestType": { + "title": "TaskRequestType", + "enum": [ + "random", + "summarize_story", + "rate_summary", + "initial_prompt", + "prompter_reply", + "assistant_reply", + "rank_initial_prompts", + "rank_prompter_replies", + "rank_assistant_replies", + "label_initial_prompt", + "label_assistant_reply", + "label_prompter_reply" + ], + "type": "string", + "description": "An enumeration." + }, + "TextLabels": { + "title": "TextLabels", + "required": ["user", "text", "labels", "message_id"], + "type": "object", + "properties": { + "type": { + "title": "Type", + "enum": ["text_labels"], + "type": "string", + "default": "text_labels" + }, + "user": { "$ref": "#/components/schemas/User" }, + "text": { "title": "Text", "type": "string" }, + "labels": { + "title": "Labels", + "type": "object", + "additionalProperties": { "type": "number" } + }, + "message_id": { + "title": "Message Id", + "type": "string", + "format": "uuid" + } + }, + "description": "A set of labels for a piece of text." + }, + "TextReplyToMessage": { + "title": "TextReplyToMessage", + "required": ["user", "message_id", "user_message_id", "text"], + "type": "object", + "properties": { + "type": { + "title": "Type", + "enum": ["text_reply_to_message"], + "type": "string", + "default": "text_reply_to_message" + }, + "user": { "$ref": "#/components/schemas/User" }, + "message_id": { "title": "Message Id", "type": "string" }, + "user_message_id": { "title": "User Message Id", "type": "string" }, + "text": { "title": "Text", "minLength": 1, "type": "string" } + }, + "description": "A user has replied to a message with text." + }, + "User": { + "title": "User", + "required": ["id", "display_name", "auth_method"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string" }, + "display_name": { "title": "Display Name", "type": "string" }, + "auth_method": { + "title": "Auth Method", + "enum": ["discord", "local"], + "type": "string" + } + } + }, + "ValidationError": { + "title": "ValidationError", + "required": ["loc", "msg", "type"], + "type": "object", + "properties": { + "loc": { + "title": "Location", + "type": "array", + "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] } + }, + "msg": { "title": "Message", "type": "string" }, + "type": { "title": "Error Type", "type": "string" } + } + } + }, + "securitySchemes": { + "APIKeyQuery": { "type": "apiKey", "in": "query", "name": "api_key" }, + "APIKeyHeader": { "type": "apiKey", "in": "header", "name": "X-API-Key" } + } + } +} diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 4e456369..dfd2c6e5 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -62,7 +62,11 @@ const config = { position: "left", label: "Docs", }, - //{ to: "/blog", label: "Blog", position: "left" }, + { + href: "https://editor.swagger.io/?url=https://raw.githubusercontent.com/LAION-AI/Open-Assistant/main/docs/docs/api/openapi.json", + label: "API", + position: "left", + }, { href: "https://github.com/LAION-AI/Open-Assistant", label: "GitHub",