feat(swagger): update swagger (#2908)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mudler <2420543+mudler@users.noreply.github.com>
This commit is contained in:
LocalAI [bot] 2024-07-18 13:42:45 +02:00 committed by GitHub
parent 96f67efe32
commit 919e2e4369
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 864 additions and 83 deletions

View File

@ -51,6 +51,64 @@ const docTemplate = `{
}
}
},
"/backend/monitor": {
"get": {
"summary": "Backend monitor endpoint",
"parameters": [
{
"description": "Backend statistics request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.BackendMonitorRequest"
}
}
],
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/proto.StatusResponse"
}
}
}
}
},
"/backend/shutdown": {
"post": {
"summary": "Backend monitor endpoint",
"parameters": [
{
"description": "Backend statistics request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.BackendMonitorRequest"
}
}
],
"responses": {}
}
},
"/metrics": {
"get": {
"summary": "Prometheus metrics endpoint",
"parameters": [
{
"description": "Gallery details",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/config.Gallery"
}
}
],
"responses": {}
}
},
"/models/apply": {
"post": {
"summary": "Install models to LocalAI.",
@ -179,6 +237,35 @@ const docTemplate = `{
}
}
},
"/models/jobs": {
"get": {
"summary": "Returns all the jobs status progress",
"responses": {
"200": {
"description": "Response",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/gallery.GalleryOpStatus"
}
}
}
}
}
},
"/models/jobs/{uuid}": {
"get": {
"summary": "Returns the job status",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/gallery.GalleryOpStatus"
}
}
}
}
},
"/tts": {
"post": {
"consumes": [
@ -210,6 +297,46 @@ const docTemplate = `{
}
},
"/v1/assistants": {
"get": {
"summary": "List available assistents",
"parameters": [
{
"type": "integer",
"description": "Limit the number of assistants returned",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "Order of assistants returned",
"name": "order",
"in": "query"
},
{
"type": "string",
"description": "Return assistants created after the given ID",
"name": "after",
"in": "query"
},
{
"type": "string",
"description": "Return assistants created before the given ID",
"name": "before",
"in": "query"
}
],
"responses": {
"200": {
"description": "Response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/openai.Assistant"
}
}
}
}
},
"post": {
"summary": "Create an assistant with a model and instructions.",
"parameters": [
@ -233,6 +360,30 @@ const docTemplate = `{
}
}
},
"/v1/assistants/{assistant_id}": {
"get": {
"summary": "Get assistent data",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/openai.Assistant"
}
}
}
},
"delete": {
"summary": "Delete assistents",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/schema.DeleteAssistantResponse"
}
}
}
}
},
"/v1/audio/speech": {
"post": {
"consumes": [
@ -346,6 +497,30 @@ const docTemplate = `{
}
}
},
"/v1/edits": {
"post": {
"summary": "OpenAI edit endpoint",
"parameters": [
{
"description": "query params",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.OpenAIRequest"
}
}
],
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/schema.OpenAIResponse"
}
}
}
}
},
"/v1/embeddings": {
"post": {
"summary": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.",
@ -370,6 +545,19 @@ const docTemplate = `{
}
}
},
"/v1/files": {
"get": {
"summary": "List files.",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/schema.ListFiles"
}
}
}
}
},
"/v1/files/{file_id}": {
"get": {
"summary": "Returns information about a specific file.",
@ -377,7 +565,7 @@ const docTemplate = `{
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/openai.File"
"$ref": "#/definitions/schema.File"
}
}
}
@ -719,6 +907,37 @@ const docTemplate = `{
}
}
},
"gallery.GalleryOpStatus": {
"type": "object",
"properties": {
"deletion": {
"description": "Deletion is true if the operation is a deletion",
"type": "boolean"
},
"downloaded_size": {
"type": "string"
},
"error": {},
"file_name": {
"type": "string"
},
"file_size": {
"type": "string"
},
"gallery_model_name": {
"type": "string"
},
"message": {
"type": "string"
},
"processed": {
"type": "boolean"
},
"progress": {
"type": "number"
}
}
},
"localai.GalleryModel": {
"type": "object",
"properties": {
@ -889,35 +1108,6 @@ const docTemplate = `{
}
}
},
"openai.File": {
"type": "object",
"properties": {
"bytes": {
"description": "Size of the file in bytes",
"type": "integer"
},
"created_at": {
"description": "The time at which the file was created",
"type": "string"
},
"filename": {
"description": "The name of the file",
"type": "string"
},
"id": {
"description": "Unique identifier for the file",
"type": "string"
},
"object": {
"description": "Type of the object (e.g., \"file\")",
"type": "string"
},
"purpose": {
"description": "The purpose of the file (e.g., \"fine-tune\", \"classifications\", etc.)",
"type": "string"
}
}
},
"openai.Tool": {
"type": "object",
"properties": {
@ -956,6 +1146,54 @@ const docTemplate = `{
}
}
},
"proto.MemoryUsageData": {
"type": "object",
"properties": {
"breakdown": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"total": {
"type": "integer"
}
}
},
"proto.StatusResponse": {
"type": "object",
"properties": {
"memory": {
"$ref": "#/definitions/proto.MemoryUsageData"
},
"state": {
"$ref": "#/definitions/proto.StatusResponse_State"
}
}
},
"proto.StatusResponse_State": {
"type": "integer",
"enum": [
0,
1,
2,
-1
],
"x-enum-varnames": [
"StatusResponse_UNINITIALIZED",
"StatusResponse_BUSY",
"StatusResponse_READY",
"StatusResponse_ERROR"
]
},
"schema.BackendMonitorRequest": {
"type": "object",
"properties": {
"model": {
"type": "string"
}
}
},
"schema.Choice": {
"type": "object",
"properties": {
@ -976,6 +1214,49 @@ const docTemplate = `{
}
}
},
"schema.DeleteAssistantResponse": {
"type": "object",
"properties": {
"deleted": {
"type": "boolean"
},
"id": {
"type": "string"
},
"object": {
"type": "string"
}
}
},
"schema.File": {
"type": "object",
"properties": {
"bytes": {
"description": "Size of the file in bytes",
"type": "integer"
},
"created_at": {
"description": "The time at which the file was created",
"type": "string"
},
"filename": {
"description": "The name of the file",
"type": "string"
},
"id": {
"description": "Unique identifier for the file",
"type": "string"
},
"object": {
"description": "Type of the object (e.g., \"file\")",
"type": "string"
},
"purpose": {
"description": "The purpose of the file (e.g., \"fine-tune\", \"classifications\", etc.)",
"type": "string"
}
}
},
"schema.FunctionCall": {
"type": "object",
"properties": {
@ -1092,6 +1373,20 @@ const docTemplate = `{
}
}
},
"schema.ListFiles": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.File"
}
},
"object": {
"type": "string"
}
}
},
"schema.Message": {
"type": "object",
"properties": {

View File

@ -44,6 +44,64 @@
}
}
},
"/backend/monitor": {
"get": {
"summary": "Backend monitor endpoint",
"parameters": [
{
"description": "Backend statistics request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.BackendMonitorRequest"
}
}
],
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/proto.StatusResponse"
}
}
}
}
},
"/backend/shutdown": {
"post": {
"summary": "Backend monitor endpoint",
"parameters": [
{
"description": "Backend statistics request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.BackendMonitorRequest"
}
}
],
"responses": {}
}
},
"/metrics": {
"get": {
"summary": "Prometheus metrics endpoint",
"parameters": [
{
"description": "Gallery details",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/config.Gallery"
}
}
],
"responses": {}
}
},
"/models/apply": {
"post": {
"summary": "Install models to LocalAI.",
@ -172,6 +230,35 @@
}
}
},
"/models/jobs": {
"get": {
"summary": "Returns all the jobs status progress",
"responses": {
"200": {
"description": "Response",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/gallery.GalleryOpStatus"
}
}
}
}
}
},
"/models/jobs/{uuid}": {
"get": {
"summary": "Returns the job status",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/gallery.GalleryOpStatus"
}
}
}
}
},
"/tts": {
"post": {
"consumes": [
@ -203,6 +290,46 @@
}
},
"/v1/assistants": {
"get": {
"summary": "List available assistents",
"parameters": [
{
"type": "integer",
"description": "Limit the number of assistants returned",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "Order of assistants returned",
"name": "order",
"in": "query"
},
{
"type": "string",
"description": "Return assistants created after the given ID",
"name": "after",
"in": "query"
},
{
"type": "string",
"description": "Return assistants created before the given ID",
"name": "before",
"in": "query"
}
],
"responses": {
"200": {
"description": "Response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/openai.Assistant"
}
}
}
}
},
"post": {
"summary": "Create an assistant with a model and instructions.",
"parameters": [
@ -226,6 +353,30 @@
}
}
},
"/v1/assistants/{assistant_id}": {
"get": {
"summary": "Get assistent data",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/openai.Assistant"
}
}
}
},
"delete": {
"summary": "Delete assistents",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/schema.DeleteAssistantResponse"
}
}
}
}
},
"/v1/audio/speech": {
"post": {
"consumes": [
@ -339,6 +490,30 @@
}
}
},
"/v1/edits": {
"post": {
"summary": "OpenAI edit endpoint",
"parameters": [
{
"description": "query params",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.OpenAIRequest"
}
}
],
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/schema.OpenAIResponse"
}
}
}
}
},
"/v1/embeddings": {
"post": {
"summary": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.",
@ -363,6 +538,19 @@
}
}
},
"/v1/files": {
"get": {
"summary": "List files.",
"responses": {
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/schema.ListFiles"
}
}
}
}
},
"/v1/files/{file_id}": {
"get": {
"summary": "Returns information about a specific file.",
@ -370,7 +558,7 @@
"200": {
"description": "Response",
"schema": {
"$ref": "#/definitions/openai.File"
"$ref": "#/definitions/schema.File"
}
}
}
@ -712,6 +900,37 @@
}
}
},
"gallery.GalleryOpStatus": {
"type": "object",
"properties": {
"deletion": {
"description": "Deletion is true if the operation is a deletion",
"type": "boolean"
},
"downloaded_size": {
"type": "string"
},
"error": {},
"file_name": {
"type": "string"
},
"file_size": {
"type": "string"
},
"gallery_model_name": {
"type": "string"
},
"message": {
"type": "string"
},
"processed": {
"type": "boolean"
},
"progress": {
"type": "number"
}
}
},
"localai.GalleryModel": {
"type": "object",
"properties": {
@ -882,35 +1101,6 @@
}
}
},
"openai.File": {
"type": "object",
"properties": {
"bytes": {
"description": "Size of the file in bytes",
"type": "integer"
},
"created_at": {
"description": "The time at which the file was created",
"type": "string"
},
"filename": {
"description": "The name of the file",
"type": "string"
},
"id": {
"description": "Unique identifier for the file",
"type": "string"
},
"object": {
"description": "Type of the object (e.g., \"file\")",
"type": "string"
},
"purpose": {
"description": "The purpose of the file (e.g., \"fine-tune\", \"classifications\", etc.)",
"type": "string"
}
}
},
"openai.Tool": {
"type": "object",
"properties": {
@ -949,6 +1139,54 @@
}
}
},
"proto.MemoryUsageData": {
"type": "object",
"properties": {
"breakdown": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"total": {
"type": "integer"
}
}
},
"proto.StatusResponse": {
"type": "object",
"properties": {
"memory": {
"$ref": "#/definitions/proto.MemoryUsageData"
},
"state": {
"$ref": "#/definitions/proto.StatusResponse_State"
}
}
},
"proto.StatusResponse_State": {
"type": "integer",
"enum": [
0,
1,
2,
-1
],
"x-enum-varnames": [
"StatusResponse_UNINITIALIZED",
"StatusResponse_BUSY",
"StatusResponse_READY",
"StatusResponse_ERROR"
]
},
"schema.BackendMonitorRequest": {
"type": "object",
"properties": {
"model": {
"type": "string"
}
}
},
"schema.Choice": {
"type": "object",
"properties": {
@ -969,6 +1207,49 @@
}
}
},
"schema.DeleteAssistantResponse": {
"type": "object",
"properties": {
"deleted": {
"type": "boolean"
},
"id": {
"type": "string"
},
"object": {
"type": "string"
}
}
},
"schema.File": {
"type": "object",
"properties": {
"bytes": {
"description": "Size of the file in bytes",
"type": "integer"
},
"created_at": {
"description": "The time at which the file was created",
"type": "string"
},
"filename": {
"description": "The name of the file",
"type": "string"
},
"id": {
"description": "Unique identifier for the file",
"type": "string"
},
"object": {
"description": "Type of the object (e.g., \"file\")",
"type": "string"
},
"purpose": {
"description": "The purpose of the file (e.g., \"fine-tune\", \"classifications\", etc.)",
"type": "string"
}
}
},
"schema.FunctionCall": {
"type": "object",
"properties": {
@ -1085,6 +1366,20 @@
}
}
},
"schema.ListFiles": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.File"
}
},
"object": {
"type": "string"
}
}
},
"schema.Message": {
"type": "object",
"properties": {

View File

@ -145,6 +145,27 @@ definitions:
type: string
type: array
type: object
gallery.GalleryOpStatus:
properties:
deletion:
description: Deletion is true if the operation is a deletion
type: boolean
downloaded_size:
type: string
error: {}
file_name:
type: string
file_size:
type: string
gallery_model_name:
type: string
message:
type: string
processed:
type: boolean
progress:
type: number
type: object
localai.GalleryModel:
properties:
config_file:
@ -263,28 +284,6 @@ definitions:
object:
type: string
type: object
openai.File:
properties:
bytes:
description: Size of the file in bytes
type: integer
created_at:
description: The time at which the file was created
type: string
filename:
description: The name of the file
type: string
id:
description: Unique identifier for the file
type: string
object:
description: Type of the object (e.g., "file")
type: string
purpose:
description: The purpose of the file (e.g., "fine-tune", "classifications",
etc.)
type: string
type: object
openai.Tool:
properties:
type:
@ -311,6 +310,39 @@ definitions:
tunnelAddress:
type: string
type: object
proto.MemoryUsageData:
properties:
breakdown:
additionalProperties:
type: integer
type: object
total:
type: integer
type: object
proto.StatusResponse:
properties:
memory:
$ref: '#/definitions/proto.MemoryUsageData'
state:
$ref: '#/definitions/proto.StatusResponse_State'
type: object
proto.StatusResponse_State:
enum:
- 0
- 1
- 2
- -1
type: integer
x-enum-varnames:
- StatusResponse_UNINITIALIZED
- StatusResponse_BUSY
- StatusResponse_READY
- StatusResponse_ERROR
schema.BackendMonitorRequest:
properties:
model:
type: string
type: object
schema.Choice:
properties:
delta:
@ -324,6 +356,37 @@ definitions:
text:
type: string
type: object
schema.DeleteAssistantResponse:
properties:
deleted:
type: boolean
id:
type: string
object:
type: string
type: object
schema.File:
properties:
bytes:
description: Size of the file in bytes
type: integer
created_at:
description: The time at which the file was created
type: string
filename:
description: The name of the file
type: string
id:
description: Unique identifier for the file
type: string
object:
description: Type of the object (e.g., "file")
type: string
purpose:
description: The purpose of the file (e.g., "fine-tune", "classifications",
etc.)
type: string
type: object
schema.FunctionCall:
properties:
arguments:
@ -399,6 +462,15 @@ definitions:
total_tokens:
type: integer
type: object
schema.ListFiles:
properties:
data:
items:
$ref: '#/definitions/schema.File'
type: array
object:
type: string
type: object
schema.Message:
properties:
content:
@ -656,6 +728,43 @@ paths:
schema:
type: string
summary: Show the P2P token
/backend/monitor:
get:
parameters:
- description: Backend statistics request
in: body
name: request
required: true
schema:
$ref: '#/definitions/schema.BackendMonitorRequest'
responses:
"200":
description: Response
schema:
$ref: '#/definitions/proto.StatusResponse'
summary: Backend monitor endpoint
/backend/shutdown:
post:
parameters:
- description: Backend statistics request
in: body
name: request
required: true
schema:
$ref: '#/definitions/schema.BackendMonitorRequest'
responses: {}
summary: Backend monitor endpoint
/metrics:
get:
parameters:
- description: Gallery details
in: body
name: request
required: true
schema:
$ref: '#/definitions/config.Gallery'
responses: {}
summary: Prometheus metrics endpoint
/models/apply:
post:
parameters:
@ -737,6 +846,24 @@ paths:
$ref: '#/definitions/config.Gallery'
type: array
summary: Adds a gallery in LocalAI
/models/jobs:
get:
responses:
"200":
description: Response
schema:
additionalProperties:
$ref: '#/definitions/gallery.GalleryOpStatus'
type: object
summary: Returns all the jobs status progress
/models/jobs/{uuid}:
get:
responses:
"200":
description: Response
schema:
$ref: '#/definitions/gallery.GalleryOpStatus'
summary: Returns the job status
/tts:
post:
consumes:
@ -757,6 +884,32 @@ paths:
type: string
summary: Generates audio from the input text.
/v1/assistants:
get:
parameters:
- description: Limit the number of assistants returned
in: query
name: limit
type: integer
- description: Order of assistants returned
in: query
name: order
type: string
- description: Return assistants created after the given ID
in: query
name: after
type: string
- description: Return assistants created before the given ID
in: query
name: before
type: string
responses:
"200":
description: Response
schema:
items:
$ref: '#/definitions/openai.Assistant'
type: array
summary: List available assistents
post:
parameters:
- description: query params
@ -771,6 +924,21 @@ paths:
schema:
$ref: '#/definitions/openai.Assistant'
summary: Create an assistant with a model and instructions.
/v1/assistants/{assistant_id}:
delete:
responses:
"200":
description: Response
schema:
$ref: '#/definitions/schema.DeleteAssistantResponse'
summary: Delete assistents
get:
responses:
"200":
description: Response
schema:
$ref: '#/definitions/openai.Assistant'
summary: Get assistent data
/v1/audio/speech:
post:
consumes:
@ -843,6 +1011,21 @@ paths:
schema:
$ref: '#/definitions/schema.OpenAIResponse'
summary: Generate completions for a given prompt and model.
/v1/edits:
post:
parameters:
- description: query params
in: body
name: request
required: true
schema:
$ref: '#/definitions/schema.OpenAIRequest'
responses:
"200":
description: Response
schema:
$ref: '#/definitions/schema.OpenAIResponse'
summary: OpenAI edit endpoint
/v1/embeddings:
post:
parameters:
@ -859,6 +1042,14 @@ paths:
$ref: '#/definitions/schema.OpenAIResponse'
summary: Get a vector representation of a given input that can be easily consumed
by machine learning models and algorithms.
/v1/files:
get:
responses:
"200":
description: Response
schema:
$ref: '#/definitions/schema.ListFiles'
summary: List files.
/v1/files/{file_id}:
delete:
responses:
@ -872,7 +1063,7 @@ paths:
"200":
description: Response
schema:
$ref: '#/definitions/openai.File'
$ref: '#/definitions/schema.File'
summary: Returns information about a specific file.
/v1/files/{file_id}/content:
get: