tabby/docs/openapi.json

187 lines
5.6 KiB
JSON
Raw Normal View History

2023-04-06 10:48:26 +00:00
{
"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" }
}
}
}
}
}