mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 01:24:36 +00:00
json to gbnf endpoint added
This commit is contained in:
parent
7e1289ade8
commit
7a7bdeab6d
11 changed files with 1040 additions and 21 deletions
202
kcpp_docs.embd
202
kcpp_docs.embd
|
@ -377,10 +377,30 @@
|
|||
"type": "integer",
|
||||
"description": "Last generation seed used."
|
||||
},
|
||||
"last_draft_success": {
|
||||
"type": "integer",
|
||||
"description": "Last generation draft successes in tokens."
|
||||
},
|
||||
"last_draft_failed": {
|
||||
"type": "integer",
|
||||
"description": "Last generation draft failures in tokens."
|
||||
},
|
||||
"total_gens": {
|
||||
"type": "integer",
|
||||
"description": "Total requests generated since startup."
|
||||
},
|
||||
"total_img_gens": {
|
||||
"type": "integer",
|
||||
"description": "Total image requests generated since startup."
|
||||
},
|
||||
"total_tts_gens": {
|
||||
"type": "integer",
|
||||
"description": "Total tts requests generated since startup."
|
||||
},
|
||||
"total_transcribe_gens": {
|
||||
"type": "integer",
|
||||
"description": "Total transcribe requests generated since startup."
|
||||
},
|
||||
"stop_reason": {
|
||||
"type": "integer",
|
||||
"description": "Reason the generation stopped. INVALID=-1, OUT_OF_TOKENS=0, EOS_TOKEN_HIT=1, CUSTOM_STOPPER=2"
|
||||
|
@ -400,6 +420,14 @@
|
|||
"uptime": {
|
||||
"type": "integer",
|
||||
"description": "Seconds that the server has been running for."
|
||||
},
|
||||
"idletime": {
|
||||
"type": "integer",
|
||||
"description": "Seconds that the server has been inactive for."
|
||||
},
|
||||
"quiet": {
|
||||
"type": "boolean",
|
||||
"description": "Is the server in quiet (no logging) mode."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
@ -667,14 +695,24 @@
|
|||
"content": {
|
||||
"application/json": {
|
||||
"example": {
|
||||
"last_process": 5.0,
|
||||
"last_eval": 7.0,
|
||||
"last_token_count": 80,
|
||||
"stop_reason": 1,
|
||||
"queue": 0,
|
||||
"total_gens": 3,
|
||||
"idle": 1
|
||||
},
|
||||
"last_process": 0.76,
|
||||
"last_eval": 65.8,
|
||||
"last_token_count": 26,
|
||||
"last_seed": 427343,
|
||||
"last_draft_success": 0,
|
||||
"last_draft_failed": 0,
|
||||
"total_gens": 1724,
|
||||
"stop_reason": 0,
|
||||
"total_img_gens": 0,
|
||||
"total_tts_gens": 0,
|
||||
"total_transcribe_gens": 0,
|
||||
"queue": 0,
|
||||
"idle": 0,
|
||||
"hordeexitcounter": -1,
|
||||
"uptime": 2255,
|
||||
"idletime": 3.5,
|
||||
"quiet": true
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/KcppPerf"
|
||||
}
|
||||
|
@ -1456,6 +1494,7 @@
|
|||
"example": {
|
||||
"input": "hello world, how are you today?",
|
||||
"voice": "kobo",
|
||||
"speaker_json":"",
|
||||
},
|
||||
"schema": {
|
||||
"properties": {
|
||||
|
@ -1504,9 +1543,26 @@
|
|||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"example": {"model": "kcpp", "input": "Niko the Kobold is in town today."},
|
||||
"example": {
|
||||
"model": "kcpp",
|
||||
"input": "Niko the Kobold is in town today.",
|
||||
"truncate": true,
|
||||
},
|
||||
"schema": {
|
||||
"properties": {},
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "Not used, depends on loaded kcpp embeddings model."
|
||||
},
|
||||
"input": {
|
||||
"type": "string",
|
||||
"description": "String to convert into embedding vector"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "boolean",
|
||||
"description": "If the string is too long, truncate it. Otherwise, exceeding max embedding size will cause the request to fail."
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
|
@ -1516,7 +1572,115 @@
|
|||
"tags": [
|
||||
"api/extra"
|
||||
],
|
||||
"responses": {"default": {"description": ""}}
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"example":
|
||||
{
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"object": "embedding",
|
||||
"index": 0,
|
||||
"embedding": [
|
||||
0.089203,
|
||||
0.016367,
|
||||
0.062196,
|
||||
-0.045898,
|
||||
-0.019921
|
||||
]
|
||||
}
|
||||
],
|
||||
"model": "embedmodel",
|
||||
"usage": {
|
||||
"prompt_tokens": 100,
|
||||
"total_tokens": 100
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"properties": {},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful request"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"/api/extra/json_to_grammar": {
|
||||
"post": {
|
||||
"summary": "Converts a provided JSON schema into GBNF grammar.",
|
||||
"description": "Converts a provided JSON schema into GBNF grammar. Example schema at [https://platform.openai.com/docs/guides/structured-outputs](https://platform.openai.com/docs/guides/structured-outputs)",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"example": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action_items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Description of the action item."
|
||||
},
|
||||
"due_date": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Due date for the action item, can be null if not specified."
|
||||
},
|
||||
"owner": {
|
||||
"type": ["string", "null"],
|
||||
"description": "Owner responsible for the action item, can be null if not specified."
|
||||
}
|
||||
},
|
||||
"required": ["description", "due_date", "owner"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"description": "List of action items from the meeting."
|
||||
}
|
||||
},
|
||||
"required": ["action_items"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"properties": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"description": "JSON schema representing the desired output format."
|
||||
},
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"tags": [
|
||||
"api/extra"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"example": {
|
||||
"result": "action-items ::= \"[\" space (action-items-item (\",\" space action-items-item)*)? \"]\" space\naction-items-item ::= \"{\" space action-items-item-description-kv \",\" space action-items-item-due-date-kv \",\" space action-items-item-owner-kv \"}\" space\naction-items-item-description-kv ::= \"\\\"description\\\"\" space \":\" space string\naction-items-item-due-date ::= string | null\naction-items-item-due-date-kv ::= \"\\\"due_date\\\"\" space \":\" space action-items-item-due-date\naction-items-item-owner ::= string | null\naction-items-item-owner-kv ::= \"\\\"owner\\\"\" space \":\" space action-items-item-owner\naction-items-kv ::= \"\\\"action_items\\\"\" space \":\" space action-items\nchar ::= [^\"\\\\\\x7F\\x00-\\x1F] | [\\\\] ([\"\\\\bfnrt] | \"u\" [0-9a-fA-F]{4})\nnull ::= \"null\" space\nroot ::= \"{\" space action-items-kv \"}\" space\nspace ::= | \" \" | \"\\n\"{1,2} [ \\t]{0,20}\nstring ::= \"\\\"\" char* \"\\\"\" space",
|
||||
"success": true
|
||||
},
|
||||
"schema": {
|
||||
"properties": {},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful request"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"/api/extra/data/save": {
|
||||
|
@ -1957,7 +2121,9 @@
|
|||
"clip_skip": -1,
|
||||
"sampler_name": "Euler a",
|
||||
"denoising_strength": 0.6,
|
||||
"init_images":["base64_image_data"],
|
||||
"init_images":[],
|
||||
"mask":"",
|
||||
"inpainting_mask_invert":0,
|
||||
},
|
||||
"schema": {
|
||||
"properties": {
|
||||
|
@ -1997,6 +2163,12 @@
|
|||
"type": "string"
|
||||
}
|
||||
},
|
||||
"mask": {
|
||||
"type": "string"
|
||||
},
|
||||
"inpainting_mask_invert": {
|
||||
"type": "string"
|
||||
},
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
|
@ -2186,7 +2358,11 @@
|
|||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"example": {"model": "kcpp", "input": "Niko the Kobold is in town today."},
|
||||
"example": {
|
||||
"model": "kcpp",
|
||||
"input": "Niko the Kobold is in town today.",
|
||||
"truncate": true,
|
||||
},
|
||||
"schema": {
|
||||
"properties": {},
|
||||
"type": "object"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue