From 1b71330cea426d0c1b7ec16b3294fec39f6fb125 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 7 May 2025 16:48:56 -0300 Subject: [PATCH] FIX: Correct prompt format for img2text used in our AI Bot PDF Rag pipeline (#1323) --- lib/utils/image_to_text.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/utils/image_to_text.rb b/lib/utils/image_to_text.rb index d2433feb..e3400388 100644 --- a/lib/utils/image_to_text.rb +++ b/lib/utils/image_to_text.rb @@ -127,14 +127,15 @@ class DiscourseAi::Utils::ImageToText messages = [ { type: :user, - content: + content: [ "The following text was extracted from an image using OCR. Please enhance, correct, and structure this content while maintaining the original text:\n\n#{raw_text}", - upload_ids: [page.id], + { upload_id: page.id }, + ], }, ] else messages = [ - { type: :user, content: "Please OCR the content in the image.", upload_ids: [page.id] }, + { type: :user, content: ["Please OCR the content in the image.", { upload_id: page.id }] }, ] end prompt = DiscourseAi::Completions::Prompt.new(system_message, messages: messages)