config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	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_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