Add support for the Google Search tool
- Gemini 2.0 and above use a google_search tool instead of a google_search_retrieval tool. This commit adds support for the new tool.
This commit is contained in:
@@ -29,8 +29,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
println!(
|
||||
"Request: {}",
|
||||
serde_json::to_string_pretty(&request).unwrap()
|
||||
);
|
||||
|
||||
let result = gemini
|
||||
.generate_content(&request, "gemini-1.0-pro-002")
|
||||
.generate_content(&request, "gemini-1.5-flash-002")
|
||||
.await?;
|
||||
|
||||
println!("Response: {:?}", result.candidates[0].get_text().unwrap());
|
||||
|
||||
Reference in New Issue
Block a user