Add shortcuts for commonly used functions

This commit is contained in:
2024-11-27 15:57:18 +00:00
parent db5a01afef
commit 56d6b95c53
5 changed files with 20 additions and 24 deletions

View File

@@ -16,12 +16,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let prompt = "What is the airspeed of an unladen swallow?";
let request = GenerateContentRequest::builder()
.add_content(
Content::builder()
.role(Role::User)
.add_part(Part::Text(prompt.to_string()))
.build(),
)
.add_text_content(Role::User, prompt)
.build();
let response = gemini.generate_content(&request, "gemini-pro").await?;
println!("Response: {:?}", response.candidates[0].get_text().unwrap());