MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / ensure_embed_model_loaded

Method ensure_embed_model_loaded

src/server/rest_handler.cpp:440–460  ·  view source on GitHub ↗

@brief Ensure the embed model is loaded @param model_tag the model tag

Source from the content-addressed store, hash-verified

438///@brief Ensure the embed model is loaded
439///@param model_tag the model tag
440void RestHandler::ensure_embed_model_loaded(const std::string& model_tag) {
441#ifndef FASTFLOWLM_LINUX_LIMITED_MODELS
442 std::string ensure_tag = model_tag;
443 if (!this->downloader.is_model_downloaded(ensure_tag)) {
444 this->downloader.pull_model(ensure_tag);
445 }
446 auto [embedding_model_tag, auto_embedding_engine] = get_auto_embedding_model(ensure_tag, &this->npu_device_inst);
447 this->auto_embedding_engine = std::move(auto_embedding_engine);
448 auto [new_embedding_model_tag, embedding_model_info] = this->supported_models.get_model_info(embedding_model_tag);
449 std::string embedding_model_path = this->supported_models.get_model_path(new_embedding_model_tag);
450 try {
451 this->auto_embedding_engine->load_model(embedding_model_path, embedding_model_info, this->preemption);
452 }
453 catch (const std::exception& e) {
454 header_print("ERROR", "Failed to load embedding model: " + std::string(e.what()));
455 exit(EXIT_FAILURE);
456 }
457#else
458 throw std::runtime_error("Embedding models are not supported in this build");
459#endif
460}
461
462///@brief Configure chat engine parameters from options and request
463///@param options the options JSON object

Callers

nothing calls this directly

Calls 6

get_auto_embedding_modelFunction · 0.85
is_model_downloadedMethod · 0.80
pull_modelMethod · 0.80
get_model_infoMethod · 0.80
get_model_pathMethod · 0.80
load_modelMethod · 0.45

Tested by

no test coverage detected