Skip to content

Commit 1b71330

Browse files
authored
FIX: Correct prompt format for img2text used in our AI Bot PDF Rag pipeline (#1323)
1 parent f090065 commit 1b71330

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/utils/image_to_text.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,15 @@ def extract_text_from_page(page)
127127
messages = [
128128
{
129129
type: :user,
130-
content:
130+
content: [
131131
"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}",
132-
upload_ids: [page.id],
132+
{ upload_id: page.id },
133+
],
133134
},
134135
]
135136
else
136137
messages = [
137-
{ type: :user, content: "Please OCR the content in the image.", upload_ids: [page.id] },
138+
{ type: :user, content: ["Please OCR the content in the image.", { upload_id: page.id }] },
138139
]
139140
end
140141
prompt = DiscourseAi::Completions::Prompt.new(system_message, messages: messages)

0 commit comments

Comments
 (0)