@brief Ensure the embed model is loaded @param model_tag the model tag
| 438 | ///@brief Ensure the embed model is loaded |
| 439 | ///@param model_tag the model tag |
| 440 | void 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 |
nothing calls this directly
no test coverage detected