use openai standard response in arch-fc and in gradio client (#62)

* use openai standard response in arch-fc and in gradio client

also fix code bug in usage

* fix int test
This commit is contained in:
Adil Hafeez 2024-09-19 12:19:14 -07:00 committed by GitHub
parent ed6a9139e6
commit 2cd5ec5adf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 89 additions and 133 deletions

View file

@ -9,7 +9,8 @@ use proxy_wasm_test_framework::types::{
Action, BufferType, LogLevel, MapType, MetricType, ReturnType,
};
use public_types::common_types::{
open_ai::Message, BoltFCResponse, BoltFCToolsCall, IntOrString, ToolCallDetail,
open_ai::{ChatCompletionsResponse, Choice, Message, Usage},
BoltFCToolsCall, IntOrString, ToolCallDetail,
};
use public_types::{common_types::ZeroShotClassificationResponse, configuration::Configuration};
use serial_test::serial;
@ -426,16 +427,20 @@ fn request_ratelimited() {
tool_calls: tool_call_detail,
};
let bolt_fc_resp = BoltFCResponse {
model: String::from("test"),
message: Message {
role: String::from("system"),
content: Some(serde_json::to_string(&boltfc_tools_call).unwrap()),
model: None,
let bolt_fc_resp = ChatCompletionsResponse {
usage: Usage {
completion_tokens: 0,
},
done_reason: String::from("test"),
done: true,
resolver_name: None,
choices: vec![Choice {
finish_reason: "test".to_string(),
index: 0,
message: Message {
role: "system".to_string(),
content: Some(serde_json::to_string(&boltfc_tools_call).unwrap()),
model: None,
},
}],
model: String::from("test"),
};
let bolt_fc_resp_str = serde_json::to_string(&bolt_fc_resp).unwrap();
@ -535,16 +540,20 @@ fn request_not_ratelimited() {
tool_calls: tool_call_detail,
};
let bolt_fc_resp = BoltFCResponse {
model: String::from("test"),
message: Message {
role: String::from("system"),
content: Some(serde_json::to_string(&boltfc_tools_call).unwrap()),
model: None,
let bolt_fc_resp = ChatCompletionsResponse {
usage: Usage {
completion_tokens: 0,
},
done_reason: String::from("test"),
done: true,
resolver_name: None,
choices: vec![Choice {
finish_reason: "test".to_string(),
index: 0,
message: Message {
role: "system".to_string(),
content: Some(serde_json::to_string(&boltfc_tools_call).unwrap()),
model: None,
},
}],
model: String::from("test"),
};
let bolt_fc_resp_str = serde_json::to_string(&bolt_fc_resp).unwrap();