Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
text-generation-inference
Commits
08c4184e
"...source/git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "91b05e2ec78e44856d90f4258f91d56807227bac"
Unverified
Commit
08c4184e
authored
Nov 04, 2024
by
drbh
Committed by
GitHub
Nov 04, 2024
Browse files
fix: add chat_tokenize endpoint to api docs (#2710)
parent
6e322052
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletion
+63
-1
docs/openapi.json
docs/openapi.json
+56
-0
router/src/server.rs
router/src/server.rs
+7
-1
No files found.
docs/openapi.json
View file @
08c4184e
...
@@ -101,6 +101,47 @@
...
@@ -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"
:
{
"/generate"
:
{
"post"
:
{
"post"
:
{
"tags"
:
[
"tags"
:
[
...
@@ -1092,6 +1133,21 @@
...
@@ -1092,6 +1133,21 @@
}
}
}
}
},
},
"ChatTokenizeResponse"
:
{
"type"
:
"object"
,
"required"
:
[
"tokenize_response"
,
"templated_text"
],
"properties"
:
{
"templated_text"
:
{
"type"
:
"string"
},
"tokenize_response"
:
{
"$ref"
:
"#/components/schemas/TokenizeResponse"
}
}
},
"Chunk"
:
{
"Chunk"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"required"
:
[
"required"
:
[
...
...
router/src/server.rs
View file @
08c4184e
...
@@ -181,12 +181,16 @@ async fn openai_get_model_info(info: Extension<Info>) -> Json<ModelsInfo> {
...
@@ -181,12 +181,16 @@ async fn openai_get_model_info(info: Extension<Info>) -> Json<ModelsInfo> {
})
})
}
}
/// Template and tokenize ChatRequest
#[utoipa::path(
#[utoipa::path(
post,
post,
tag
=
"Text Generation Inference"
,
tag
=
"Text Generation Inference"
,
path
=
"/chat_tokenize"
,
path
=
"/chat_tokenize"
,
request_body
=
ChatRequest,
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
(
async
fn
get_chat_tokenize
(
Extension
(
infer
):
Extension
<
Infer
>
,
Extension
(
infer
):
Extension
<
Infer
>
,
...
@@ -1501,6 +1505,7 @@ tokenize,
...
@@ -1501,6 +1505,7 @@ tokenize,
metrics,
metrics,
openai_get_model_info,
openai_get_model_info,
sagemaker_compatibility,
sagemaker_compatibility,
get_chat_tokenize,
),
),
components(
components(
schemas(
schemas(
...
@@ -1558,6 +1563,7 @@ Function,
...
@@ -1558,6 +1563,7 @@ Function,
FunctionDefinition,
FunctionDefinition,
ToolChoice,
ToolChoice,
ModelInfo,
ModelInfo,
ChatTokenizeResponse,
)
)
),
),
tags(
tags(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment