| 109 | } |
| 110 | |
| 111 | int ModelRunner::ProcessPrompt(const std::string& prompt, std::ostream* output, int max_new_tokens) { |
| 112 | if (output == nullptr) { |
| 113 | output = &std::cout; |
| 114 | } |
| 115 | |
| 116 | #ifdef LLM_SUPPORT_VISION |
| 117 | #ifndef OPENCV_NOT_AVAILABLE |
| 118 | // Check if prompt contains video tags |
| 119 | std::regex video_regex("<video>(.*?)</video>"); |
| 120 | std::smatch match; |
| 121 | if (std::regex_search(prompt, match, video_regex)) { |
| 122 | return ProcessVideoPrompt(prompt, output); |
| 123 | } |
| 124 | #endif |
| 125 | #endif |
| 126 | llm_->response(prompt, output, nullptr, max_new_tokens); |
| 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | #ifdef LLM_SUPPORT_VISION |
| 131 | #ifndef OPENCV_NOT_AVAILABLE |