mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
Fix run object
This commit is contained in:
@ -57,53 +57,13 @@ pub struct AssistantObject {
|
|||||||
pub model: String,
|
pub model: String,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub instructions: Option<String>,
|
pub instructions: Option<String>,
|
||||||
pub tools: Vec<Tools>,
|
pub tools: Vec<types::Tools>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub tool_resources: Option<ToolResource>,
|
pub tool_resources: Option<ToolResource>,
|
||||||
pub metadata: Option<HashMap<String, String>>,
|
pub metadata: Option<HashMap<String, String>>,
|
||||||
pub headers: Option<HashMap<String, String>>,
|
pub headers: Option<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
||||||
#[serde(tag = "type")]
|
|
||||||
#[serde(rename_all = "snake_case")]
|
|
||||||
pub enum Tools {
|
|
||||||
CodeInterpreter,
|
|
||||||
FileSearch(ToolsFileSearch),
|
|
||||||
Function(ToolsFunction),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
||||||
pub struct ToolsFileSearch {
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub file_search: Option<ToolsFileSearchObject>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
||||||
pub struct ToolsFunction {
|
|
||||||
pub function: types::Function,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
||||||
pub struct ToolsFileSearchObject {
|
|
||||||
pub max_num_results: Option<u8>,
|
|
||||||
pub ranking_options: Option<FileSearchRankingOptions>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
||||||
pub struct FileSearchRankingOptions {
|
|
||||||
pub ranker: Option<FileSearchRanker>,
|
|
||||||
pub score_threshold: Option<f32>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
||||||
pub enum FileSearchRanker {
|
|
||||||
#[serde(rename = "auto")]
|
|
||||||
Auto,
|
|
||||||
#[serde(rename = "default_2024_08_21")]
|
|
||||||
Default2024_08_21,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
pub struct ToolResource {
|
pub struct ToolResource {
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use super::types;
|
||||||
use crate::impl_builder_methods;
|
use crate::impl_builder_methods;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone)]
|
#[derive(Debug, Serialize, Clone)]
|
||||||
@ -95,7 +96,7 @@ pub struct RunObject {
|
|||||||
pub completed_at: Option<i64>,
|
pub completed_at: Option<i64>,
|
||||||
pub model: String,
|
pub model: String,
|
||||||
pub instructions: Option<String>,
|
pub instructions: Option<String>,
|
||||||
pub tools: Vec<HashMap<String, String>>,
|
pub tools: Vec<types::Tools>,
|
||||||
pub metadata: HashMap<String, String>,
|
pub metadata: HashMap<String, String>,
|
||||||
pub headers: Option<HashMap<String, String>>,
|
pub headers: Option<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
@ -45,3 +45,43 @@ pub struct JSONSchemaDefine {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub items: Option<Box<JSONSchemaDefine>>,
|
pub items: Option<Box<JSONSchemaDefine>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
|
#[serde(tag = "type")]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum Tools {
|
||||||
|
CodeInterpreter,
|
||||||
|
FileSearch(ToolsFileSearch),
|
||||||
|
Function(ToolsFunction),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
|
pub struct ToolsFileSearch {
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub file_search: Option<ToolsFileSearchObject>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
|
pub struct ToolsFunction {
|
||||||
|
pub function: Function,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
|
pub struct ToolsFileSearchObject {
|
||||||
|
pub max_num_results: Option<u8>,
|
||||||
|
pub ranking_options: Option<FileSearchRankingOptions>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
|
pub struct FileSearchRankingOptions {
|
||||||
|
pub ranker: Option<FileSearchRanker>,
|
||||||
|
pub score_threshold: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
|
pub enum FileSearchRanker {
|
||||||
|
#[serde(rename = "auto")]
|
||||||
|
Auto,
|
||||||
|
#[serde(rename = "default_2024_08_21")]
|
||||||
|
Default2024_08_21,
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user