Make content role optional
This commit is contained in:
@@ -15,16 +15,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
location_id,
|
||||
);
|
||||
|
||||
let system_instruction = "Answer as if you were Winston Churchill";
|
||||
let system_instruction = "Answer as if you were Yoda";
|
||||
let prompt = "What is the airspeed of an unladen swallow?";
|
||||
|
||||
let request = GenerateContentRequest {
|
||||
contents: vec![Content {
|
||||
role: "user".to_string(),
|
||||
role: Some("user".to_string()),
|
||||
parts: Some(vec![Part::Text(prompt.to_string())]),
|
||||
}],
|
||||
system_instruction: Some(Content {
|
||||
role: "system".to_string(),
|
||||
role: None,
|
||||
parts: Some(vec![Part::Text(system_instruction.to_string())]),
|
||||
}),
|
||||
..Default::default()
|
||||
|
||||
Reference in New Issue
Block a user