mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
b787131c82
Add support for AWS Bedrock as an LLM provider using the Converse API. The implementation is behind a build tag (-tags bedrock) to keep the default binary size small. Features: - AWS SDK v2 with automatic credential chain (env vars, profiles, IAM roles) - Converse API for unified access to Claude, Llama, Mistral models - Tool/function calling support with proper document handling - Image support with base64 decoding and size limits - Request timeout configuration - Region validation and endpoint resolution for all AWS partitions Usage: go build -tags bedrock model: bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0 api_base: us-east-1 (or full endpoint URL)
36 lines
938 B
Go
36 lines
938 B
Go
//go:build !bedrock
|
|
|
|
// PicoClaw - Ultra-lightweight personal AI agent
|
|
// License: MIT
|
|
//
|
|
// Copyright (c) 2026 PicoClaw contributors
|
|
|
|
package bedrock
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNewProvider_ReturnsStubError(t *testing.T) {
|
|
provider, err := NewProvider(context.Background())
|
|
|
|
assert.Nil(t, provider)
|
|
require.Error(t, err)
|
|
assert.True(t, strings.Contains(err.Error(), "build with -tags bedrock"),
|
|
"error should mention build tag requirement, got: %s", err.Error())
|
|
}
|
|
|
|
func TestNewProvider_WithOptions_ReturnsStubError(t *testing.T) {
|
|
provider, err := NewProvider(context.Background(), WithRegion("us-west-2"), WithProfile("test"))
|
|
|
|
assert.Nil(t, provider)
|
|
require.Error(t, err)
|
|
assert.True(t, strings.Contains(err.Error(), "build with -tags bedrock"),
|
|
"error should mention build tag requirement, got: %s", err.Error())
|
|
}
|