Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewGemini() (*gemini.Client, error) {
return gemini.New(
gemini.WithToken(viper.GetString("openai.api_key")),
gemini.WithModel(viper.GetString("openai.model")),
gemini.WithMaxTokens(viper.GetInt("openai.max_tokens")),
gemini.WithMaxTokens(viper.GetInt32("openai.max_tokens")),
gemini.WithTemperature(float32(viper.GetFloat64("openai.temperature"))),
gemini.WithTopP(float32(viper.GetFloat64("openai.top_p"))),
)
Expand Down
4 changes: 2 additions & 2 deletions gemini/gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
type Client struct {
client *genai.GenerativeModel
model string
maxTokens int
maxTokens int32
temperature float32
topP float32
debug bool
Expand Down Expand Up @@ -106,7 +106,7 @@ func New(opts ...Option) (c *Client, err error) {
}

engine.client = client.GenerativeModel(engine.model)
engine.client.MaxOutputTokens = util.Int32Ptr(int32(engine.maxTokens))
engine.client.MaxOutputTokens = util.Int32Ptr(engine.maxTokens)
engine.client.Temperature = util.Float32Ptr(engine.temperature)
engine.client.TopP = util.Float32Ptr(engine.topP)

Expand Down
4 changes: 2 additions & 2 deletions gemini/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func WithModel(val string) Option {
// WithMaxTokens returns a new Option that sets the max tokens for the client configuration.
// The maximum number of tokens to generate in the chat completion.
// The total length of input tokens and generated tokens is limited by the model's context length.
func WithMaxTokens(val int) Option {
func WithMaxTokens(val int32) Option {
if val <= 0 {
val = defaultMaxTokens
}
Expand Down Expand Up @@ -83,7 +83,7 @@ func WithTopP(val float32) Option {
type config struct {
token string
model string
maxTokens int
maxTokens int32
temperature float32
topP float32
}
Expand Down