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 1/3] 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 2/3] 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 3/3] 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 {