config

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration management for the Braintrust SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIKey             string
	APIURL             string
	AppURL             string
	OrgName            string
	DefaultProjectID   string
	DefaultProjectName string
	BlockingLogin      bool

	// Tracing configuration
	FilterAISpans          bool
	EnableBuiltinAdkTraces bool // if false (default), drop Google ADK native spans to avoid duplicates
	EnableTraceConsoleLog  bool // log traces to stdout for debugging
	SpanFilterFuncs        []SpanFilterFunc
	Exporter               trace.SpanExporter

	// Logger
	Logger logger.Logger
}

Config holds immutable configuration for the Braintrust SDK.

func FromEnv

func FromEnv() *Config

FromEnv loads configuration from environment variables with defaults.

Supported environment variables:

  • BRAINTRUST_API_KEY: API key for authentication
  • BRAINTRUST_API_URL: API endpoint URL (default: "https://api.braintrust.dev")
  • BRAINTRUST_APP_URL: Application URL (default: "https://www.braintrust.dev")
  • BRAINTRUST_ORG_NAME: Organization name
  • BRAINTRUST_DEFAULT_PROJECT_ID: Default project ID
  • BRAINTRUST_DEFAULT_PROJECT: Default project name (default: "default-go-project")
  • BRAINTRUST_BLOCKING_LOGIN: Enable blocking login (default: false)
  • BRAINTRUST_ENABLE_TRACE_CONSOLE_LOG: Log traces to stdout for debugging (default: false)
  • BRAINTRUST_OTEL_FILTER_AI_SPANS: Filter to keep only AI-related spans (default: false)
  • BRAINTRUST_OTEL_ENABLE_BUILTIN_ADK_TRACES: Enable exporting spans from Google ADK's built-in telemetry (default: false)

func (*Config) IsValid

func (c *Config) IsValid() error

IsValid checks if the configuration has all required fields. Returns an error if any required field is missing.

type SpanFilterFunc

type SpanFilterFunc func(span trace.ReadOnlySpan) int

SpanFilterFunc is a function that decides which spans to send to Braintrust. Return >0 to keep the span, <0 to drop the span, or 0 to not influence the decision.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL