bd sync: 2025-12-23 22:33:32

This commit is contained in:
Steve Yegge
2025-12-23 22:33:33 -08:00
parent a10f580bbe
commit 2de1695615
77 changed files with 8319 additions and 7677 deletions

View File

@@ -38,7 +38,7 @@ type HaikuClient struct {
}
// NewHaikuClient creates a new Haiku API client. Env var ANTHROPIC_API_KEY takes precedence over explicit apiKey.
func NewHaikuClient(apiKey string) (*HaikuClient, error) {
func NewHaikuClient(apiKey string, opts ...option.RequestOption) (*HaikuClient, error) {
envKey := os.Getenv("ANTHROPIC_API_KEY")
if envKey != "" {
apiKey = envKey
@@ -47,7 +47,10 @@ func NewHaikuClient(apiKey string) (*HaikuClient, error) {
return nil, fmt.Errorf("%w: set ANTHROPIC_API_KEY environment variable or provide via config", ErrAPIKeyRequired)
}
client := anthropic.NewClient(option.WithAPIKey(apiKey))
// Build options: API key first, then any additional options (for testing)
allOpts := []option.RequestOption{option.WithAPIKey(apiKey)}
allOpts = append(allOpts, opts...)
client := anthropic.NewClient(allOpts...)
tier1Tmpl, err := template.New("tier1").Parse(tier1PromptTemplate)
if err != nil {