Skip to content

Commit

Permalink
fix: the object should be pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
genglixia committed Oct 29, 2024
1 parent 52cdd83 commit e036684
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions chat_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ type ChatCompletionTokenLogprobTopLogprob struct {
}

type ChatCompletionStreamChoice struct {
Index int `json:"index"`
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
Logprobs ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`
FinishReason FinishReason `json:"finish_reason"`
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
Index int `json:"index"`
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
Logprobs *ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`
FinishReason FinishReason `json:"finish_reason"`
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
}

type PromptFilterResult struct {
Expand Down
6 changes: 3 additions & 3 deletions chat_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func TestCreateChatCompletionStreamWithLogprobs(t *testing.T) {
{
Index: 0,
Delta: openai.ChatCompletionStreamChoiceDelta{},
Logprobs: openai.ChatCompletionStreamChoiceLogprobs{
Logprobs: &openai.ChatCompletionStreamChoiceLogprobs{
Content: []openai.ChatCompletionTokenLogprob{},
},
},
Expand All @@ -552,7 +552,7 @@ func TestCreateChatCompletionStreamWithLogprobs(t *testing.T) {
Delta: openai.ChatCompletionStreamChoiceDelta{
Content: "Hello",
},
Logprobs: openai.ChatCompletionStreamChoiceLogprobs{
Logprobs: &openai.ChatCompletionStreamChoiceLogprobs{
Content: []openai.ChatCompletionTokenLogprob{
{
Token: "Hello",
Expand All @@ -577,7 +577,7 @@ func TestCreateChatCompletionStreamWithLogprobs(t *testing.T) {
Delta: openai.ChatCompletionStreamChoiceDelta{
Content: " World",
},
Logprobs: openai.ChatCompletionStreamChoiceLogprobs{
Logprobs: &openai.ChatCompletionStreamChoiceLogprobs{
Content: []openai.ChatCompletionTokenLogprob{
{
Token: " World",
Expand Down

0 comments on commit e036684

Please sign in to comment.