40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package llm
|
|
|
|
import "testing"
|
|
|
|
func TestApplyReasoningParamsForModernOpenAIModels(t *testing.T) {
|
|
payload := openaiRequest{
|
|
Model: "openai/gpt-5.4",
|
|
Temperature: 0.7,
|
|
MaxTokens: 8192,
|
|
}
|
|
applyReasoningParams(&payload, true)
|
|
|
|
if payload.Temperature != 0 || payload.MaxTokens != 0 {
|
|
t.Fatalf("unsupported parameters were not cleared: %+v", payload)
|
|
}
|
|
if payload.MaxCompletionTokens != 8192 || payload.ReasoningEffort != "medium" {
|
|
t.Fatalf("modern OpenAI parameters were not applied: %+v", payload)
|
|
}
|
|
}
|
|
|
|
func TestApplyReasoningParamsWithoutReasoningEffort(t *testing.T) {
|
|
payload := openaiRequest{Model: "gpt-5.4-mini", Temperature: 0.7, MaxTokens: 4096}
|
|
applyReasoningParams(&payload, false)
|
|
|
|
if payload.MaxCompletionTokens != 4096 || payload.ReasoningEffort != "" {
|
|
t.Fatalf("model compatibility parameters are incorrect: %+v", payload)
|
|
}
|
|
}
|
|
|
|
func TestAnthropicThinkingModels(t *testing.T) {
|
|
for _, model := range []string{"claude-3-7-sonnet", "claude-sonnet-4-6", "claude-opus-4-8", "claude-sonnet-5", "claude-fable-5"} {
|
|
if !isAnthropicThinkingModel(model) {
|
|
t.Fatalf("%q should support thinking parameters", model)
|
|
}
|
|
}
|
|
if isAnthropicThinkingModel("claude-haiku-4-5") {
|
|
t.Fatal("Claude Haiku should not receive thinking parameters")
|
|
}
|
|
}
|