|
| 1 | +package dev.braintrust; |
| 2 | + |
| 3 | +import dev.braintrust.api.BraintrustApiClient; |
| 4 | +import dev.braintrust.config.BraintrustConfig; |
| 5 | +import dev.braintrust.prompt.BraintrustPromptLoader; |
| 6 | +import io.opentelemetry.api.OpenTelemetry; |
| 7 | +import io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder; |
| 8 | +import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; |
| 9 | +import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder; |
| 10 | +import java.net.URI; |
| 11 | +import javax.annotation.Nonnull; |
| 12 | +import lombok.Getter; |
| 13 | +import lombok.experimental.Accessors; |
| 14 | + |
| 15 | +/** |
| 16 | + * Main entry point for the Braintrust SDK. |
| 17 | + * |
| 18 | + * <p>This class provides access to all Braintrust functionality. Most users will interact with a |
| 19 | + * singleton instance via {@link #get()}, though you can create independent instances if needed. |
| 20 | + * |
| 21 | + * <p>The Braintrust instance also provides methods for enabling Braintrust in open telemetry |
| 22 | + * builders. |
| 23 | + * |
| 24 | + * <p>Additionally, vendor-specific instrumentation or functionality is provided by {@code |
| 25 | + * Braintrust<Vendor Name>}. E.g. {@code BraintrustOpenAI}, {@code BraintrustAnthropic}, etc. |
| 26 | + * |
| 27 | + * @see #get() |
| 28 | + * @see BraintrustConfig |
| 29 | + * @see #openTelemetryCreate() |
| 30 | + * @see #openTelemetryEnable(SdkTracerProviderBuilder, SdkLoggerProviderBuilder, |
| 31 | + * SdkMeterProviderBuilder) |
| 32 | + */ |
| 33 | +public class Braintrust { |
| 34 | + /** |
| 35 | + * get or create the global braintrust instance. Most users will want to use this method to |
| 36 | + * access the Braintrust SDK. |
| 37 | + */ |
| 38 | + public static Braintrust get() { |
| 39 | + throw new RuntimeException("TODO"); |
| 40 | + } |
| 41 | + |
| 42 | + /** get or create the global braintrust instance from the given config */ |
| 43 | + public static Braintrust get(BraintrustConfig config) { |
| 44 | + throw new RuntimeException("TODO"); |
| 45 | + } |
| 46 | + |
| 47 | + /** Create a new Braintrust instance from the given config */ |
| 48 | + public static Braintrust of(BraintrustConfig config) { |
| 49 | + throw new RuntimeException("TODO"); |
| 50 | + } |
| 51 | + |
| 52 | + @Getter |
| 53 | + @Accessors(fluent = true) |
| 54 | + private final BraintrustConfig config; |
| 55 | + |
| 56 | + @Getter |
| 57 | + @Accessors(fluent = true) |
| 58 | + private final BraintrustApiClient apiClient; |
| 59 | + |
| 60 | + @Getter |
| 61 | + @Accessors(fluent = true) |
| 62 | + private final BraintrustPromptLoader promptLoader; |
| 63 | + |
| 64 | + private Braintrust( |
| 65 | + BraintrustConfig config, |
| 66 | + BraintrustApiClient apiClient, |
| 67 | + BraintrustPromptLoader promptLoader) { |
| 68 | + this.config = config; |
| 69 | + this.apiClient = apiClient; |
| 70 | + this.promptLoader = promptLoader; |
| 71 | + } |
| 72 | + |
| 73 | + public URI projectUri() { |
| 74 | + throw new RuntimeException("TODO"); |
| 75 | + } |
| 76 | + |
| 77 | + public OpenTelemetry openTelemetryCreate() { |
| 78 | + throw new RuntimeException("TODO"); |
| 79 | + } |
| 80 | + |
| 81 | + public OpenTelemetry openTelemetryCreate(boolean registerGlobal) { |
| 82 | + throw new RuntimeException("TODO"); |
| 83 | + } |
| 84 | + |
| 85 | + public void openTelemetryEnable( |
| 86 | + @Nonnull SdkTracerProviderBuilder tracerProviderBuilder, |
| 87 | + @Nonnull SdkLoggerProviderBuilder loggerProviderBuilder, |
| 88 | + @Nonnull SdkMeterProviderBuilder meterProviderBuilder) { |
| 89 | + throw new RuntimeException("TODO"); |
| 90 | + } |
| 91 | +} |
0 commit comments