Skip to content

Latest commit

 

History

History

README.md

Braintrust Go SDK Examples

This directory contains examples demonstrating how to use the Braintrust Go SDK. Examples are organized by complexity and use case.

Getting Started (5 minutes)

Start here to learn basic tracing with popular AI providers:

  • openai/ - Trace OpenAI chat completions
  • anthropic/ - Trace Anthropic Claude messages
  • genai/ - Trace Google Gemini requests
  • genkit/ - Trace Genkit model generation with middleware

Evaluations (15 minutes)

Learn how to evaluate and improve your AI applications:

  • evals/ - Simple eval with inline dataset and scorers
  • datasets/ - Run evals against downloaded datasets
  • dataset-api/ - Complete workflow: create datasets, use prompts, run evals
  • scorers/ - Custom scoring with online and code-based scorers

Alternative Providers & Libraries

Examples for other AI providers and client libraries:

Advanced Features (30 minutes)

More specialized use cases and integrations:

Internal Examples

The internal/ directory contains comprehensive examples that test all SDK features. These are primarily used for SDK development and validation, not for learning. See internal/README.md for details.

Running Examples

Each example is a standalone Go program. To run an example:

cd examples/openai
go run main.go

Make sure you have the required API keys set as environment variables (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY, BRAINTRUST_API_KEY).