Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cortex-cpp-quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(MSVC)
$<$<CONFIG:Release>:/MT> #--|
)
endif()

if(LLAMA_CUDA)
cmake_minimum_required(VERSION 3.17)

Expand Down
21 changes: 11 additions & 10 deletions engine/controllers/command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <model_id>.yaml when implement model manager
Expand Down Expand Up @@ -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");

Expand All @@ -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 =
Expand All @@ -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();
});
Expand Down
3 changes: 2 additions & 1 deletion engine/controllers/command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
};