From 8e1a70c6fe0f4686160dfb3c8ea4b72e39ddd7e9 Mon Sep 17 00:00:00 2001 From: Denny Depok <61371551+kodernubie@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:12:32 +0700 Subject: [PATCH 1/3] add attachments in MessageRequest --- messages.go | 9 +++++---- thread.go | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/messages.go b/messages.go index eefc29a36..902363938 100644 --- a/messages.go +++ b/messages.go @@ -52,10 +52,11 @@ type ImageFile struct { } type MessageRequest struct { - Role string `json:"role"` - Content string `json:"content"` - FileIds []string `json:"file_ids,omitempty"` //nolint:revive // backwards-compatibility - Metadata map[string]any `json:"metadata,omitempty"` + Role string `json:"role"` + Content string `json:"content"` + FileIds []string `json:"file_ids,omitempty"` //nolint:revive // backwards-compatibility + Metadata map[string]any `json:"metadata,omitempty"` + Attachments []ThreadAttachment `json:"attachments,omitempty"` } type MessageFile struct { diff --git a/thread.go b/thread.go index bc08e2bcb..0a53e31e8 100644 --- a/thread.go +++ b/thread.go @@ -9,6 +9,12 @@ const ( threadsSuffix = "/threads" ) +const ( + ThreadAttachmentToolCodeInterpreter = "code_interpreter" + ThreadAttachmentToolFunction = "function" + ThreadAttachmentToolFileSearch = "file_search" +) + type Thread struct { ID string `json:"id"` Object string `json:"object"` From 92759690d231e0fbce117c6fe7326a84ec573e6d Mon Sep 17 00:00:00 2001 From: Denny Depok <61371551+kodernubie@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:19:41 +0700 Subject: [PATCH 2/3] Move tools const to message --- messages.go | 5 +++++ thread.go | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/messages.go b/messages.go index 902363938..57dd8fd87 100644 --- a/messages.go +++ b/messages.go @@ -11,6 +11,11 @@ const ( messagesSuffix = "messages" ) +const ( + MessageToolCodeInterpreter = "code_interpreter" + MessageToolFileSearch = "file_search" +) + type Message struct { ID string `json:"id"` Object string `json:"object"` diff --git a/thread.go b/thread.go index 0a53e31e8..bc08e2bcb 100644 --- a/thread.go +++ b/thread.go @@ -9,12 +9,6 @@ const ( threadsSuffix = "/threads" ) -const ( - ThreadAttachmentToolCodeInterpreter = "code_interpreter" - ThreadAttachmentToolFunction = "function" - ThreadAttachmentToolFileSearch = "file_search" -) - type Thread struct { ID string `json:"id"` Object string `json:"object"` From b130e7e78338d1395e5594418d582b3164033cbc Mon Sep 17 00:00:00 2001 From: Denny Depok <61371551+kodernubie@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:35:20 +0700 Subject: [PATCH 3/3] remove const, just use assistanttool const --- messages.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/messages.go b/messages.go index 57dd8fd87..902363938 100644 --- a/messages.go +++ b/messages.go @@ -11,11 +11,6 @@ const ( messagesSuffix = "messages" ) -const ( - MessageToolCodeInterpreter = "code_interpreter" - MessageToolFileSearch = "file_search" -) - type Message struct { ID string `json:"id"` Object string `json:"object"`