-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes_test.go
More file actions
executable file
·134 lines (127 loc) · 4.17 KB
/
types_test.go
File metadata and controls
executable file
·134 lines (127 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package llmprovider
import (
"digital.vasic.llmprovider/pkg/models"
"testing"
)
func TestProviderCapabilities_DefaultValues(t *testing.T) {
cap := &models.ProviderCapabilities{}
if cap.SupportedModels != nil {
t.Errorf("SupportedModels should be nil, got %v", cap.SupportedModels)
}
if cap.SupportedFeatures != nil {
t.Errorf("SupportedFeatures should be nil, got %v", cap.SupportedFeatures)
}
if cap.SupportedRequestTypes != nil {
t.Errorf("SupportedRequestTypes should be nil, got %v", cap.SupportedRequestTypes)
}
if cap.SupportsStreaming != false {
t.Errorf("SupportsStreaming should be false, got %v", cap.SupportsStreaming)
}
if cap.SupportsFunctionCalling != false {
t.Errorf("SupportsFunctionCalling should be false, got %v", cap.SupportsFunctionCalling)
}
if cap.SupportsVision != false {
t.Errorf("SupportsVision should be false, got %v", cap.SupportsVision)
}
if cap.SupportsTools != false {
t.Errorf("SupportsTools should be false, got %v", cap.SupportsTools)
}
if cap.SupportsSearch != false {
t.Errorf("SupportsSearch should be false, got %v", cap.SupportsSearch)
}
if cap.SupportsReasoning != false {
t.Errorf("SupportsReasoning should be false, got %v", cap.SupportsReasoning)
}
if cap.SupportsCodeCompletion != false {
t.Errorf("SupportsCodeCompletion should be false, got %v", cap.SupportsCodeCompletion)
}
if cap.SupportsCodeAnalysis != false {
t.Errorf("SupportsCodeAnalysis should be false, got %v", cap.SupportsCodeAnalysis)
}
if cap.SupportsRefactoring != false {
t.Errorf("SupportsRefactoring should be false, got %v", cap.SupportsRefactoring)
}
if cap.Limits.MaxTokens != 0 {
t.Errorf("Limits.MaxTokens should be 0, got %v", cap.Limits.MaxTokens)
}
if cap.Limits.MaxInputLength != 0 {
t.Errorf("Limits.MaxInputLength should be 0, got %v", cap.Limits.MaxInputLength)
}
if cap.Limits.MaxOutputLength != 0 {
t.Errorf("Limits.MaxOutputLength should be 0, got %v", cap.Limits.MaxOutputLength)
}
if cap.Limits.MaxConcurrentRequests != 0 {
t.Errorf("Limits.MaxConcurrentRequests should be 0, got %v", cap.Limits.MaxConcurrentRequests)
}
if cap.Metadata != nil {
t.Errorf("Metadata should be nil, got %v", cap.Metadata)
}
}
func TestModelLimits_DefaultValues(t *testing.T) {
limits := &models.ModelLimits{}
if limits.MaxTokens != 0 {
t.Errorf("MaxTokens should be 0, got %v", limits.MaxTokens)
}
if limits.MaxInputLength != 0 {
t.Errorf("MaxInputLength should be 0, got %v", limits.MaxInputLength)
}
if limits.MaxOutputLength != 0 {
t.Errorf("MaxOutputLength should be 0, got %v", limits.MaxOutputLength)
}
if limits.MaxConcurrentRequests != 0 {
t.Errorf("MaxConcurrentRequests should be 0, got %v", limits.MaxConcurrentRequests)
}
}
func TestProviderCapabilities_Validation(t *testing.T) {
tests := []struct {
name string
cap *models.ProviderCapabilities
want bool
}{
{
name: "Valid capabilities",
cap: &models.ProviderCapabilities{
SupportedModels: []string{"gpt-4"},
SupportedFeatures: []string{"chat"},
SupportedRequestTypes: []string{"text_completion"},
SupportsStreaming: true,
SupportsFunctionCalling: true,
SupportsVision: false,
SupportsTools: true,
SupportsSearch: false,
SupportsReasoning: true,
SupportsCodeCompletion: true,
SupportsCodeAnalysis: true,
SupportsRefactoring: false,
Limits: models.ModelLimits{
MaxTokens: 4096,
MaxInputLength: 8192,
MaxOutputLength: 4096,
MaxConcurrentRequests: 10,
},
Metadata: map[string]string{
"provider": "test",
},
},
want: true,
},
{
name: "Empty capabilities",
cap: &models.ProviderCapabilities{
SupportedModels: []string{},
SupportedFeatures: []string{},
SupportedRequestTypes: []string{},
},
want: true, // Empty capabilities are technically valid
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// For now, we just test that the struct can be created
// In a real implementation, you might have validation logic
if tt.cap.SupportedModels == nil && tt.want {
t.Errorf("Expected supported models to be initialized")
}
})
}
}