From 74c02f1d04af62696aab69b2fbba1e749a9a3ead Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 19 Jun 2024 17:55:07 +0100 Subject: [PATCH] IMPROVE: pretty the json objects in log output --- lib/discourse_chatbot/bots/open_ai_bot_rag.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/discourse_chatbot/bots/open_ai_bot_rag.rb b/lib/discourse_chatbot/bots/open_ai_bot_rag.rb index 907f56a..b533990 100644 --- a/lib/discourse_chatbot/bots/open_ai_bot_rag.rb +++ b/lib/discourse_chatbot/bots/open_ai_bot_rag.rb @@ -111,7 +111,7 @@ def create_chat_completion(messages, use_functions = true, iteration) ::DiscourseChatbot.progress_debug_message <<~EOS I called the LLM to help me ------------------------------ - value of messages is: #{messages} + value of messages is: #{JSON.pretty_generate(messages)} +++++++++++++++++++++++++++++++ EOS parameters = { @@ -142,7 +142,7 @@ def create_chat_completion(messages, use_functions = true, iteration) ::DiscourseChatbot.progress_debug_message <<~EOS +++++++++++++++++++++++++++++++++++++++ The llm responded with - #{res} + #{JSON.pretty_generate(res)} +++++++++++++++++++++++++++++++++++++++ EOS res @@ -248,8 +248,8 @@ def call_function(func_name, args_str, opts) ::DiscourseChatbot.progress_debug_message <<~EOS +++++++++++++++++++++++++++++++++++++++ I used '#{func_name}' to help me - args_str was '#{args_str}' - opts was '#{opts}' + args_str was '#{JSON.pretty_generate(args_str)}' + opts was '#{JSON.pretty_generate(opts)}' +++++++++++++++++++++++++++++++++++++++ EOS begin