hello can you give me a suggestion how to fix this? i think i am giving json string in wrong format
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct Gpt3Response {
completions: Vec<Gpt3Completion>,
}
#[derive(Serialize, Deserialize)]
struct Gpt3Completion {
text: String,
}
fn main() {
let api_key = "mykey";
let prompt = "What is the capital of France?";
let model = "text-davinci-002";
let client = reqwest::blocking::Client::new();
let mut response = client
.post("https://api.openai.com/v1/engines/davinci/completions")
.header("Content-Type", "application/json")
.header("Authorization", format!("Bearer {}", api_key))
.json("{
"prompt": prompt,
"model": model,
"max_tokens": 100,
}")
.send();
let json: Gpt3Response = response.unwrap().json().unwrap();
let text = &json.completions[0].text;
println!("{}", text);
}