Module: Langchain::Colorizer

Defined in:
lib/langchain.rb

Class Method Summary collapse

Class Method Details

.blue(str) ⇒ Object



105
106
107
# File 'lib/langchain.rb', line 105

def blue(str)
  "\e[34m#{str}\e[0m"
end

.colorize_logger_msg(msg, severity) ⇒ Object



109
110
111
112
113
114
115
# File 'lib/langchain.rb', line 109

def colorize_logger_msg(msg, severity)
  return msg unless msg.is_a?(String)

  return red(msg) if severity.to_sym == :ERROR
  return yellow(msg) if severity.to_sym == :WARN
  msg
end

.green(str) ⇒ Object



97
98
99
# File 'lib/langchain.rb', line 97

def green(str)
  "\e[32m#{str}\e[0m"
end

.red(str) ⇒ Object



93
94
95
# File 'lib/langchain.rb', line 93

def red(str)
  "\e[31m#{str}\e[0m"
end

.yellow(str) ⇒ Object



101
102
103
# File 'lib/langchain.rb', line 101

def yellow(str)
  "\e[33m#{str}\e[0m"
end