From ea49d59870cbdec605c6372ad8c71fe2aa2426c8 Mon Sep 17 00:00:00 2001 From: lowjiansheng <15527690+lowjiansheng@users.noreply.github.com> Date: Mon, 22 Sep 2025 16:23:18 +0800 Subject: [PATCH 01/10] add prefix field to messages --- messages.go | 1 + 1 file changed, 1 insertion(+) diff --git a/messages.go b/messages.go index 3852d2e37..c2eb4c70e 100644 --- a/messages.go +++ b/messages.go @@ -22,6 +22,7 @@ type Message struct { AssistantID *string `json:"assistant_id,omitempty"` RunID *string `json:"run_id,omitempty"` Metadata map[string]any `json:"metadata"` + Prefix bool `json:"prefix"` httpHeader } From 23aa25174f404b0cebd700956b1a529188cbb675 Mon Sep 17 00:00:00 2001 From: lowjiansheng <15527690+lowjiansheng@users.noreply.github.com> Date: Mon, 22 Sep 2025 16:23:54 +0800 Subject: [PATCH 02/10] move for ordering --- messages.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/messages.go b/messages.go index c2eb4c70e..47eb0cd89 100644 --- a/messages.go +++ b/messages.go @@ -22,9 +22,11 @@ type Message struct { AssistantID *string `json:"assistant_id,omitempty"` RunID *string `json:"run_id,omitempty"` Metadata map[string]any `json:"metadata"` - Prefix bool `json:"prefix"` httpHeader + + // Messari custom fields + Prefix bool `json:"prefix"` } type MessagesList struct { From 0dcdacfebf63ba6748deea4fc0b584469106bbcb Mon Sep 17 00:00:00 2001 From: lowjiansheng <15527690+lowjiansheng@users.noreply.github.com> Date: Mon, 22 Sep 2025 16:27:31 +0800 Subject: [PATCH 03/10] clean up PR template --- .github/PULL_REQUEST_TEMPLATE.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 222c065ce..14974f601 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,3 @@ -A similar PR may already be submitted! -Please search among the [Pull request](https://github.com/sashabaranov/go-openai/pulls) before creating one. - -If your changes introduce breaking changes, please prefix the title of your pull request with "[BREAKING_CHANGES]". This allows for clear identification of such changes in the 'What's Changed' section on the release page, making it developer-friendly. - -Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. - **Describe the change** Please provide a clear and concise description of the changes you're proposing. Explain what problem it solves or what feature it adds. @@ -19,5 +12,3 @@ Briefly describe how you have tested these changes. If possible — please add i **Additional context** Add any other context or screenshots or logs about your pull request here. If the pull request relates to an open issue, please link to it. - -Issue: #XXXX From 6bd476301b87eeb301b9e7aef11a12ef5bdb010e Mon Sep 17 00:00:00 2001 From: lowjiansheng <15527690+lowjiansheng@users.noreply.github.com> Date: Mon, 22 Sep 2025 16:28:23 +0800 Subject: [PATCH 04/10] make the comments --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 14974f601..605690056 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,14 +1,14 @@ **Describe the change** -Please provide a clear and concise description of the changes you're proposing. Explain what problem it solves or what feature it adds. + **Provide OpenAI documentation link** -Provide a relevant API doc from https://platform.openai.com/docs/api-reference + **Describe your solution** -Describe how your changes address the problem or how they add the feature. This should include a brief description of your approach and any new libraries or dependencies you're using. + **Tests** -Briefly describe how you have tested these changes. If possible — please add integration tests. + **Additional context** -Add any other context or screenshots or logs about your pull request here. If the pull request relates to an open issue, please link to it. + From b4a54cb631a23f38c2bb353b92504becd5295791 Mon Sep 17 00:00:00 2001 From: Low Jian Sheng <15527690+lowjiansheng@users.noreply.github.com> Date: Tue, 23 Sep 2025 02:19:35 +0800 Subject: [PATCH 05/10] add github rules (#3) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 77b85e519..a7bf6a681 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +# Github Forked Branch Rules +`master` - kept in sync with main repository. Do not merge anything into this branch other than sync code. +`develop` - default branch of this forked repository. Merge all PRs into this branch. +`release` - only release from this branch. Merge the `develop` into `release` branch before doing a tagged release. + # Go OpenAI [![Go Reference](https://pkg.go.dev/badge/github.com/sashabaranov/go-openai.svg)](https://pkg.go.dev/github.com/sashabaranov/go-openai) [![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-openai)](https://goreportcard.com/report/github.com/sashabaranov/go-openai) From e9196ceaf4e77491bd68a267a7953abc0f39d8ea Mon Sep 17 00:00:00 2001 From: Low Jian Sheng <15527690+lowjiansheng@users.noreply.github.com> Date: Tue, 23 Sep 2025 12:03:50 +0800 Subject: [PATCH 06/10] add prefix to chat completion messages (#4) --- chat.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chat.go b/chat.go index 0aa018715..8b8172ded 100644 --- a/chat.go +++ b/chat.go @@ -119,6 +119,9 @@ type ChatCompletionMessage struct { // For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool. ToolCallID string `json:"tool_call_id,omitempty"` + + // Messari custom fields + Prefix bool `json:"prefix"` } func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { From db5ae74c3704e5a097e76b3c6b8b12ecde879db1 Mon Sep 17 00:00:00 2001 From: Low Jian Sheng <15527690+lowjiansheng@users.noreply.github.com> Date: Tue, 23 Sep 2025 02:19:35 +0800 Subject: [PATCH 07/10] add github rules (#3) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 77b85e519..a7bf6a681 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +# Github Forked Branch Rules +`master` - kept in sync with main repository. Do not merge anything into this branch other than sync code. +`develop` - default branch of this forked repository. Merge all PRs into this branch. +`release` - only release from this branch. Merge the `develop` into `release` branch before doing a tagged release. + # Go OpenAI [![Go Reference](https://pkg.go.dev/badge/github.com/sashabaranov/go-openai.svg)](https://pkg.go.dev/github.com/sashabaranov/go-openai) [![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-openai)](https://goreportcard.com/report/github.com/sashabaranov/go-openai) From bf5afba52bd24663a2a3cafe3faef5d8e3519afe Mon Sep 17 00:00:00 2001 From: Low Jian Sheng <15527690+lowjiansheng@users.noreply.github.com> Date: Tue, 23 Sep 2025 12:03:50 +0800 Subject: [PATCH 08/10] add prefix to chat completion messages (#4) --- chat.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chat.go b/chat.go index 0aa018715..8b8172ded 100644 --- a/chat.go +++ b/chat.go @@ -119,6 +119,9 @@ type ChatCompletionMessage struct { // For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool. ToolCallID string `json:"tool_call_id,omitempty"` + + // Messari custom fields + Prefix bool `json:"prefix"` } func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { From 2cf63a9f93f3821f41a7f59c448385fb73c3de42 Mon Sep 17 00:00:00 2001 From: Low Jian Sheng <15527690+lowjiansheng@users.noreply.github.com> Date: Tue, 23 Sep 2025 12:47:43 +0800 Subject: [PATCH 09/10] Fix compilation error with ChatCompletionMessage (#6) --- chat.go | 6 +++++- messages.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/chat.go b/chat.go index 8b8172ded..2a53c1697 100644 --- a/chat.go +++ b/chat.go @@ -121,7 +121,7 @@ type ChatCompletionMessage struct { ToolCallID string `json:"tool_call_id,omitempty"` // Messari custom fields - Prefix bool `json:"prefix"` + Prefix bool `json:"prefix,omitempty"` } func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { @@ -139,6 +139,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }(m) return json.Marshal(msg) } @@ -153,6 +154,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }(m) return json.Marshal(msg) } @@ -168,6 +170,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }{} if err := json.Unmarshal(bs, &msg); err == nil { @@ -184,6 +187,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }{} if err := json.Unmarshal(bs, &multiMsg); err != nil { return err diff --git a/messages.go b/messages.go index 47eb0cd89..538833f54 100644 --- a/messages.go +++ b/messages.go @@ -26,7 +26,7 @@ type Message struct { httpHeader // Messari custom fields - Prefix bool `json:"prefix"` + Prefix bool `json:"prefix,omitempty"` } type MessagesList struct { From f3a969e335f8e1fa13ce85e85ce1171103326277 Mon Sep 17 00:00:00 2001 From: lowjiansheng <15527690+lowjiansheng@users.noreply.github.com> Date: Wed, 19 Nov 2025 19:15:44 +0800 Subject: [PATCH 10/10] add name to toolcall --- chat.go | 1 + 1 file changed, 1 insertion(+) diff --git a/chat.go b/chat.go index 2a53c1697..f1b77ba30 100644 --- a/chat.go +++ b/chat.go @@ -202,6 +202,7 @@ type ToolCall struct { ID string `json:"id,omitempty"` Type ToolType `json:"type"` Function FunctionCall `json:"function"` + Name string `json:"name,omitempty"` } type FunctionCall struct {