llama_ros: llama.cpp for ROS 2
|
Classes | |
struct | LlamaParams |
class | Spinner |
Typedefs | |
typedef void(* | LogFunction) (const char *file, const char *function, int line, const char *text,...) |
Type definition for a logging function. | |
Enumerations | |
enum | LogLevel { ERROR = 0 , WARN , INFO , DEBUG } |
Enum representing different log levels for controlling log verbosity. More... | |
Functions | |
void | declare_llama_params (const rclcpp_lifecycle::LifecycleNode::SharedPtr &node) |
struct LlamaParams | get_llama_params (const rclcpp_lifecycle::LifecycleNode::SharedPtr &node) |
enum ggml_sched_priority | parse_priority (std::string priority) |
struct common_params_sampling | parse_sampling_params (const llama_msgs::msg::SamplingConfig &sampling_config, int n_vocab) |
const char * | extract_filename (const char *path) |
Extracts the filename from a given file path. | |
void | set_log_level (LogLevel log_level) |
Sets the log level for the logs. | |
void | default_log_error (const char *file, const char *function, int line, const char *text,...) |
Default error logging function. | |
void | default_log_warn (const char *file, const char *function, int line, const char *text,...) |
Default warning logging function. | |
void | default_log_info (const char *file, const char *function, int line, const char *text,...) |
Default info logging function. | |
void | default_log_debug (const char *file, const char *function, int line, const char *text,...) |
Default debug logging function. | |
Variables | |
LogFunction | log_error = default_log_error |
Pointer to the error logging function. | |
LogFunction | log_warn = default_log_warn |
Pointer to the warning logging function. | |
LogFunction | log_info = default_log_info |
Pointer to the info logging function. | |
LogFunction | log_debug = default_log_debug |
Pointer to the debug logging function. | |
LogLevel | log_level = INFO |
The current log level for the application. | |
typedef void(* llama_utils::LogFunction) (const char *file, const char *function, int line, const char *text,...) |
Type definition for a logging function.
This type represents a function pointer that takes a file name, function name, line number, log message, and a variable number of additional arguments for formatting the log message.
file | The name of the source file where the log function is called. |
function | The name of the function where the log function is called. |
line | The line number in the source file where the log function is called. |
text | The format string for the log message, similar to printf. |
... | Additional arguments for the format string. |
Enum representing different log levels for controlling log verbosity.
This enum defines the severity levels of logs that can be used to control which log messages should be displayed. The levels are ordered from most severe to least severe. Only logs at or above the current log level will be shown.
void llama_utils::declare_llama_params | ( | const rclcpp_lifecycle::LifecycleNode::SharedPtr & | node | ) |
void llama_utils::default_log_debug | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default debug logging function.
This function logs a debug message to stderr with the format: [DEBUG] [file:function:line] message.
file | The name of the source file where the log function is called. |
function | The name of the function where the log function is called. |
line | The line number in the source file where the log function is called. |
text | The format string for the log message. |
... | Additional arguments for the format string. |
void llama_utils::default_log_error | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default error logging function.
This function logs an error message to stderr with the format: [ERROR] [file:function:line] message.
file | The name of the source file where the log function is called. |
function | The name of the function where the log function is called. |
line | The line number in the source file where the log function is called. |
text | The format string for the log message. |
... | Additional arguments for the format string. |
void llama_utils::default_log_info | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default info logging function.
This function logs an informational message to stderr with the format: [INFO] [file:function:line] message.
file | The name of the source file where the log function is called. |
function | The name of the function where the log function is called. |
line | The line number in the source file where the log function is called. |
text | The format string for the log message. |
... | Additional arguments for the format string. |
void llama_utils::default_log_warn | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default warning logging function.
This function logs a warning message to stderr with the format: [WARN] [file:function:line] message.
file | The name of the source file where the log function is called. |
function | The name of the function where the log function is called. |
line | The line number in the source file where the log function is called. |
text | The format string for the log message. |
... | Additional arguments for the format string. |
|
inline |
Extracts the filename from a given file path.
This function takes a full path to a file and returns just the file name.
path | The full path to the file. |
struct LlamaParams llama_utils::get_llama_params | ( | const rclcpp_lifecycle::LifecycleNode::SharedPtr & | node | ) |
enum ggml_sched_priority llama_utils::parse_priority | ( | std::string | priority | ) |
struct common_params_sampling llama_utils::parse_sampling_params | ( | const llama_msgs::msg::SamplingConfig & | sampling_config, |
int | n_vocab ) |
void llama_utils::set_log_level | ( | LogLevel | log_level | ) |
Sets the log level for the logs.
This function allows the user to specify the log level error, warning, info, or debug.
log_level | Log level. |
LogFunction llama_utils::log_debug = default_log_debug |
Pointer to the debug logging function.
LogFunction llama_utils::log_error = default_log_error |
Pointer to the error logging function.
LogFunction llama_utils::log_info = default_log_info |
Pointer to the info logging function.
The current log level for the application.
This global variable holds the current log level, which determines the verbosity of the logs. Logs at or above this level will be displayed. The default level is set to INFO.
LogFunction llama_utils::log_warn = default_log_warn |
Pointer to the warning logging function.