1package providertests
2
3import (
4 "net/http"
5 "testing"
6
7 "github.com/charmbracelet/fantasy/ai"
8 "github.com/charmbracelet/fantasy/bedrock"
9 "gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
10)
11
12// const defaultBaseURL = "https://fantasy-playground-resource.services.ai.azure.com/"
13
14func TestBedrockCommon(t *testing.T) {
15 testCommon(t, []builderPair{
16 {"bedrock-anthropic-claude-v2", builderBedrockClaudeV2(t), nil},
17 })
18}
19
20// func TestBedrockThinking(t *testing.T) {
21// opts := ai.ProviderOptions{
22// bedrock.Name: &bedrock.ProviderOptions{
23// ReasoningEffort: openai.ReasoningEffortOption(openai.ReasoningEffortLow),
24// },
25// }
26// testThinking(t, []builderPair{
27// {"bedrock-anthropic-claude-v2", builderBedrockClaudeV2(t), opts},
28// }, testBedrockThinking)
29// }
30
31// func testBedrockThinking(t *testing.T, result *ai.AgentResult) {
32// require.Greater(t, result.Response.Usage.ReasoningTokens, int64(0), "expected reasoning tokens, got none")
33// }
34
35func builderBedrockClaudeV2(t *testing.T) func(r *recorder.Recorder) (ai.LanguageModel, error) {
36 return func(r *recorder.Recorder) (ai.LanguageModel, error) {
37 provider, err := bedrock.New(
38 t.Context(),
39 bedrock.WithHTTPClient(&http.Client{Transport: r}),
40 )
41 if err != nil {
42 return nil, err
43 }
44 // return provider.LanguageModel("anthropic.claude-sonnet-4-5-20250929-v1:0")
45 return provider.LanguageModel("us.anthropic.claude-3-sonnet-20240229-v1:0")
46 }
47}