Skip to content
Open
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
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ require (
cloud.google.com/go/vertexai v0.13.3
github.com/DaRealFreak/cloudflare-bp-go v1.0.4
github.com/EDDYCJY/fake-useragent v0.2.0
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.3
github.com/anthropics/anthropic-sdk-go v1.14.0
github.com/browserutils/kooky v0.2.4
github.com/cohesion-org/deepseek-go v1.2.7
github.com/gocolly/colly v1.2.0
github.com/itchyny/gojq v0.12.17
github.com/microcosm-cc/bluemonday v1.0.27
github.com/rs/zerolog v1.33.0
github.com/sashabaranov/go-openai v1.38.1
github.com/sashabaranov/go-openai v1.41.2
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.19.0
google.golang.org/api v0.221.0
Expand Down Expand Up @@ -86,7 +86,7 @@ require (
golang.org/x/crypto v0.40.0 // indirect
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.34.0 // indirect
golang.org/x/text v0.27.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ github.com/antchfx/xpath v1.3.3 h1:tmuPQa1Uye0Ym1Zn65vxPgfltWb/Lxu2jeqIGteJSRs=
github.com/antchfx/xpath v1.3.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.3 h1:b5t1ZJMvV/l99y4jbz7kRFdUp3BSDkI8EhSlHczivtw=
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.3/go.mod h1:AapDW22irxK2PSumZiQXYUFvsdQgkwIWlpESweWZI/c=
github.com/anthropics/anthropic-sdk-go v1.14.0 h1:EzNQvnZlaDHe2UPkoUySDz3ixRgNbwKdH8KtFpv7pi4=
github.com/anthropics/anthropic-sdk-go v1.14.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
Expand Down Expand Up @@ -155,6 +157,8 @@ github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d h1:hrujxIzL1woJ7
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU=
github.com/sashabaranov/go-openai v1.38.1 h1:TtZabbFQZa1nEni/IhVtDF/WQjVqDgd+cWR5OeddzF8=
github.com/sashabaranov/go-openai v1.38.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sashabaranov/go-openai v1.41.2 h1:vfPRBZNMpnqu8ELsclWcAvF19lDNgh1t6TVfFFOPiSM=
github.com/sashabaranov/go-openai v1.41.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
Expand Down Expand Up @@ -241,6 +245,8 @@ golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
10 changes: 7 additions & 3 deletions pkg/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var OpenAiModels = []string{
openai.O120241217, // Knowledge Cutoff: Oct 01, 2023
openai.O3Mini20250131, // Knowledge Cutoff: Oct 01, 2023
openai.GPT4Dot5Preview20250227, // Knowledge Cutoff: Oct 01, 2023
openai.GPT5Mini, // Knowledge Cutoff: May 31, 2024
}

var GoogleModels = []string{
Expand All @@ -34,11 +35,14 @@ var GoogleModels = []string{
"gemini-2.0-flash-001",
"gemini-2.0-pro-exp-02-05",
"gemini-2.5-pro-exp-03-25",
"gemini-2.5-pro",
"gemini-2.5-flash",
}

var AnthropicModels = []string{
anthropic.ModelClaude_3_Opus_20240229, // Training data cut-off: Aug 2023
anthropic.ModelClaude3_7Sonnet20250219, // Training data cut-off: Nov 2024 (knowledge cut-off date is the end of October 2024)
string(anthropic.ModelClaude_3_Opus_20240229), // Training data cut-off: Aug 2023
string(anthropic.ModelClaude3_7Sonnet20250219), // Training data cut-off: Nov 2024 (knowledge cut-off date is the end of October 2024)
string(anthropic.ModelClaudeSonnet4_5_20250929), // Training data cut-off: Jul 2025
}

var DeepseekModels = []string{
Expand All @@ -50,7 +54,7 @@ var XaiModels = []string{
"grok-2-1212", // The grok-2-1212 models have a knowledge cutoff date of July 17, 2024.
"grok-3-latest", // The grok 3 model family have a knowledge cutoff date of November 17, 2024 (made available on April 18, 2025).
"grok-3-mini-latest",

"grok-code-fast-1-0825",
}

var supportedModels []string
Expand Down
28 changes: 13 additions & 15 deletions prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func promptAnthropic(q Question, lang, modelName, params string) (*Solution, err
Thinking struct {
Type string `json:"type"`
BudgetTokens int `json:"budget_tokens"`
}
} `json:"thinking"`
}
if params != "" {
err = json.Unmarshal([]byte(params), &customParams)
Expand All @@ -377,26 +377,20 @@ func promptAnthropic(q Question, lang, modelName, params string) (*Solution, err
}

messageParams := anthropic.MessageNewParams{
Model: modelName,
Model: anthropic.Model(modelName),
Temperature: anthropic.Float(0.0),
Messages: []anthropic.MessageParam{{
Role: anthropic.MessageParamRoleUser,
Content: []anthropic.ContentBlockParamUnion{{
OfRequestTextBlock: &anthropic.TextBlockParam{Text: prompt},
}},
}},
MaxTokens: 4096,
Messages: []anthropic.MessageParam{anthropic.NewUserMessage(anthropic.NewTextBlock(prompt))},
MaxTokens: 4096,
}
if customParams.MaxTokens > 0 {
messageParams.MaxTokens = int64(customParams.MaxTokens)
}
if customParams.Thinking.Type == "enabled" {
messageParams.Thinking = anthropic.ThinkingConfigParamUnion{
OfThinkingConfigEnabled: &anthropic.ThinkingConfigEnabledParam{
Type: "enabled",
BudgetTokens: int64(customParams.Thinking.BudgetTokens),
},
budgetTokens := int64(0)
if customParams.Thinking.BudgetTokens > 0 {
budgetTokens = int64(customParams.Thinking.BudgetTokens)
}
messageParams.Thinking = anthropic.ThinkingConfigParamOfEnabled(budgetTokens)
messageParams.Temperature = anthropic.Float(1.0)
}

Expand All @@ -410,8 +404,12 @@ func promptAnthropic(q Question, lang, modelName, params string) (*Solution, err
log.Trace().Msgf("Got response:\n%+v", resp.Content)
answer := ""
for _, block := range resp.Content {
if block.Text != "" {
switch block.Type {
case "text":
answer += block.Text + "\n"
case "thinking":
// Skip thinking blocks for the final answer
continue
}
}

Expand Down