diff --git a/core/http/endpoints/localai/backend.go b/core/http/endpoints/localai/backend.go index bcadde692..0382b5741 100644 --- a/core/http/endpoints/localai/backend.go +++ b/core/http/endpoints/localai/backend.go @@ -34,7 +34,7 @@ func CreateBackendEndpointService(galleries []config.Gallery, backendPath string // GetOpStatusEndpoint returns the job status // @Summary Returns the job status -// @Success 200 {object} services.BackendOpStatus "Response" +// @Success 200 {object} services.GalleryOpStatus "Response" // @Router /backends/jobs/{uuid} [get] func (mgs *BackendEndpointService) GetOpStatusEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { @@ -48,7 +48,7 @@ func (mgs *BackendEndpointService) GetOpStatusEndpoint() func(c *fiber.Ctx) erro // GetAllStatusEndpoint returns all the jobs status progress // @Summary Returns all the jobs status progress -// @Success 200 {object} map[string]services.BackendOpStatus "Response" +// @Success 200 {object} map[string]services.GalleryOpStatus "Response" // @Router /backends/jobs [get] func (mgs *BackendEndpointService) GetAllStatusEndpoint() func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error { @@ -58,7 +58,7 @@ func (mgs *BackendEndpointService) GetAllStatusEndpoint() func(c *fiber.Ctx) err // ApplyBackendEndpoint installs a new backend to a LocalAI instance // @Summary Install backends to LocalAI. -// @Param request body BackendModel true "query params" +// @Param request body GalleryBackend true "query params" // @Success 200 {object} schema.BackendResponse "Response" // @Router /backends/apply [post] func (mgs *BackendEndpointService) ApplyBackendEndpoint() func(c *fiber.Ctx) error { diff --git a/swagger/docs.go b/swagger/docs.go index 125e93d7d..bea0feade 100644 --- a/swagger/docs.go +++ b/swagger/docs.go @@ -92,6 +92,129 @@ const docTemplate = `{ "responses": {} } }, + "/backends": { + "get": { + "summary": "List all Backends", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/gallery.GalleryBackend" + } + } + } + } + } + }, + "/backends/apply": { + "post": { + "summary": "Install backends to LocalAI.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/localai.GalleryBackend" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.BackendResponse" + } + } + } + } + }, + "/backends/available": { + "get": { + "summary": "List all available Backends", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/gallery.GalleryBackend" + } + } + } + } + } + }, + "/backends/delete/{name}": { + "post": { + "summary": "delete backends from LocalAI.", + "parameters": [ + { + "type": "string", + "description": "Backend name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.BackendResponse" + } + } + } + } + }, + "/backends/galleries": { + "get": { + "summary": "List all Galleries", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + } + }, + "/backends/jobs": { + "get": { + "summary": "Returns all the jobs status progress", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/services.GalleryOpStatus" + } + } + } + } + } + }, + "/backends/jobs/{uuid}": { + "get": { + "summary": "Returns the job status", + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/services.GalleryOpStatus" + } + } + } + } + }, "/metrics": { "get": { "summary": "Prometheus metrics endpoint", @@ -185,56 +308,6 @@ const docTemplate = `{ } } } - }, - "post": { - "summary": "Adds a gallery in LocalAI", - "parameters": [ - { - "description": "Gallery details", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/config.Gallery" - } - } - ], - "responses": { - "200": { - "description": "Response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/config.Gallery" - } - } - } - } - }, - "delete": { - "summary": "removes a gallery from LocalAI", - "parameters": [ - { - "description": "Gallery details", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/config.Gallery" - } - } - ], - "responses": { - "200": { - "description": "Response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/config.Gallery" - } - } - } - } } }, "/models/jobs": { @@ -328,94 +401,6 @@ 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": [ - { - "description": "query params", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/openai.AssistantRequest" - } - } - ], - "responses": { - "200": { - "description": "Response", - "schema": { - "$ref": "#/definitions/openai.Assistant" - } - } - } - } - }, - "/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": [ @@ -529,6 +514,30 @@ const docTemplate = `{ } } }, + "/v1/detection": { + "post": { + "summary": "Detects objects in the input image.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schema.DetectionRequest" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.DetectionResponse" + } + } + } + } + }, "/v1/edits": { "post": { "summary": "OpenAI edit endpoint", @@ -577,56 +586,6 @@ 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.", - "responses": { - "200": { - "description": "Response", - "schema": { - "$ref": "#/definitions/schema.File" - } - } - } - }, - "delete": { - "summary": "Delete a file.", - "responses": { - "200": { - "description": "Response", - "schema": { - "$ref": "#/definitions/openai.DeleteStatus" - } - } - } - } - }, - "/v1/files/{file_id}/content": { - "get": { - "summary": "Returns information about a specific file.", - "responses": { - "200": { - "description": "file", - "schema": { - "type": "string" - } - } - } - } - }, "/v1/images/generations": { "post": { "summary": "Creates an image given a prompt.", @@ -926,6 +885,75 @@ const docTemplate = `{ } } }, + "gallery.GalleryBackend": { + "type": "object", + "properties": { + "alias": { + "type": "string" + }, + "capabilities": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "files": { + "description": "AdditionalFiles are used to add additional files to the model", + "type": "array", + "items": { + "$ref": "#/definitions/gallery.File" + } + }, + "gallery": { + "description": "Gallery is a reference to the gallery which contains the model", + "allOf": [ + { + "$ref": "#/definitions/config.Gallery" + } + ] + }, + "icon": { + "type": "string" + }, + "installed": { + "description": "Installed is used to indicate if the model is installed or not", + "type": "boolean" + }, + "license": { + "type": "string" + }, + "mirrors": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "uri": { + "type": "string" + }, + "url": { + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "gallery.GalleryModel": { "type": "object", "properties": { @@ -987,34 +1015,11 @@ const docTemplate = `{ } } }, - "services.GalleryOpStatus": { + "localai.GalleryBackend": { "type": "object", "properties": { - "deletion": { - "description": "Deletion is true if the operation is a deletion", - "type": "boolean" - }, - "downloaded_size": { + "id": { "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" } } }, @@ -1026,9 +1031,6 @@ const docTemplate = `{ "type": "object", "additionalProperties": true }, - "config_url": { - "type": "string" - }, "description": { "type": "string" }, @@ -1085,130 +1087,6 @@ const docTemplate = `{ } } }, - "openai.Assistant": { - "type": "object", - "properties": { - "created": { - "description": "The time at which the assistant was created.", - "type": "integer" - }, - "description": { - "description": "The description of the assistant.", - "type": "string" - }, - "file_ids": { - "description": "A list of file IDs attached to this assistant.", - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "description": "The unique identifier of the assistant.", - "type": "string" - }, - "instructions": { - "description": "The system instructions that the assistant uses.", - "type": "string" - }, - "metadata": { - "description": "Set of key-value pairs attached to the assistant.", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "model": { - "description": "The model ID used by the assistant.", - "type": "string" - }, - "name": { - "description": "The name of the assistant.", - "type": "string" - }, - "object": { - "description": "Object type, which is \"assistant\".", - "type": "string" - }, - "tools": { - "description": "A list of tools enabled on the assistant.", - "type": "array", - "items": { - "$ref": "#/definitions/openai.Tool" - } - } - } - }, - "openai.AssistantRequest": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "file_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "instructions": { - "type": "string" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "model": { - "type": "string" - }, - "name": { - "type": "string" - }, - "tools": { - "type": "array", - "items": { - "$ref": "#/definitions/openai.Tool" - } - } - } - }, - "openai.DeleteStatus": { - "type": "object", - "properties": { - "deleted": { - "type": "boolean" - }, - "id": { - "type": "string" - }, - "object": { - "type": "string" - } - } - }, - "openai.Tool": { - "type": "object", - "properties": { - "type": { - "$ref": "#/definitions/openai.ToolType" - } - } - }, - "openai.ToolType": { - "type": "string", - "enum": [ - "code_interpreter", - "retrieval", - "function" - ], - "x-enum-varnames": [ - "CodeInterpreter", - "Retrieval", - "Function" - ] - }, "p2p.NodeData": { "type": "object", "properties": { @@ -1299,6 +1177,17 @@ const docTemplate = `{ } } }, + "schema.BackendResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "status_url": { + "type": "string" + } + } + }, "schema.Choice": { "type": "object", "properties": { @@ -1319,17 +1208,45 @@ const docTemplate = `{ } } }, - "schema.DeleteAssistantResponse": { + "schema.Detection": { "type": "object", "properties": { - "deleted": { - "type": "boolean" - }, - "id": { + "class_name": { "type": "string" }, - "object": { + "height": { + "type": "number" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + } + }, + "schema.DetectionRequest": { + "type": "object", + "properties": { + "image": { "type": "string" + }, + "model": { + "type": "string" + } + } + }, + "schema.DetectionResponse": { + "type": "object", + "properties": { + "detections": { + "type": "array", + "items": { + "$ref": "#/definitions/schema.Detection" + } } } }, @@ -1353,35 +1270,6 @@ const docTemplate = `{ } } }, - "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": { @@ -1501,20 +1389,6 @@ const docTemplate = `{ } } }, - "schema.ListFiles": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/schema.File" - } - }, - "object": { - "type": "string" - } - } - }, "schema.Message": { "type": "object", "properties": { @@ -1610,6 +1484,13 @@ const docTemplate = `{ "description": "whisper", "type": "string" }, + "files": { + "description": "Multiple input images for img2img or inpainting", + "type": "array", + "items": { + "type": "string" + } + }, "frequency_penalty": { "type": "number" }, @@ -1684,6 +1565,13 @@ const docTemplate = `{ "quality": { "type": "string" }, + "ref_images": { + "description": "Reference images for models that support them (e.g., Flux Kontext)", + "type": "array", + "items": { + "type": "string" + } + }, "repeat_last_n": { "type": "integer" }, @@ -1923,6 +1811,37 @@ const docTemplate = `{ "type": "string" } } + }, + "services.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_element_name": { + "type": "string" + }, + "message": { + "type": "string" + }, + "processed": { + "type": "boolean" + }, + "progress": { + "type": "number" + } + } } }, "securityDefinitions": { diff --git a/swagger/swagger.json b/swagger/swagger.json index 5a769a08e..754c58c35 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -85,6 +85,129 @@ "responses": {} } }, + "/backends": { + "get": { + "summary": "List all Backends", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/gallery.GalleryBackend" + } + } + } + } + } + }, + "/backends/apply": { + "post": { + "summary": "Install backends to LocalAI.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/localai.GalleryBackend" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.BackendResponse" + } + } + } + } + }, + "/backends/available": { + "get": { + "summary": "List all available Backends", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/gallery.GalleryBackend" + } + } + } + } + } + }, + "/backends/delete/{name}": { + "post": { + "summary": "delete backends from LocalAI.", + "parameters": [ + { + "type": "string", + "description": "Backend name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.BackendResponse" + } + } + } + } + }, + "/backends/galleries": { + "get": { + "summary": "List all Galleries", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/config.Gallery" + } + } + } + } + } + }, + "/backends/jobs": { + "get": { + "summary": "Returns all the jobs status progress", + "responses": { + "200": { + "description": "Response", + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/services.GalleryOpStatus" + } + } + } + } + } + }, + "/backends/jobs/{uuid}": { + "get": { + "summary": "Returns the job status", + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/services.GalleryOpStatus" + } + } + } + } + }, "/metrics": { "get": { "summary": "Prometheus metrics endpoint", @@ -178,56 +301,6 @@ } } } - }, - "post": { - "summary": "Adds a gallery in LocalAI", - "parameters": [ - { - "description": "Gallery details", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/config.Gallery" - } - } - ], - "responses": { - "200": { - "description": "Response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/config.Gallery" - } - } - } - } - }, - "delete": { - "summary": "removes a gallery from LocalAI", - "parameters": [ - { - "description": "Gallery details", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/config.Gallery" - } - } - ], - "responses": { - "200": { - "description": "Response", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/config.Gallery" - } - } - } - } } }, "/models/jobs": { @@ -321,94 +394,6 @@ } } }, - "/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": [ - { - "description": "query params", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/openai.AssistantRequest" - } - } - ], - "responses": { - "200": { - "description": "Response", - "schema": { - "$ref": "#/definitions/openai.Assistant" - } - } - } - } - }, - "/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": [ @@ -522,6 +507,30 @@ } } }, + "/v1/detection": { + "post": { + "summary": "Detects objects in the input image.", + "parameters": [ + { + "description": "query params", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/schema.DetectionRequest" + } + } + ], + "responses": { + "200": { + "description": "Response", + "schema": { + "$ref": "#/definitions/schema.DetectionResponse" + } + } + } + } + }, "/v1/edits": { "post": { "summary": "OpenAI edit endpoint", @@ -570,56 +579,6 @@ } } }, - "/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.", - "responses": { - "200": { - "description": "Response", - "schema": { - "$ref": "#/definitions/schema.File" - } - } - } - }, - "delete": { - "summary": "Delete a file.", - "responses": { - "200": { - "description": "Response", - "schema": { - "$ref": "#/definitions/openai.DeleteStatus" - } - } - } - } - }, - "/v1/files/{file_id}/content": { - "get": { - "summary": "Returns information about a specific file.", - "responses": { - "200": { - "description": "file", - "schema": { - "type": "string" - } - } - } - } - }, "/v1/images/generations": { "post": { "summary": "Creates an image given a prompt.", @@ -919,6 +878,75 @@ } } }, + "gallery.GalleryBackend": { + "type": "object", + "properties": { + "alias": { + "type": "string" + }, + "capabilities": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "files": { + "description": "AdditionalFiles are used to add additional files to the model", + "type": "array", + "items": { + "$ref": "#/definitions/gallery.File" + } + }, + "gallery": { + "description": "Gallery is a reference to the gallery which contains the model", + "allOf": [ + { + "$ref": "#/definitions/config.Gallery" + } + ] + }, + "icon": { + "type": "string" + }, + "installed": { + "description": "Installed is used to indicate if the model is installed or not", + "type": "boolean" + }, + "license": { + "type": "string" + }, + "mirrors": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "uri": { + "type": "string" + }, + "url": { + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "gallery.GalleryModel": { "type": "object", "properties": { @@ -980,34 +1008,11 @@ } } }, - "services.GalleryOpStatus": { + "localai.GalleryBackend": { "type": "object", "properties": { - "deletion": { - "description": "Deletion is true if the operation is a deletion", - "type": "boolean" - }, - "downloaded_size": { + "id": { "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" } } }, @@ -1019,9 +1024,6 @@ "type": "object", "additionalProperties": true }, - "config_url": { - "type": "string" - }, "description": { "type": "string" }, @@ -1078,130 +1080,6 @@ } } }, - "openai.Assistant": { - "type": "object", - "properties": { - "created": { - "description": "The time at which the assistant was created.", - "type": "integer" - }, - "description": { - "description": "The description of the assistant.", - "type": "string" - }, - "file_ids": { - "description": "A list of file IDs attached to this assistant.", - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "description": "The unique identifier of the assistant.", - "type": "string" - }, - "instructions": { - "description": "The system instructions that the assistant uses.", - "type": "string" - }, - "metadata": { - "description": "Set of key-value pairs attached to the assistant.", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "model": { - "description": "The model ID used by the assistant.", - "type": "string" - }, - "name": { - "description": "The name of the assistant.", - "type": "string" - }, - "object": { - "description": "Object type, which is \"assistant\".", - "type": "string" - }, - "tools": { - "description": "A list of tools enabled on the assistant.", - "type": "array", - "items": { - "$ref": "#/definitions/openai.Tool" - } - } - } - }, - "openai.AssistantRequest": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "file_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "instructions": { - "type": "string" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "model": { - "type": "string" - }, - "name": { - "type": "string" - }, - "tools": { - "type": "array", - "items": { - "$ref": "#/definitions/openai.Tool" - } - } - } - }, - "openai.DeleteStatus": { - "type": "object", - "properties": { - "deleted": { - "type": "boolean" - }, - "id": { - "type": "string" - }, - "object": { - "type": "string" - } - } - }, - "openai.Tool": { - "type": "object", - "properties": { - "type": { - "$ref": "#/definitions/openai.ToolType" - } - } - }, - "openai.ToolType": { - "type": "string", - "enum": [ - "code_interpreter", - "retrieval", - "function" - ], - "x-enum-varnames": [ - "CodeInterpreter", - "Retrieval", - "Function" - ] - }, "p2p.NodeData": { "type": "object", "properties": { @@ -1292,6 +1170,17 @@ } } }, + "schema.BackendResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "status_url": { + "type": "string" + } + } + }, "schema.Choice": { "type": "object", "properties": { @@ -1312,17 +1201,45 @@ } } }, - "schema.DeleteAssistantResponse": { + "schema.Detection": { "type": "object", "properties": { - "deleted": { - "type": "boolean" - }, - "id": { + "class_name": { "type": "string" }, - "object": { + "height": { + "type": "number" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + } + }, + "schema.DetectionRequest": { + "type": "object", + "properties": { + "image": { "type": "string" + }, + "model": { + "type": "string" + } + } + }, + "schema.DetectionResponse": { + "type": "object", + "properties": { + "detections": { + "type": "array", + "items": { + "$ref": "#/definitions/schema.Detection" + } } } }, @@ -1346,35 +1263,6 @@ } } }, - "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": { @@ -1494,20 +1382,6 @@ } } }, - "schema.ListFiles": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/schema.File" - } - }, - "object": { - "type": "string" - } - } - }, "schema.Message": { "type": "object", "properties": { @@ -1603,6 +1477,13 @@ "description": "whisper", "type": "string" }, + "files": { + "description": "Multiple input images for img2img or inpainting", + "type": "array", + "items": { + "type": "string" + } + }, "frequency_penalty": { "type": "number" }, @@ -1677,6 +1558,13 @@ "quality": { "type": "string" }, + "ref_images": { + "description": "Reference images for models that support them (e.g., Flux Kontext)", + "type": "array", + "items": { + "type": "string" + } + }, "repeat_last_n": { "type": "integer" }, @@ -1916,6 +1804,37 @@ "type": "string" } } + }, + "services.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_element_name": { + "type": "string" + }, + "message": { + "type": "string" + }, + "processed": { + "type": "boolean" + }, + "progress": { + "type": "number" + } + } } }, "securityDefinitions": { diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index d566eac1f..040882364 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -57,6 +57,51 @@ definitions: uri: type: string type: object + gallery.GalleryBackend: + properties: + alias: + type: string + capabilities: + additionalProperties: + type: string + type: object + description: + type: string + files: + description: AdditionalFiles are used to add additional files to the model + items: + $ref: '#/definitions/gallery.File' + type: array + gallery: + allOf: + - $ref: '#/definitions/config.Gallery' + description: Gallery is a reference to the gallery which contains the model + icon: + type: string + installed: + description: Installed is used to indicate if the model is installed or not + type: boolean + license: + type: string + mirrors: + items: + type: string + type: array + name: + type: string + tags: + items: + type: string + type: array + uri: + type: string + url: + type: string + urls: + items: + type: string + type: array + type: object gallery.GalleryModel: properties: config_file: @@ -100,26 +145,10 @@ definitions: type: string type: array type: object - services.GalleryOpStatus: + localai.GalleryBackend: properties: - deletion: - description: Deletion is true if the operation is a deletion - type: boolean - downloaded_size: + id: 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: @@ -128,8 +157,6 @@ definitions: description: config_file is read in the situation where URL is blank - and therefore this is a base config. type: object - config_url: - type: string description: type: string files: @@ -168,92 +195,6 @@ definitions: type: string type: array type: object - openai.Assistant: - properties: - created: - description: The time at which the assistant was created. - type: integer - description: - description: The description of the assistant. - type: string - file_ids: - description: A list of file IDs attached to this assistant. - items: - type: string - type: array - id: - description: The unique identifier of the assistant. - type: string - instructions: - description: The system instructions that the assistant uses. - type: string - metadata: - additionalProperties: - type: string - description: Set of key-value pairs attached to the assistant. - type: object - model: - description: The model ID used by the assistant. - type: string - name: - description: The name of the assistant. - type: string - object: - description: Object type, which is "assistant". - type: string - tools: - description: A list of tools enabled on the assistant. - items: - $ref: '#/definitions/openai.Tool' - type: array - type: object - openai.AssistantRequest: - properties: - description: - type: string - file_ids: - items: - type: string - type: array - instructions: - type: string - metadata: - additionalProperties: - type: string - type: object - model: - type: string - name: - type: string - tools: - items: - $ref: '#/definitions/openai.Tool' - type: array - type: object - openai.DeleteStatus: - properties: - deleted: - type: boolean - id: - type: string - object: - type: string - type: object - openai.Tool: - properties: - type: - $ref: '#/definitions/openai.ToolType' - type: object - openai.ToolType: - enum: - - code_interpreter - - retrieval - - function - type: string - x-enum-varnames: - - CodeInterpreter - - Retrieval - - Function p2p.NodeData: properties: id: @@ -314,6 +255,13 @@ definitions: model: type: string type: object + schema.BackendResponse: + properties: + id: + type: string + status_url: + type: string + type: object schema.Choice: properties: delta: @@ -327,14 +275,32 @@ definitions: text: type: string type: object - schema.DeleteAssistantResponse: + schema.Detection: properties: - deleted: - type: boolean - id: + class_name: type: string - object: + height: + type: number + width: + type: number + x: + type: number + "y": + type: number + type: object + schema.DetectionRequest: + properties: + image: type: string + model: + type: string + type: object + schema.DetectionResponse: + properties: + detections: + items: + $ref: '#/definitions/schema.Detection' + type: array type: object schema.ElevenLabsSoundGenerationRequest: properties: @@ -349,28 +315,6 @@ definitions: text: 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: @@ -448,15 +392,6 @@ 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: @@ -519,6 +454,11 @@ definitions: file: description: whisper type: string + files: + description: Multiple input images for img2img or inpainting + items: + type: string + type: array frequency_penalty: type: number function_call: @@ -572,6 +512,11 @@ definitions: description: Prompt is read only by completion/image API calls quality: type: string + ref_images: + description: Reference images for models that support them (e.g., Flux Kontext) + items: + type: string + type: array repeat_last_n: type: integer repeat_penalty: @@ -737,6 +682,27 @@ definitions: model: type: string type: object + services.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_element_name: + type: string + message: + type: string + processed: + type: boolean + progress: + type: number + type: object info: contact: name: LocalAI @@ -792,6 +758,83 @@ paths: $ref: '#/definitions/schema.BackendMonitorRequest' responses: {} summary: Backend monitor endpoint + /backends: + get: + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/gallery.GalleryBackend' + type: array + summary: List all Backends + /backends/apply: + post: + parameters: + - description: query params + in: body + name: request + required: true + schema: + $ref: '#/definitions/localai.GalleryBackend' + responses: + "200": + description: Response + schema: + $ref: '#/definitions/schema.BackendResponse' + summary: Install backends to LocalAI. + /backends/available: + get: + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/gallery.GalleryBackend' + type: array + summary: List all available Backends + /backends/delete/{name}: + post: + parameters: + - description: Backend name + in: path + name: name + required: true + type: string + responses: + "200": + description: Response + schema: + $ref: '#/definitions/schema.BackendResponse' + summary: delete backends from LocalAI. + /backends/galleries: + get: + responses: + "200": + description: Response + schema: + items: + $ref: '#/definitions/config.Gallery' + type: array + summary: List all Galleries + /backends/jobs: + get: + responses: + "200": + description: Response + schema: + additionalProperties: + $ref: '#/definitions/services.GalleryOpStatus' + type: object + summary: Returns all the jobs status progress + /backends/jobs/{uuid}: + get: + responses: + "200": + description: Response + schema: + $ref: '#/definitions/services.GalleryOpStatus' + summary: Returns the job status /metrics: get: parameters: @@ -843,22 +886,6 @@ paths: $ref: '#/definitions/schema.GalleryResponse' summary: delete models to LocalAI. /models/galleries: - delete: - parameters: - - description: Gallery details - in: body - name: request - required: true - schema: - $ref: '#/definitions/config.Gallery' - responses: - "200": - description: Response - schema: - items: - $ref: '#/definitions/config.Gallery' - type: array - summary: removes a gallery from LocalAI get: responses: "200": @@ -868,22 +895,6 @@ paths: $ref: '#/definitions/config.Gallery' type: array summary: List all Galleries - post: - parameters: - - description: Gallery details - in: body - name: request - required: true - schema: - $ref: '#/definitions/config.Gallery' - responses: - "200": - description: Response - schema: - items: - $ref: '#/definitions/config.Gallery' - type: array - summary: Adds a gallery in LocalAI /models/jobs: get: responses: @@ -941,62 +952,6 @@ paths: schema: 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 - in: body - name: request - required: true - schema: - $ref: '#/definitions/openai.AssistantRequest' - responses: - "200": - description: Response - 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: @@ -1069,6 +1024,21 @@ paths: schema: $ref: '#/definitions/schema.OpenAIResponse' summary: Generate completions for a given prompt and model. + /v1/detection: + post: + parameters: + - description: query params + in: body + name: request + required: true + schema: + $ref: '#/definitions/schema.DetectionRequest' + responses: + "200": + description: Response + schema: + $ref: '#/definitions/schema.DetectionResponse' + summary: Detects objects in the input image. /v1/edits: post: parameters: @@ -1100,37 +1070,6 @@ 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: - "200": - description: Response - schema: - $ref: '#/definitions/openai.DeleteStatus' - summary: Delete a file. - get: - responses: - "200": - description: Response - schema: - $ref: '#/definitions/schema.File' - summary: Returns information about a specific file. - /v1/files/{file_id}/content: - get: - responses: - "200": - description: file - schema: - type: string - summary: Returns information about a specific file. /v1/images/generations: post: parameters: