mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
cargo clippy
This commit is contained in:
@ -44,7 +44,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let result = client.retrieve_file_content(file_id).await?;
|
||||
let s = match str::from_utf8(&result) {
|
||||
Ok(v) => v.to_string(),
|
||||
Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
|
||||
Err(e) => panic!("Invalid UTF-8 sequence: {e}"),
|
||||
};
|
||||
let json_value: Value = from_str(&s)?;
|
||||
let result_json = to_string_pretty(&json_value)?;
|
||||
|
@ -86,7 +86,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let coin = c.coin;
|
||||
if name == "get_coin_price" {
|
||||
let price = get_coin_price(&coin);
|
||||
println!("{} price: {}", coin, price);
|
||||
println!("{coin} price: {price}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,9 +79,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let arguments = function_call.arguments.clone().unwrap();
|
||||
let c: Currency = serde_json::from_str(&arguments)?;
|
||||
let coin = c.coin;
|
||||
println!("coin: {}", coin);
|
||||
println!("coin: {coin}");
|
||||
let price = get_coin_price(&coin);
|
||||
println!("price: {}", price);
|
||||
println!("price: {price}");
|
||||
|
||||
let req = ChatCompletionRequest::new(
|
||||
GPT4_O.to_string(),
|
||||
@ -99,7 +99,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
role: chat_completion::MessageRole::function,
|
||||
content: chat_completion::Content::Text({
|
||||
let price = get_coin_price(&coin);
|
||||
format!("{{\"price\": {}}}", price)
|
||||
format!("{{\"price\": {price}}}")
|
||||
}),
|
||||
name: Some(String::from("get_coin_price")),
|
||||
tool_calls: None,
|
||||
|
Reference in New Issue
Block a user