trim whitespace from the beginning and end of a string
| 14 | |
| 15 | // trim whitespace from the beginning and end of a string |
| 16 | static std::string trim(const std::string & str) { |
| 17 | size_t start = 0; |
| 18 | size_t end = str.size(); |
| 19 | while (start < end && isspace(str[start])) { |
| 20 | start += 1; |
| 21 | } |
| 22 | while (end > start && isspace(str[end - 1])) { |
| 23 | end -= 1; |
| 24 | } |
| 25 | return str.substr(start, end - start); |
| 26 | } |
| 27 | |
| 28 | static const std::map<std::string, llm_chat_template> LLM_CHAT_TEMPLATES = { |
| 29 | { "chatml", LLM_CHAT_TEMPLATE_CHATML }, |
no test coverage detected