[router]: Add Embedding routing logic (#10129)

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Waël Boukhobza <wawa_wael@live.fr>
This commit is contained in:
Jintao Zhang
2025-09-15 09:44:35 +08:00
committed by GitHub
parent dcee42c200
commit f9ee6ae17a
17 changed files with 452 additions and 69 deletions

View File

@@ -1090,10 +1090,14 @@ mod responses_endpoint_tests {
let app = ctx.create_app().await;
// First create a response to obtain an id
let resp_id = "test-get-resp-id-123";
let payload = json!({
"input": "Hello Responses API",
"model": "mock-model",
"stream": false
"stream": false,
"store": true,
"background": true,
"request_id": resp_id
});
let req = Request::builder()
.method("POST")
@@ -1103,11 +1107,6 @@ mod responses_endpoint_tests {
.unwrap();
let resp = app.clone().oneshot(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::OK);
let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
.await
.unwrap();
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
let resp_id = body_json["id"].as_str().unwrap().to_string();
// Retrieve the response
let req = Request::builder()
@@ -1140,10 +1139,14 @@ mod responses_endpoint_tests {
let app = ctx.create_app().await;
// First create a response to obtain an id
let resp_id = "test-cancel-resp-id-456";
let payload = json!({
"input": "Hello Responses API",
"model": "mock-model",
"stream": false
"stream": false,
"store": true,
"background": true,
"request_id": resp_id
});
let req = Request::builder()
.method("POST")
@@ -1153,11 +1156,6 @@ mod responses_endpoint_tests {
.unwrap();
let resp = app.clone().oneshot(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::OK);
let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
.await
.unwrap();
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
let resp_id = body_json["id"].as_str().unwrap().to_string();
// Cancel the response
let req = Request::builder()