fix: add chat_tokenize endpoint to api docs (#2710)

This commit is contained in:
drbh 2024-11-04 00:44:59 -05:00 committed by GitHub
parent 6e3220529d
commit 08c4184eb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 63 additions and 1 deletions

View File

@ -101,6 +101,47 @@
}
}
},
"/chat_tokenize": {
"post": {
"tags": [
"Text Generation Inference"
],
"summary": "Template and tokenize ChatRequest",
"operationId": "get_chat_tokenize",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Templated and tokenized ChatRequest",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatTokenizeResponse"
}
}
}
},
"404": {
"description": "Failed to tokenize ChatRequest",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/generate": {
"post": {
"tags": [
@ -1092,6 +1133,21 @@
}
}
},
"ChatTokenizeResponse": {
"type": "object",
"required": [
"tokenize_response",
"templated_text"
],
"properties": {
"templated_text": {
"type": "string"
},
"tokenize_response": {
"$ref": "#/components/schemas/TokenizeResponse"
}
}
},
"Chunk": {
"type": "object",
"required": [

View File

@ -181,12 +181,16 @@ async fn openai_get_model_info(info: Extension<Info>) -> Json<ModelsInfo> {
})
}
/// Template and tokenize ChatRequest
#[utoipa::path(
post,
tag = "Text Generation Inference",
path = "/chat_tokenize",
request_body = ChatRequest,
responses((status = 200, description = "Templated and tokenized ChatRequest", body = ChatTokenizeResponse))
responses(
(status = 200, description = "Templated and tokenized ChatRequest", body = ChatTokenizeResponse),
(status = 404, description = "Failed to tokenize ChatRequest", body = ErrorResponse),
)
)]
async fn get_chat_tokenize(
Extension(infer): Extension<Infer>,
@ -1501,6 +1505,7 @@ tokenize,
metrics,
openai_get_model_info,
sagemaker_compatibility,
get_chat_tokenize,
),
components(
schemas(
@ -1558,6 +1563,7 @@ Function,
FunctionDefinition,
ToolChoice,
ModelInfo,
ChatTokenizeResponse,
)
),
tags(