diff --git a/website/static/openapi.json b/website/static/openapi.json index e69de29bb2d1..5f7029d25e74 100644 --- a/website/static/openapi.json +++ b/website/static/openapi.json @@ -0,0 +1,553 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Tabby Server", + "description": "\n[![tabby stars](https://img.shields.io/github/stars/TabbyML/tabby)](https://github.com/TabbyML/tabby)\n[![Join Slack](https://shields.io/badge/Join-Tabby%20Slack-red?logo=slack)](https://links.tabbyml.com/join-slack)\n\nInstall following IDE / Editor extensions to get started with [Tabby](https://github.com/TabbyML/tabby).\n* [VSCode Extension](https://github.com/TabbyML/tabby/tree/main/clients/vscode) – Install from the [marketplace](https://marketplace.visualstudio.com/items?itemName=TabbyML.vscode-tabby), or [open-vsx.org](https://open-vsx.org/extension/TabbyML/vscode-tabby)\n* [VIM Extension](https://github.com/TabbyML/tabby/tree/main/clients/vim)\n* [IntelliJ Platform Plugin](https://github.com/TabbyML/tabby/tree/main/clients/intellij) – Install from the [marketplace](https://plugins.jetbrains.com/plugin/22379-tabby)\n", + "license": { + "name": "Apache 2.0", + "url": "https://github.com/TabbyML/tabby/blob/main/LICENSE" + }, + "version": "0.8.3" + }, + "servers": [ + { + "url": "https://playground.app.tabbyml.com", + "description": "Playground server" + } + ], + "paths": { + "/v1/completions": { + "post": { + "tags": [ + "v1" + ], + "operationId": "completion", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CompletionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CompletionResponse" + } + } + } + }, + "400": { + "description": "Bad Request" + } + }, + "security": [ + { + "token": [] + } + ] + } + }, + "/v1/events": { + "post": { + "tags": [ + "v1" + ], + "operationId": "event", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LogEventRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success" + }, + "400": { + "description": "Bad Request" + } + }, + "security": [ + { + "token": [] + } + ] + } + }, + "/v1/health": { + "get": { + "tags": [ + "v1" + ], + "operationId": "health", + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HealthState" + } + } + } + } + }, + "security": [ + { + "token": [] + } + ] + } + } + }, + "components": { + "schemas": { + "ChatCompletionChoice": { + "type": "object", + "required": [ + "index", + "delta" + ], + "properties": { + "index": { + "type": "integer", + "minimum": 0 + }, + "logprobs": { + "type": "string", + "nullable": true + }, + "finish_reason": { + "type": "string", + "nullable": true + }, + "delta": { + "$ref": "#/components/schemas/ChatCompletionDelta" + } + } + }, + "ChatCompletionChunk": { + "type": "object", + "required": [ + "id", + "created", + "system_fingerprint", + "object", + "model", + "choices" + ], + "properties": { + "id": { + "type": "string" + }, + "created": { + "type": "integer", + "format": "int64", + "minimum": 0 + }, + "system_fingerprint": { + "type": "string" + }, + "object": { + "type": "string" + }, + "model": { + "type": "string" + }, + "choices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionChoice" + } + } + } + }, + "ChatCompletionDelta": { + "type": "object", + "required": [ + "content" + ], + "properties": { + "content": { + "type": "string" + } + } + }, + "ChatCompletionRequest": { + "type": "object", + "required": [ + "messages" + ], + "properties": { + "messages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Message" + } + }, + "temperature": { + "type": "number", + "format": "float", + "nullable": true + }, + "seed": { + "type": "integer", + "format": "int64", + "nullable": true, + "minimum": 0 + } + }, + "example": { + "messages": [ + { + "role": "user", + "content": "What is tail recursion?" + }, + { + "role": "assistant", + "content": "It's a kind of optimization in compiler?" + }, + { + "role": "user", + "content": "Could you share more details?" + } + ] + } + }, + "Choice": { + "type": "object", + "required": [ + "index", + "text" + ], + "properties": { + "index": { + "type": "integer", + "format": "int32", + "minimum": 0 + }, + "text": { + "type": "string" + } + } + }, + "CompletionRequest": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "Language identifier, full list is maintained at\nhttps://code.visualstudio.com/docs/languages/identifiers", + "example": "python", + "nullable": true + }, + "segments": { + "allOf": [ + { + "$ref": "#/components/schemas/Segments" + } + ], + "nullable": true + }, + "user": { + "type": "string", + "description": "A unique identifier representing your end-user, which can help Tabby to monitor & generating\nreports.", + "nullable": true + }, + "temperature": { + "type": "number", + "format": "float", + "description": "The temperature parameter for the model, used to tune variance and \"creativity\" of the model output", + "nullable": true + }, + "seed": { + "type": "integer", + "format": "int64", + "description": "The seed used for randomly selecting tokens", + "nullable": true, + "minimum": 0 + } + }, + "example": { + "language": "python", + "segments": { + "prefix": "def fib(n):\n ", + "suffix": "\n return fib(n - 1) + fib(n - 2)" + } + } + }, + "CompletionResponse": { + "type": "object", + "required": [ + "id", + "choices" + ], + "properties": { + "id": { + "type": "string" + }, + "choices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Choice" + } + } + }, + "example": { + "id": "string", + "choices": [ + { + "index": 0, + "text": "string" + } + ] + } + }, + "HealthState": { + "type": "object", + "required": [ + "device", + "arch", + "cpu_info", + "cpu_count", + "cuda_devices", + "version" + ], + "properties": { + "model": { + "type": "string", + "nullable": true + }, + "chat_model": { + "type": "string", + "nullable": true + }, + "device": { + "type": "string" + }, + "arch": { + "type": "string" + }, + "cpu_info": { + "type": "string" + }, + "cpu_count": { + "type": "integer", + "minimum": 0 + }, + "cuda_devices": { + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "$ref": "#/components/schemas/Version" + } + } + }, + "Hit": { + "type": "object", + "required": [ + "score", + "doc", + "id" + ], + "properties": { + "score": { + "type": "number", + "format": "float" + }, + "doc": { + "$ref": "#/components/schemas/HitDocument" + }, + "id": { + "type": "integer", + "format": "int32", + "minimum": 0 + } + } + }, + "HitDocument": { + "type": "object", + "required": [ + "body", + "filepath", + "git_url", + "kind", + "language", + "name" + ], + "properties": { + "body": { + "type": "string" + }, + "filepath": { + "type": "string" + }, + "git_url": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "language": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "LogEventRequest": { + "type": "object", + "required": [ + "type", + "completion_id", + "choice_index" + ], + "properties": { + "type": { + "type": "string", + "description": "Event type, should be `view`, `select` or `dismiss`.", + "example": "view" + }, + "completion_id": { + "type": "string" + }, + "choice_index": { + "type": "integer", + "format": "int32", + "minimum": 0 + }, + "view_id": { + "type": "string", + "nullable": true + }, + "elapsed": { + "type": "integer", + "format": "int32", + "nullable": true, + "minimum": 0 + } + } + }, + "Message": { + "type": "object", + "required": [ + "role", + "content" + ], + "properties": { + "role": { + "type": "string" + }, + "content": { + "type": "string" + } + } + }, + "SearchResponse": { + "type": "object", + "required": [ + "num_hits", + "hits" + ], + "properties": { + "num_hits": { + "type": "integer", + "minimum": 0 + }, + "hits": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Hit" + } + } + } + }, + "Segments": { + "type": "object", + "required": [ + "prefix" + ], + "properties": { + "prefix": { + "type": "string", + "description": "Content that appears before the cursor in the editor window." + }, + "suffix": { + "type": "string", + "description": "Content that appears after the cursor in the editor window.", + "nullable": true + }, + "clipboard": { + "type": "string", + "description": "Clipboard content when requesting code completion.", + "nullable": true + } + } + }, + "Snippet": { + "type": "object", + "required": [ + "filepath", + "body", + "score" + ], + "properties": { + "filepath": { + "type": "string" + }, + "body": { + "type": "string" + }, + "score": { + "type": "number", + "format": "float" + } + } + }, + "Version": { + "type": "object", + "required": [ + "build_date", + "build_timestamp", + "git_sha", + "git_describe" + ], + "properties": { + "build_date": { + "type": "string" + }, + "build_timestamp": { + "type": "string" + }, + "git_sha": { + "type": "string" + }, + "git_describe": { + "type": "string" + } + } + } + }, + "securitySchemes": { + "token": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "token" + } + } + } +}