diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index e20de6f..7e4d923 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -7,6 +7,7 @@ on:
paths-ignore:
- '**/README.md'
- '.github/**'
+ - 'docs/**'
pull_request:
branches: [ "main" ]
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..f582d3c
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+ Text Generation Inference API
+
+
+
+
+
+
diff --git a/docs/openapi.json b/docs/openapi.json
new file mode 100644
index 0000000..f9db04e
--- /dev/null
+++ b/docs/openapi.json
@@ -0,0 +1,186 @@
+{
+ "openapi": "3.0.2",
+ "info": {
+ "title": "TabbyServer",
+ "description": "TabbyServer is the backend for tabby, serving code completion requests from code editor / IDE.\n*",
+ "version": "0.1.0"
+ },
+ "paths": {
+ "/v1/completions": {
+ "post": {
+ "summary": "Completions",
+ "operationId": "completions_v1_completions_post",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/CompletionRequest" }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/CompletionResponse" }
+ }
+ }
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/v1/events": {
+ "post": {
+ "summary": "Events",
+ "operationId": "events_v1_events_post",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "title": "E",
+ "anyOf": [
+ { "$ref": "#/components/schemas/ChoiceEvent" },
+ { "$ref": "#/components/schemas/CompletionEvent" }
+ ]
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": { "application/json": { "schema": {} } }
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Choice": {
+ "title": "Choice",
+ "required": ["index", "text"],
+ "type": "object",
+ "properties": {
+ "index": { "title": "Index", "type": "integer" },
+ "text": { "title": "Text", "type": "string" }
+ }
+ },
+ "ChoiceEvent": {
+ "title": "ChoiceEvent",
+ "required": ["type", "completion_id", "choice_index"],
+ "type": "object",
+ "properties": {
+ "type": { "$ref": "#/components/schemas/EventType" },
+ "completion_id": { "title": "Completion Id", "type": "string" },
+ "choice_index": { "title": "Choice Index", "type": "integer" }
+ }
+ },
+ "CompletionEvent": {
+ "title": "CompletionEvent",
+ "required": ["type", "id", "language", "prompt", "created", "choices"],
+ "type": "object",
+ "properties": {
+ "type": { "$ref": "#/components/schemas/EventType" },
+ "id": { "title": "Id", "type": "string" },
+ "language": { "$ref": "#/components/schemas/Language" },
+ "prompt": { "title": "Prompt", "type": "string" },
+ "created": { "title": "Created", "type": "integer" },
+ "choices": {
+ "title": "Choices",
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/Choice" }
+ }
+ }
+ },
+ "CompletionRequest": {
+ "title": "CompletionRequest",
+ "required": ["prompt"],
+ "type": "object",
+ "properties": {
+ "language": {
+ "allOf": [{ "$ref": "#/components/schemas/Language" }],
+ "description": "Language for completion request",
+ "default": "unknown",
+ "example": "python"
+ },
+ "prompt": {
+ "title": "Prompt",
+ "type": "string",
+ "description": "The context to generate completions for, encoded as a string.",
+ "example": "def binarySearch(arr, left, right, x):\n mid = (left +"
+ }
+ }
+ },
+ "CompletionResponse": {
+ "title": "CompletionResponse",
+ "required": ["id", "created", "choices"],
+ "type": "object",
+ "properties": {
+ "id": { "title": "Id", "type": "string" },
+ "created": { "title": "Created", "type": "integer" },
+ "choices": {
+ "title": "Choices",
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/Choice" }
+ }
+ }
+ },
+ "EventType": {
+ "title": "EventType",
+ "enum": ["completion", "view", "select"],
+ "type": "string",
+ "description": "An enumeration."
+ },
+ "HTTPValidationError": {
+ "title": "HTTPValidationError",
+ "type": "object",
+ "properties": {
+ "detail": {
+ "title": "Detail",
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/ValidationError" }
+ }
+ }
+ },
+ "Language": {
+ "title": "Language",
+ "enum": ["unknown", "python", "javascript"],
+ "type": "string",
+ "description": "An enumeration."
+ },
+ "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" }
+ }
+ }
+ }
+ }
+}