返回 DeepSeek-Reasonix
reasoning_protocol_test.go
根目录 / internal / provider / anthropic / reasoning_protocol_test.go
1 package anthropic
2
3 import (
4 "strings"
5 "testing"
6
7 "reasonix/internal/provider"
8 )
9
10 func TestNewHonorsExplicitDeepSeekReasoningProtocol(t *testing.T) {
11 tests := []struct {
12 name string
13 baseURL string
14 protocol string
15 want bool
16 }{
17 {name: "custom opt in", baseURL: "https://gateway.example/v1", protocol: "deepseek", want: true},
18 {name: "custom auto", baseURL: "https://gateway.example/v1", protocol: "auto", want: false},
19 {name: "official auto", baseURL: "https://api.deepseek.com/anthropic", protocol: "auto", want: true},
20 {name: "official opt out", baseURL: "https://api.deepseek.com/anthropic", protocol: "none", want: false},
21 }
22 for _, tc := range tests {
23 t.Run(tc.name, func(t *testing.T) {
24 p, err := New(provider.Config{
25 Name: "gateway", BaseURL: tc.baseURL, Model: "deepseek-v4-flash", APIKey: "k",
26 Extra: map[string]any{"reasoning_protocol": tc.protocol, "thinking": "enabled", "vision": true},
27 })
28 if err != nil {
29 t.Fatal(err)
30 }
31 c := p.(*client)
32 if c.deepseek != tc.want {
33 t.Fatalf("deepseek replay = %v, want %v", c.deepseek, tc.want)
34 }
35 if strings.Contains(tc.baseURL, "gateway.example") && !c.vision {
36 t.Fatal("custom replay opt-in must not inherit official text-only constraint")
37 }
38 })
39 }
40 }
41
41 lines GO