From b47bdd5d777ee310f4a5407ebe7a10f30062c224 Mon Sep 17 00:00:00 2001 From: leiwen83 Date: Mon, 30 Oct 2023 10:31:46 +0800 Subject: [PATCH] fix: align with fastchat mainstream (#670) Fastchat mainstream change its return format, and text now is only string in choices structure. So make this change, to work with mainstream fastchat. Signed-off-by: Lei Wen Co-authored-by: Lei Wen --- crates/http-api-bindings/src/fastchat.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/http-api-bindings/src/fastchat.rs b/crates/http-api-bindings/src/fastchat.rs index a2bf97a..fe0839d 100644 --- a/crates/http-api-bindings/src/fastchat.rs +++ b/crates/http-api-bindings/src/fastchat.rs @@ -20,7 +20,7 @@ struct Response { #[derive(Deserialize)] struct Prediction { - text: Vec, + text: String, } pub struct FastChatEngine { @@ -83,7 +83,7 @@ impl TextGeneration for FastChatEngine { let resp: Response = resp.json().await.expect("Failed to parse response"); - resp.choices[0].text[0].clone() + resp.choices[0].text.clone() } async fn generate_stream(