fix: return vector
This commit is contained in:
parent
c1268ca56a
commit
81fb1c96d7
@ -33,7 +33,7 @@ struct DeltaChoice {
|
|||||||
pub content: String,
|
pub content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn ask(prompt: &str) -> Result<String, Box<dyn std::error::Error>> {
|
pub async fn ask(prompt: &str) -> Result<Vec<Delta>, Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
let mut body = String::new();
|
let mut body = String::new();
|
||||||
body.push_str(r#"{
|
body.push_str(r#"{
|
||||||
@ -66,5 +66,5 @@ pub async fn ask(prompt: &str) -> Result<String, Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
println!("{:?}", deltas);
|
println!("{:?}", deltas);
|
||||||
|
|
||||||
return Ok(deltas.last().unwrap().detail.choices[0].delta.content.clone());
|
return Ok(deltas);
|
||||||
}
|
}
|
@ -7,7 +7,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
let mut response = ask("Hello, world!").await?;
|
let mut response = ask("Hello, world!").await?;
|
||||||
|
|
||||||
println!("{}", response);
|
|
||||||
|
println!("{:?}", response);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user