MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / eval_message

Function eval_message

tools/mtmd/mtmd-cli.cpp:231–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231static int eval_message(mtmd_cli_context & ctx, common_chat_msg & msg) {
232 bool add_bos = ctx.chat_history.empty();
233 auto formatted_chat = chat_add_and_format(ctx, msg);
234 LOG_DBG("formatted_chat.prompt: %s\n", formatted_chat.c_str());
235
236 mtmd_input_text text;
237 text.text = formatted_chat.c_str();
238 text.add_special = add_bos;
239 text.parse_special = true;
240
241 if (g_is_interrupted) return 0;
242
243 mtmd::input_chunks chunks(mtmd_input_chunks_init());
244 auto bitmaps_c_ptr = ctx.bitmaps.c_ptr();
245 int32_t res = mtmd_tokenize(ctx.ctx_vision.get(),
246 chunks.ptr.get(), // output
247 &text, // text
248 bitmaps_c_ptr.data(),
249 bitmaps_c_ptr.size());
250 if (res != 0) {
251 LOG_ERR("Unable to tokenize prompt, res = %d\n", res);
252 return 1;
253 }
254
255 ctx.bitmaps.entries.clear();
256
257 llama_pos new_n_past;
258 if (mtmd_helper_eval_chunks(ctx.ctx_vision.get(),
259 ctx.lctx, // lctx
260 chunks.ptr.get(), // chunks
261 ctx.n_past, // n_past
262 0, // seq_id
263 ctx.n_batch, // n_batch
264 true, // logits_last
265 &new_n_past)) {
266 LOG_ERR("Unable to eval prompt\n");
267 return 1;
268 }
269
270 ctx.n_past = new_n_past;
271
272 LOG("\n");
273
274 return 0;
275}
276
277int main(int argc, char ** argv) {
278 std::setlocale(LC_NUMERIC, "C");

Callers 1

mainFunction · 0.85

Calls 10

mtmd_input_chunks_initFunction · 0.85
mtmd_tokenizeFunction · 0.85
mtmd_helper_eval_chunksFunction · 0.85
c_ptrMethod · 0.80
chat_add_and_formatFunction · 0.70
emptyMethod · 0.45
getMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected