-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,64 @@ | ||
#include "engine_get_cmd.h" | ||
#include <iostream> | ||
#include <tabulate/table.hpp> | ||
#include "utils/file_manager_utils.h" | ||
#include "utils/logging_utils.h" | ||
|
||
namespace commands { | ||
|
||
void EngineGetCmd::Exec() const {} | ||
void EngineGetCmd::Exec() const { | ||
CTL_INF("[EneingeGetCmd] engine: " << engine_); | ||
|
||
auto ecp = file_manager_utils::GetEnginesContainerPath(); | ||
std::string onnx_status{"not_supported"}; | ||
std::string llamacpp_status = std::filesystem::exists(ecp / "cortex.llamacpp") | ||
? "ready" | ||
: "not_initialized"; | ||
std::string tenssorrt_status{"not_supported"}; | ||
|
||
#ifdef _WIN32 | ||
onnx_status = std::filesystem::exists(ecp / "cortex.onnx") | ||
? "ready" | ||
: "not_initialized"; | ||
tenssort_status = std::filesystem::exists(ecp / "cortex.tensorrt-llm") | ||
? "ready" | ||
: "not_initialized"; | ||
#elif defined(__linux__) | ||
tenssort_status = std::filesystem::exists(ecp / "cortex.tensorrt-llm") | ||
? "ready" | ||
: "not_initialized"; | ||
#endif | ||
std::vector<EngineInfo> engines = { | ||
{.name = "cortex.onnx", | ||
.description = "This extension enables chat completion API calls using " | ||
"the Onnx engine", | ||
.version = "0.0.1", | ||
.product_name = "Onnx Inference Engine", | ||
.status = onnx_status}, | ||
{.name = "cortex.llamacpp", | ||
.description = "This extension enables chat completion API calls using " | ||
"the LlamaCPP engine", | ||
.version = "0.0.1", | ||
.product_name = "LlamaCPP Inference Engine", | ||
.status = llamacpp_status}, | ||
{.name = "cortex.tensorrt-llm", | ||
.description = "This extension enables chat completion API calls using " | ||
"the TensorrtLLM engine", | ||
.version = "0.0.1", | ||
.product_name = "TensorrtLLM Inference Engine", | ||
.status = tenssorrt_status}, | ||
}; | ||
|
||
tabulate::Table table; | ||
table.add_row({"name", "description", "version", "product name", "status"}); | ||
table.format().font_color(tabulate::Color::green); | ||
for (auto& engine : engines) { | ||
if (engine.name == engine_) { | ||
table.add_row({engine.name, engine.description, engine.version, | ||
engine.product_name, engine.status}); | ||
} | ||
} | ||
|
||
std::cout << table << std::endl; | ||
} | ||
}; // namespace commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
namespace commands { | ||
class EngineGetCmd { | ||
struct EngineInfo { | ||
std::string name; | ||
std::string description; | ||
std::string version; | ||
std::string product_name; | ||
std::string status; | ||
}; | ||
|
||
public: | ||
EngineGetCmd(const std::string& engine) : engine_{engine} {}; | ||
|
||
void Exec() const; | ||
|
||
private: | ||
std::string engine_; | ||
}; | ||
|
||
} // namespace commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters