Remove Option

This commit is contained in:
Dongri Jin
2023-07-25 11:48:52 +09:00
parent 8280733f05
commit a0c319cd54
8 changed files with 20 additions and 21 deletions

View File

@ -9,7 +9,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
model: chat_completion::GPT4.to_string(),
messages: vec![chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: Some(String::from("What is Bitcoin?")),
content: String::from("What is Bitcoin?"),
name: None,
function_call: None,
}],

View File

@ -7,7 +7,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
let req = CompletionRequest {
model: completion::GPT3_TEXT_DAVINCI_003.to_string(),
prompt: Some(String::from("What is Bitcoin?")),
prompt: String::from("What is Bitcoin?"),
suffix: None,
max_tokens: Some(3000),
temperature: Some(0.9),

View File

@ -34,18 +34,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
model: chat_completion::GPT3_5_TURBO_0613.to_string(),
messages: vec![chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: Some(String::from("What is the price of Ethereum?")),
content: String::from("What is the price of Ethereum?"),
name: None,
function_call: None,
}],
functions: Some(vec![chat_completion::Function {
name: String::from("get_coin_price"),
description: Some(String::from("Get the price of a cryptocurrency")),
parameters: Some(chat_completion::FunctionParameters {
parameters: chat_completion::FunctionParameters {
schema_type: chat_completion::JSONSchemaType::Object,
properties: Some(properties),
required: Some(vec![String::from("coin")]),
}),
},
}]),
function_call: Some("auto".to_string()),
temperature: None,

View File

@ -34,18 +34,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
model: chat_completion::GPT3_5_TURBO_0613.to_string(),
messages: vec![chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: Some(String::from("What is the price of Ethereum?")),
content: String::from("What is the price of Ethereum?"),
name: None,
function_call: None,
}],
functions: Some(vec![chat_completion::Function {
name: String::from("get_coin_price"),
description: Some(String::from("Get the price of a cryptocurrency")),
parameters: Some(chat_completion::FunctionParameters {
parameters: chat_completion::FunctionParameters {
schema_type: chat_completion::JSONSchemaType::Object,
properties: Some(properties),
required: Some(vec![String::from("coin")]),
}),
},
}]),
function_call: None,
temperature: None,
@ -86,13 +86,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
messages: vec![
chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::user,
content: Some(String::from("What is the price of Ethereum?")),
content: String::from("What is the price of Ethereum?"),
name: None,
function_call: None,
},
chat_completion::ChatCompletionMessage {
role: chat_completion::MessageRole::function,
content: Some({
content: ({
let price = get_coin_price(&coin).await;
format!("{{\"price\": {}}}", price)
}),