-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathai-compat-types_test.go
More file actions
77 lines (71 loc) · 1.93 KB
/
Copy pathai-compat-types_test.go
File metadata and controls
77 lines (71 loc) · 1.93 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
package main
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"os"
"testing"
)
func Test_AiCompatJson(t *testing.T) {
fileData, err := os.ReadFile("testdata/ai-compat.json")
require.Nil(t, err)
var parsed AiCompatJson
err = json.Unmarshal(fileData, &parsed)
require.Nil(t, err)
assert.Equal(t, 4, len(parsed))
expectedGateway := AiCompatEnvelope{
Kind: AiCompatKindGateway,
Title: "Amazon Bedrock",
Preamble: "Through the `@aws-sdk/client-bedrock-runtime` module, we support:",
Footnote: "Note: if a model supports streaming, we also instrument the streaming variant.",
Models: []AiCompatModel{
{
Name: "Claude",
Features: []AiCompatFeature{
{"Text", true},
{"Image", false},
{"Vision", false},
},
},
{
Name: "Cohere",
Features: []AiCompatFeature{
{"Text", true},
{"Image", false},
},
},
},
}
assert.Equal(t, expectedGateway, parsed[0])
expectedAbstraction := AiCompatEnvelope{
Kind: AiCompatKindAbstraction,
Title: "Langchain",
FeaturesPreamble: "The following general features of Langchain are supported:",
ProvidersPreamble: "Models/providers are generally supported transitively by our instrumentation of the provider's module.",
Features: []AiCompatFeature{
{"Agents", true},
{"Chains", true},
{"Vectorstores", true},
{"Tools", true},
},
Providers: []AiCompatProvider{
{"Azure OpenAI", false, false},
{"OpenAI", true, true},
},
}
assert.Equal(t, expectedAbstraction, parsed[2])
expectedSdk := AiCompatEnvelope{
Kind: AiCompatKindSdk,
Title: "OpenAI",
FeaturesPreamble: "Through the `openai` module, we support:",
Features: []AiCompatFeature{
{"Completions", true},
{"Chat", true},
{"Embeddings", true},
{"Files", false},
{"Images", false},
{"Audio", false},
},
}
assert.Equal(t, expectedSdk, parsed[3])
}