Skip to content

Commit 1421a08

Browse files
feat: temperature pointer
1 parent ff9d83a commit 1421a08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+91
-87
lines changed

api_integration_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"os"
1111
"testing"
1212

13-
"github.com/sashabaranov/go-openai"
14-
"github.com/sashabaranov/go-openai/internal/test/checks"
15-
"github.com/sashabaranov/go-openai/jsonschema"
13+
"github.com/meguminnnnnnnnn/go-openai"
14+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
15+
"github.com/meguminnnnnnnnn/go-openai/jsonschema"
1616
)
1717

1818
func TestAPI(t *testing.T) {

assistant_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package openai_test
33
import (
44
"context"
55

6-
openai "github.com/sashabaranov/go-openai"
7-
"github.com/sashabaranov/go-openai/internal/test/checks"
6+
openai "github.com/meguminnnnnnnnn/go-openai"
7+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
88

99
"encoding/json"
1010
"fmt"

audio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"net/http"
99
"os"
1010

11-
utils "github.com/sashabaranov/go-openai/internal"
11+
utils "github.com/meguminnnnnnnnn/go-openai/internal"
1212
)
1313

1414
// Whisper Defines the models provided by OpenAI to use when processing audio with OpenAI.

audio_api_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"strings"
1313
"testing"
1414

15-
"github.com/sashabaranov/go-openai"
16-
"github.com/sashabaranov/go-openai/internal/test"
17-
"github.com/sashabaranov/go-openai/internal/test/checks"
15+
"github.com/meguminnnnnnnnn/go-openai"
16+
"github.com/meguminnnnnnnnn/go-openai/internal/test"
17+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
1818
)
1919

2020
// TestAudio Tests the transcription and translation endpoints of the API using the mocked server.

batch_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"reflect"
88
"testing"
99

10-
"github.com/sashabaranov/go-openai"
11-
"github.com/sashabaranov/go-openai/internal/test/checks"
10+
"github.com/meguminnnnnnnnn/go-openai"
11+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
1212
)
1313

1414
func TestUploadBatchFile(t *testing.T) {

chat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ type ChatCompletionRequest struct {
233233
// MaxCompletionTokens An upper bound for the number of tokens that can be generated for a completion,
234234
// including visible output tokens and reasoning tokens https://platform.openai.com/docs/guides/reasoning
235235
MaxCompletionTokens int `json:"max_completion_tokens,omitempty"`
236-
Temperature float32 `json:"temperature,omitempty"`
236+
Temperature *float32 `json:"temperature,omitempty"`
237237
TopP float32 `json:"top_p,omitempty"`
238238
N int `json:"n,omitempty"`
239239
Stream bool `json:"stream,omitempty"`

chat_stream_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"strconv"
1111
"testing"
1212

13-
"github.com/sashabaranov/go-openai"
14-
"github.com/sashabaranov/go-openai/internal/test/checks"
13+
"github.com/meguminnnnnnnnn/go-openai"
14+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
1515
)
1616

1717
func TestChatCompletionsStreamWrongModel(t *testing.T) {

chat_test.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"testing"
1313
"time"
1414

15-
"github.com/sashabaranov/go-openai"
16-
"github.com/sashabaranov/go-openai/internal/test/checks"
17-
"github.com/sashabaranov/go-openai/jsonschema"
15+
"github.com/meguminnnnnnnnn/go-openai"
16+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
17+
"github.com/meguminnnnnnnnn/go-openai/jsonschema"
1818
)
1919

2020
const (
@@ -91,6 +91,10 @@ func TestO1ModelsChatCompletionsDeprecatedFields(t *testing.T) {
9191
}
9292
}
9393

94+
func ptrOf[T any](v T) *T {
95+
return &v
96+
}
97+
9498
func TestO1ModelsChatCompletionsBetaLimitations(t *testing.T) {
9599
tests := []struct {
96100
name string
@@ -119,7 +123,7 @@ func TestO1ModelsChatCompletionsBetaLimitations(t *testing.T) {
119123
Role: openai.ChatMessageRoleAssistant,
120124
},
121125
},
122-
Temperature: float32(2),
126+
Temperature: ptrOf(float32(2)),
123127
},
124128
expectedError: openai.ErrReasoningModelLimitationsOther,
125129
},
@@ -136,7 +140,7 @@ func TestO1ModelsChatCompletionsBetaLimitations(t *testing.T) {
136140
Role: openai.ChatMessageRoleAssistant,
137141
},
138142
},
139-
Temperature: float32(1),
143+
Temperature: ptrOf(float32(1)),
140144
TopP: float32(0.1),
141145
},
142146
expectedError: openai.ErrReasoningModelLimitationsOther,
@@ -154,7 +158,7 @@ func TestO1ModelsChatCompletionsBetaLimitations(t *testing.T) {
154158
Role: openai.ChatMessageRoleAssistant,
155159
},
156160
},
157-
Temperature: float32(1),
161+
Temperature: ptrOf(float32(1)),
158162
TopP: float32(1),
159163
N: 2,
160164
},
@@ -239,7 +243,7 @@ func TestO3ModelsChatCompletionsBetaLimitations(t *testing.T) {
239243
Role: openai.ChatMessageRoleAssistant,
240244
},
241245
},
242-
Temperature: float32(2),
246+
Temperature: ptrOf(float32(2)),
243247
},
244248
expectedError: openai.ErrReasoningModelLimitationsOther,
245249
},
@@ -256,7 +260,7 @@ func TestO3ModelsChatCompletionsBetaLimitations(t *testing.T) {
256260
Role: openai.ChatMessageRoleAssistant,
257261
},
258262
},
259-
Temperature: float32(1),
263+
Temperature: ptrOf(float32(1)),
260264
TopP: float32(0.1),
261265
},
262266
expectedError: openai.ErrReasoningModelLimitationsOther,
@@ -274,7 +278,7 @@ func TestO3ModelsChatCompletionsBetaLimitations(t *testing.T) {
274278
Role: openai.ChatMessageRoleAssistant,
275279
},
276280
},
277-
Temperature: float32(1),
281+
Temperature: ptrOf(float32(1)),
278282
TopP: float32(1),
279283
N: 2,
280284
},

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"net/url"
1111
"strings"
1212

13-
utils "github.com/sashabaranov/go-openai/internal"
13+
utils "github.com/meguminnnnnnnnn/go-openai/internal"
1414
)
1515

1616
// Client is OpenAI GPT-3 API client.

client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"reflect"
1111
"testing"
1212

13-
"github.com/sashabaranov/go-openai/internal/test"
14-
"github.com/sashabaranov/go-openai/internal/test/checks"
13+
"github.com/meguminnnnnnnnn/go-openai/internal/test"
14+
"github.com/meguminnnnnnnnn/go-openai/internal/test/checks"
1515
)
1616

1717
var errTestRequestBuilderFailed = errors.New("test request builder failed")

0 commit comments

Comments
 (0)