use crate::models::*;
pub fn create_request() -> GenerateContentRequest {
GenerateContentRequest {
contents: vec![Content {
parts: vec![Part {
text: "Write a hello world program in Python".to_string(),
}],
role: "user".to_string(),
}],
generation_config: GenerationConfig {
response_modalities: vec!["TEXT".to_string()],
temperature: 2.0,
max_output_tokens: 8192,
top_p: 1.0,
response_mime_type: "application/json".to_string(),
response_schema: ResponseSchema {
schema_type: "OBJECT".to_string(),
properties: ResponseProperties {
response: ResponseProperty {
property_type: "STRING".to_string(),
},
},
},
},
safety_settings: create_safety_settings(),
}
}
pub fn create_safety_settings() -> Vec<SafetySetting> {
vec![
SafetySetting {
category: HarmCategory::HarmCategoryHateSpeech,
threshold: HarmBlockThreshold::Off,
},
SafetySetting {
category: HarmCategory::HarmCategoryDangerousContent,
threshold: HarmBlockThreshold::Off,
},
SafetySetting {
category: HarmCategory::HarmCategorySexuallyExplicit,
threshold: HarmBlockThreshold::Off,
},
SafetySetting {
category: HarmCategory::HarmCategoryHarassment,
threshold: HarmBlockThreshold::Off,
},
]
}