ai_json_template/ai_json_template_for_string.rs
1// ---------------- [ File: ai-json-template/src/ai_json_template_for_string.rs ]
2crate::ix!();
3
4impl AiJsonTemplate for String {
5
6 fn to_template() -> JsonValue {
7 trace!("AiJsonTemplate::to_template for Vec<String>");
8
9 // We add disclaimers about how to produce an array of strings:
10 // - Must be a JSON array, e.g. ["A", "B", "C"]
11 // - No extra keys or objects
12 // - Provide real string elements, not null or numeric
13 let mut root = serde_json::Map::new();
14 root.insert("type".to_string(), JsonValue::String("string".to_string()));
15 JsonValue::Object(root)
16 }
17}