Skip to content

Commit 603cdcc

Browse files
authored
Merge pull request #1399 from krissetto/disable-thinking-for-title-generation
Disable thinking for title generation
2 parents 0a6dbb4 + c7bc840 commit 603cdcc

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

pkg/model/provider/clone.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ func CloneWithOptions(ctx context.Context, base Provider, opts ...options.Opt) P
2525
opt(tempOpts)
2626
mt := tempOpts.MaxTokens()
2727
modelConfig.MaxTokens = &mt
28+
if t := tempOpts.Thinking(); t != nil && !*t {
29+
modelConfig.ThinkingBudget = nil
30+
}
2831
}
2932

3033
clone, err := New(ctx, &modelConfig, config.Env, mergedOpts...)

pkg/model/provider/options/options.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type ModelOptions struct {
1010
generatingTitle bool
1111
maxTokens int64
1212
providers map[string]latest.ProviderConfig
13+
thinking *bool
1314
}
1415

1516
func (c *ModelOptions) Gateway() string {
@@ -32,6 +33,10 @@ func (c *ModelOptions) Providers() map[string]latest.ProviderConfig {
3233
return c.providers
3334
}
3435

36+
func (c *ModelOptions) Thinking() *bool {
37+
return c.thinking
38+
}
39+
3540
type Opt func(*ModelOptions)
3641

3742
func WithGateway(gateway string) Opt {
@@ -64,6 +69,12 @@ func WithProviders(providers map[string]latest.ProviderConfig) Opt {
6469
}
6570
}
6671

72+
func WithThinking(enabled bool) Opt {
73+
return func(cfg *ModelOptions) {
74+
cfg.thinking = &enabled
75+
}
76+
}
77+
6778
// FromModelOptions converts a concrete ModelOptions value into a slice of
6879
// Opt configuration functions. Later Opts override earlier ones when applied.
6980
func FromModelOptions(m ModelOptions) []Opt {

pkg/runtime/title_generator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func (t *titleGenerator) generate(ctx context.Context, sess *session.Session, ev
5555
options.WithStructuredOutput(nil),
5656
options.WithMaxTokens(20),
5757
options.WithGeneratingTitle(),
58+
options.WithThinking(false),
5859
)
5960

6061
newTeam := team.New(

0 commit comments

Comments
 (0)