Move swagger documentation to apidoc

This commit is contained in:
2025-08-07 19:48:03 +02:00
parent 7bde12db47
commit a87652937f
4 changed files with 141 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
// Package apidocs Code generated by swaggo/swag. DO NOT EDIT
package apidocs
import "github.com/swaggo/swag"
@@ -37,7 +37,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
}
},
@@ -75,7 +75,7 @@ const docTemplate = `{
"200": {
"description": "Instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -120,7 +120,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/llamactl.CreateInstanceOptions"
"$ref": "#/definitions/instance.CreateInstanceOptions"
}
}
],
@@ -128,7 +128,7 @@ const docTemplate = `{
"200": {
"description": "Updated instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -173,7 +173,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/llamactl.CreateInstanceOptions"
"$ref": "#/definitions/instance.CreateInstanceOptions"
}
}
],
@@ -181,7 +181,7 @@ const docTemplate = `{
"201": {
"description": "Created instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -401,7 +401,7 @@ const docTemplate = `{
"200": {
"description": "Restarted instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -444,7 +444,7 @@ const docTemplate = `{
"200": {
"description": "Started instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -487,7 +487,7 @@ const docTemplate = `{
"200": {
"description": "Stopped instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -639,7 +639,35 @@ const docTemplate = `{
"200": {
"description": "List of OpenAI-compatible instances",
"schema": {
"$ref": "#/definitions/llamactl.OpenAIListInstancesResponse"
"$ref": "#/definitions/server.OpenAIListInstancesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/version": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns the version of the llamactl command",
"tags": [
"version"
],
"summary": "Get llamactl version",
"responses": {
"200": {
"description": "Version information",
"schema": {
"type": "string"
}
},
"500": {
@@ -653,7 +681,7 @@ const docTemplate = `{
}
},
"definitions": {
"llamactl.CreateInstanceOptions": {
"instance.CreateInstanceOptions": {
"type": "object",
"properties": {
"alias": {
@@ -751,7 +779,6 @@ const docTemplate = `{
"type": "string"
},
"draft_max": {
"description": "Speculative decoding params",
"type": "integer"
},
"draft_min": {
@@ -955,7 +982,7 @@ const docTemplate = `{
"type": "boolean"
},
"no_context_shift": {
"description": "Server/Example-specific params",
"description": "Example-specific params",
"type": "boolean"
},
"no_escape": {
@@ -1027,10 +1054,10 @@ const docTemplate = `{
"presence_penalty": {
"type": "number"
},
"priority": {
"prio": {
"type": "integer"
},
"priority_batch": {
"prio_batch": {
"type": "integer"
},
"props": {
@@ -1101,7 +1128,7 @@ const docTemplate = `{
"ssl_key_file": {
"type": "string"
},
"temperature": {
"temp": {
"type": "number"
},
"tensor_split": {
@@ -1167,7 +1194,7 @@ const docTemplate = `{
}
}
},
"llamactl.Instance": {
"instance.Process": {
"type": "object",
"properties": {
"created": {
@@ -1183,7 +1210,7 @@ const docTemplate = `{
}
}
},
"llamactl.OpenAIInstance": {
"server.OpenAIInstance": {
"type": "object",
"properties": {
"created": {
@@ -1200,13 +1227,13 @@ const docTemplate = `{
}
}
},
"llamactl.OpenAIListInstancesResponse": {
"server.OpenAIListInstancesResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/llamactl.OpenAIInstance"
"$ref": "#/definitions/server.OpenAIInstance"
}
},
"object": {

View File

@@ -30,7 +30,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
}
},
@@ -68,7 +68,7 @@
"200": {
"description": "Instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -113,7 +113,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/llamactl.CreateInstanceOptions"
"$ref": "#/definitions/instance.CreateInstanceOptions"
}
}
],
@@ -121,7 +121,7 @@
"200": {
"description": "Updated instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -166,7 +166,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/llamactl.CreateInstanceOptions"
"$ref": "#/definitions/instance.CreateInstanceOptions"
}
}
],
@@ -174,7 +174,7 @@
"201": {
"description": "Created instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -394,7 +394,7 @@
"200": {
"description": "Restarted instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -437,7 +437,7 @@
"200": {
"description": "Started instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -480,7 +480,7 @@
"200": {
"description": "Stopped instance details",
"schema": {
"$ref": "#/definitions/llamactl.Instance"
"$ref": "#/definitions/instance.Process"
}
},
"400": {
@@ -632,7 +632,35 @@
"200": {
"description": "List of OpenAI-compatible instances",
"schema": {
"$ref": "#/definitions/llamactl.OpenAIListInstancesResponse"
"$ref": "#/definitions/server.OpenAIListInstancesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/version": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns the version of the llamactl command",
"tags": [
"version"
],
"summary": "Get llamactl version",
"responses": {
"200": {
"description": "Version information",
"schema": {
"type": "string"
}
},
"500": {
@@ -646,7 +674,7 @@
}
},
"definitions": {
"llamactl.CreateInstanceOptions": {
"instance.CreateInstanceOptions": {
"type": "object",
"properties": {
"alias": {
@@ -744,7 +772,6 @@
"type": "string"
},
"draft_max": {
"description": "Speculative decoding params",
"type": "integer"
},
"draft_min": {
@@ -948,7 +975,7 @@
"type": "boolean"
},
"no_context_shift": {
"description": "Server/Example-specific params",
"description": "Example-specific params",
"type": "boolean"
},
"no_escape": {
@@ -1020,10 +1047,10 @@
"presence_penalty": {
"type": "number"
},
"priority": {
"prio": {
"type": "integer"
},
"priority_batch": {
"prio_batch": {
"type": "integer"
},
"props": {
@@ -1094,7 +1121,7 @@
"ssl_key_file": {
"type": "string"
},
"temperature": {
"temp": {
"type": "number"
},
"tensor_split": {
@@ -1160,7 +1187,7 @@
}
}
},
"llamactl.Instance": {
"instance.Process": {
"type": "object",
"properties": {
"created": {
@@ -1176,7 +1203,7 @@
}
}
},
"llamactl.OpenAIInstance": {
"server.OpenAIInstance": {
"type": "object",
"properties": {
"created": {
@@ -1193,13 +1220,13 @@
}
}
},
"llamactl.OpenAIListInstancesResponse": {
"server.OpenAIListInstancesResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/llamactl.OpenAIInstance"
"$ref": "#/definitions/server.OpenAIInstance"
}
},
"object": {

View File

@@ -1,6 +1,6 @@
basePath: /api/v1
definitions:
llamactl.CreateInstanceOptions:
instance.CreateInstanceOptions:
properties:
alias:
type: string
@@ -66,7 +66,6 @@ definitions:
device_draft:
type: string
draft_max:
description: Speculative decoding params
type: integer
draft_min:
type: integer
@@ -203,7 +202,7 @@ definitions:
no_cont_batching:
type: boolean
no_context_shift:
description: Server/Example-specific params
description: Example-specific params
type: boolean
no_escape:
type: boolean
@@ -251,9 +250,9 @@ definitions:
type: integer
presence_penalty:
type: number
priority:
prio:
type: integer
priority_batch:
prio_batch:
type: integer
props:
type: boolean
@@ -301,7 +300,7 @@ definitions:
type: string
ssl_key_file:
type: string
temperature:
temp:
type: number
tensor_split:
type: string
@@ -345,7 +344,7 @@ definitions:
yarn_orig_ctx:
type: integer
type: object
llamactl.Instance:
instance.Process:
properties:
created:
description: Creation time
@@ -356,7 +355,7 @@ definitions:
description: Status
type: boolean
type: object
llamactl.OpenAIInstance:
server.OpenAIInstance:
properties:
created:
type: integer
@@ -367,11 +366,11 @@ definitions:
owned_by:
type: string
type: object
llamactl.OpenAIListInstancesResponse:
server.OpenAIListInstancesResponse:
properties:
data:
items:
$ref: '#/definitions/llamactl.OpenAIInstance'
$ref: '#/definitions/server.OpenAIInstance'
type: array
object:
type: string
@@ -393,7 +392,7 @@ paths:
description: List of instances
schema:
items:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
type: array
"500":
description: Internal Server Error
@@ -441,7 +440,7 @@ paths:
"200":
description: Instance details
schema:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
"400":
description: Invalid name format
schema:
@@ -470,12 +469,12 @@ paths:
name: options
required: true
schema:
$ref: '#/definitions/llamactl.CreateInstanceOptions'
$ref: '#/definitions/instance.CreateInstanceOptions'
responses:
"201":
description: Created instance details
schema:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
"400":
description: Invalid request body
schema:
@@ -504,12 +503,12 @@ paths:
name: options
required: true
schema:
$ref: '#/definitions/llamactl.CreateInstanceOptions'
$ref: '#/definitions/instance.CreateInstanceOptions'
responses:
"200":
description: Updated instance details
schema:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
"400":
description: Invalid name format
schema:
@@ -627,7 +626,7 @@ paths:
"200":
description: Restarted instance details
schema:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
"400":
description: Invalid name format
schema:
@@ -654,7 +653,7 @@ paths:
"200":
description: Started instance details
schema:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
"400":
description: Invalid name format
schema:
@@ -681,7 +680,7 @@ paths:
"200":
description: Stopped instance details
schema:
$ref: '#/definitions/llamactl.Instance'
$ref: '#/definitions/instance.Process'
"400":
description: Invalid name format
schema:
@@ -777,7 +776,7 @@ paths:
"200":
description: List of OpenAI-compatible instances
schema:
$ref: '#/definitions/llamactl.OpenAIListInstancesResponse'
$ref: '#/definitions/server.OpenAIListInstancesResponse'
"500":
description: Internal Server Error
schema:
@@ -787,4 +786,21 @@ paths:
summary: List instances in OpenAI-compatible format
tags:
- openai
/version:
get:
description: Returns the version of the llamactl command
responses:
"200":
description: Version information
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- ApiKeyAuth: []
summary: Get llamactl version
tags:
- version
swagger: "2.0"

View File

@@ -116,7 +116,7 @@ func (h *Handler) LlamaServerListDevicesHandler() http.HandlerFunc {
// @Tags instances
// @Security ApiKeyAuth
// @Produces json
// @Success 200 {array} Instance "List of instances"
// @Success 200 {array} instance.Process "List of instances"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances [get]
func (h *Handler) ListInstances() http.HandlerFunc {
@@ -143,8 +143,8 @@ func (h *Handler) ListInstances() http.HandlerFunc {
// @Accept json
// @Produces json
// @Param name path string true "Instance Name"
// @Param options body CreateInstanceOptions true "Instance configuration options"
// @Success 201 {object} Instance "Created instance details"
// @Param options body instance.CreateInstanceOptions true "Instance configuration options"
// @Success 201 {object} instance.Process "Created instance details"
// @Failure 400 {string} string "Invalid request body"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances/{name} [post]
@@ -184,7 +184,7 @@ func (h *Handler) CreateInstance() http.HandlerFunc {
// @Security ApiKeyAuth
// @Produces json
// @Param name path string true "Instance Name"
// @Success 200 {object} Instance "Instance details"
// @Success 200 {object} instance.Process "Instance details"
// @Failure 400 {string} string "Invalid name format"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances/{name} [get]
@@ -218,8 +218,8 @@ func (h *Handler) GetInstance() http.HandlerFunc {
// @Accept json
// @Produces json
// @Param name path string true "Instance Name"
// @Param options body CreateInstanceOptions true "Instance configuration options"
// @Success 200 {object} Instance "Updated instance details"
// @Param options body instance.CreateInstanceOptions true "Instance configuration options"
// @Success 200 {object} instance.Process "Updated instance details"
// @Failure 400 {string} string "Invalid name format"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances/{name} [put]
@@ -258,7 +258,7 @@ func (h *Handler) UpdateInstance() http.HandlerFunc {
// @Security ApiKeyAuth
// @Produces json
// @Param name path string true "Instance Name"
// @Success 200 {object} Instance "Started instance details"
// @Success 200 {object} instance.Process "Started instance details"
// @Failure 400 {string} string "Invalid name format"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances/{name}/start [post]
@@ -291,7 +291,7 @@ func (h *Handler) StartInstance() http.HandlerFunc {
// @Security ApiKeyAuth
// @Produces json
// @Param name path string true "Instance Name"
// @Success 200 {object} Instance "Stopped instance details"
// @Success 200 {object} instance.Process "Stopped instance details"
// @Failure 400 {string} string "Invalid name format"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances/{name}/stop [post]
@@ -324,7 +324,7 @@ func (h *Handler) StopInstance() http.HandlerFunc {
// @Security ApiKeyAuth
// @Produces json
// @Param name path string true "Instance Name"
// @Success 200 {object} Instance "Restarted instance details"
// @Success 200 {object} instance.Process "Restarted instance details"
// @Failure 400 {string} string "Invalid name format"
// @Failure 500 {string} string "Internal Server Error"
// @Router /instances/{name}/restart [post]