From e88f5f0797a8262362cc57ba19e602b5d8656ece Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Wed, 4 Dec 2024 21:11:41 -0500 Subject: [PATCH] chore: make ImagePayload a pointer so that omitempty works as expected Signed-off-by: Donnie Adams --- .../pkg/datastore/documentloader/ocr/openai/openai.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/knowledge/pkg/datastore/documentloader/ocr/openai/openai.go b/knowledge/pkg/datastore/documentloader/ocr/openai/openai.go index 1850071a..1b1a6434 100644 --- a/knowledge/pkg/datastore/documentloader/ocr/openai/openai.go +++ b/knowledge/pkg/datastore/documentloader/ocr/openai/openai.go @@ -35,13 +35,13 @@ type OpenAIOCR struct { } type ImagePayload struct { - URL string `json:"url"` + URL string `json:"url,omitempty"` } type MessageContent struct { - Type string `json:"type"` - Text string `json:"text,omitempty"` - ImageURL ImagePayload `json:"image_url,omitempty"` + Type string `json:"type"` + Text string `json:"text,omitempty"` + ImageURL *ImagePayload `json:"image_url,omitempty"` } type Message struct { @@ -260,7 +260,7 @@ func (o *OpenAIOCR) SendImageToOpenAI(ctx context.Context, base64Image string) ( Role: "user", Content: []MessageContent{ {Type: "text", Text: o.Prompt}, - {Type: "image_url", ImageURL: ImagePayload{URL: "data:image/png;base64," + base64Image}}, + {Type: "image_url", ImageURL: &ImagePayload{URL: "data:image/png;base64," + base64Image}}, }, }, },