Extend ai function to encourage specific output
(ai_func: fn(&str) -> &'static str, func_input: &str)
| 18 | |
| 19 | // Extend ai function to encourage specific output |
| 20 | pub fn extend_ai_function(ai_func: fn(&str) -> &'static str, func_input: &str) -> Message { |
| 21 | let ai_function_str: &str = ai_func(func_input); |
| 22 | |
| 23 | // Extend the string to encourage only printing the output |
| 24 | let msg: String = format!( |
| 25 | "FUNCTION: {} |
| 26 | INSTRUCTION: You are a function printer. You ONLY print the results of functions. |
| 27 | Nothing else. No commentary. Here is the input to the function: {}. |
| 28 | Print out what the function will return.", |
| 29 | ai_function_str, func_input |
| 30 | ); |
| 31 | |
| 32 | // Return message |
| 33 | Message { |
| 34 | role: "system".to_string(), |
| 35 | content: msg, |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | // Performs call to LLM GPT |
| 40 | pub async fn ai_task_request( |
no outgoing calls