diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml index 092423821..39526d9a4 100644 --- a/.github/workflows/cortex-cpp-quality-gate.yml +++ b/.github/workflows/cortex-cpp-quality-gate.yml @@ -16,7 +16,7 @@ env: jobs: build-and-test: runs-on: ${{ matrix.runs-on }} - timeout-minutes: 40 + timeout-minutes: 60 strategy: fail-fast: false matrix: diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index d18d28f2d..7ba095d6b 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -43,7 +43,7 @@ if(MSVC) $<$:/MT> #--| ) endif() - + if(LLAMA_CUDA) cmake_minimum_required(VERSION 3.17) diff --git a/engine/controllers/command_line_parser.cc b/engine/controllers/command_line_parser.cc index b4f460261..2c5f79c84 100644 --- a/engine/controllers/command_line_parser.cc +++ b/engine/controllers/command_line_parser.cc @@ -12,13 +12,14 @@ CommandLineParser::CommandLineParser() : app_("Cortex.cpp CLI") {} bool CommandLineParser::SetupCommand(int argc, char** argv) { + std::string model_id; + // Models group commands { auto models_cmd = app_.add_subcommand("models", "Subcommands for managing models"); auto start_cmd = models_cmd->add_subcommand("start", "Start a model by ID"); - std::string model_id; start_cmd->add_option("model_id", model_id, ""); start_cmd->callback([&model_id]() { // TODO(sang) switch to .yaml when implement model manager @@ -67,12 +68,12 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) { models_cmd->add_subcommand("update", "Update configuration of a model"); } + std::string msg; { auto chat_cmd = app_.add_subcommand("chat", "Send a chat request to a model"); - std::string model_id; + chat_cmd->add_option("model_id", model_id, ""); - std::string msg; chat_cmd->add_option("-m,--message", msg, "Message to chat with model"); @@ -92,15 +93,17 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) { auto embeddings_cmd = app_.add_subcommand( "embeddings", "Creates an embedding vector representing the input text"); + // Default version is latest + std::string version{"latest"}; { // engines group commands auto engines_cmd = app_.add_subcommand("engines", "Get cortex engines"); auto list_engines_cmd = engines_cmd->add_subcommand("list", "List all cortex engines"); auto get_engine_cmd = engines_cmd->add_subcommand("get", "Get an engine"); - EngineInstall(engines_cmd, "cortex.llamacpp"); - EngineInstall(engines_cmd, "cortex.onnx"); - EngineInstall(engines_cmd, "cortex.tensorrt-llm"); + EngineInstall(engines_cmd, "cortex.llamacpp", version); + EngineInstall(engines_cmd, "cortex.onnx", version); + EngineInstall(engines_cmd, "cortex.tensorrt-llm", version); } auto run_cmd = @@ -119,17 +122,15 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) { } void CommandLineParser::EngineInstall(CLI::App* parent, - const std::string& engine_name) { + const std::string& engine_name, std::string& version) { auto engine_cmd = parent->add_subcommand(engine_name, "Manage " + engine_name + " engine"); - // Default version is latest - std::string version{"latest"}; auto install_cmd = engine_cmd->add_subcommand( "install", "Install " + engine_name + " engine"); install_cmd->add_option("-v, --version", version, "Engine version. Default will be latest"); - install_cmd->callback([&engine_name, &version] { + install_cmd->callback([engine_name, &version] { commands::EngineInitCmd eic(engine_name, version); eic.Exec(); }); diff --git a/engine/controllers/command_line_parser.h b/engine/controllers/command_line_parser.h index e48ed31b0..b6695346e 100644 --- a/engine/controllers/command_line_parser.h +++ b/engine/controllers/command_line_parser.h @@ -9,7 +9,8 @@ class CommandLineParser { bool SetupCommand(int argc, char** argv); private: - void EngineInstall(CLI::App* parent, const std::string& engine_name); + void EngineInstall(CLI::App* parent, const std::string& engine_name, + std::string& version); CLI::App app_; }; \ No newline at end of file