mirror of
https://github.com/katanemo/plano.git
synced 2026-05-15 11:02:39 +02:00
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:
parent
ed6a9139e6
commit
2cd5ec5adf
6 changed files with 89 additions and 133 deletions
|
|
@ -61,15 +61,6 @@ pub struct ToolsDefinition {
|
|||
pub parameters: ToolParameters,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct BoltFCResponse {
|
||||
pub model: String,
|
||||
pub message: open_ai::Message,
|
||||
pub done_reason: String,
|
||||
pub done: bool,
|
||||
pub resolver_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum IntOrString {
|
||||
|
|
@ -118,24 +109,34 @@ pub mod open_ai {
|
|||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub model: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Choice {
|
||||
pub finish_reason: String,
|
||||
pub index: usize,
|
||||
pub message: Message,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ChatCompletionsResponse {
|
||||
pub usage: Usage,
|
||||
pub choices: Vec<Choice>,
|
||||
pub model: String
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Usage {
|
||||
pub completions_tokens: usize,
|
||||
pub completion_tokens: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ChatCompletionChunkResponse {
|
||||
pub model: String,
|
||||
pub choices: Vec<Choice>,
|
||||
pub choices: Vec<ChunkChoice>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Choice {
|
||||
pub struct ChunkChoice {
|
||||
pub delta: Delta,
|
||||
// TODO: could this be an enum?
|
||||
pub finish_reason: Option<String>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue