From 1b2bb43f34029c0461d313b1fabd1b4edf7a8dd6 Mon Sep 17 00:00:00 2001 From: Andrew Kent Date: Tue, 20 Jan 2026 16:12:13 -0800 Subject: [PATCH 1/2] remove outdated docs --- README.md | 59 ------------------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/README.md b/README.md index 7bd307f..0d33aaa 100644 --- a/README.md +++ b/README.md @@ -82,65 +82,6 @@ var request = var response = openAIClient.chat().completions().create(request); ``` -### LangChain4j Instrumentation - -```java -var braintrust = Braintrust.get(); -var openTelemetry = braintrust.openTelemetryCreate(); - -// Wrap the chat model to trace LLM calls -ChatModel model = BraintrustLangchain.wrap( - openTelemetry, - OpenAiChatModel.builder() - .apiKey(System.getenv("OPENAI_API_KEY")) - .modelName("gpt-4o-mini") - .temperature(0.0)); - -var response = model.chat("What is the capital of France?"); -``` - -#### Tool Wrapping - -Use `BraintrustLangchain.wrapTools()` to automatically trace tool executions in your LangChain4j agents: - -```java -// Create your tool class -public class WeatherTools { - @Tool("Get current weather for a location") - public String getWeather(String location) { - return "The weather in " + location + " is sunny."; - } -} - -// Wrap tools to create spans for each tool execution -WeatherTools tools = new WeatherTools(); -WeatherTools instrumentedTools = BraintrustLangchain.wrapTools(openTelemetry, tools); - -// Use instrumented tools in your AI service -Assistant assistant = AiServices.builder(Assistant.class) - .chatModel(model) - .tools(instrumentedTools) - .build(); -``` - -Each tool call will automatically create an OpenTelemetry span in Braintrust with: -- Tool name and parameters -- Execution duration -- Return values -- Any exceptions thrown - -**Note:** For proper display in the Braintrust UI, ensure parent spans (conversation, turn, etc.) also set the required Braintrust attributes: -```java -var span = tracer.spanBuilder("my-span").startSpan(); -span.setAttribute("braintrust.span_attributes", "{\"type\":\"task\",\"name\":\"my-span\"}"); -span.setAttribute("braintrust.input_json", "{\"user_message\":\"...\"}"); -// ... do work ... -span.setAttribute("braintrust.output_json", "{\"result\":\"...\"}"); -span.end(); -``` - -See [LangchainToolWrappingExample.java](./examples/src/main/java/dev/braintrust/examples/LangchainToolWrappingExample.java) for a complete example with proper span hierarchy. - ## Running Examples Example source code can be found [here](./examples/src/main/java/dev/braintrust/examples) From 82710328bbe91664803a159ef9ed9ad8e098f7c2 Mon Sep 17 00:00:00 2001 From: Andrew Kent Date: Tue, 20 Jan 2026 16:17:14 -0800 Subject: [PATCH 2/2] update contributing docs --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e347c5b..c1e4620 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,8 @@ This file documents developing the SDK itself. If you simply wish to use the SDK or run examples, see [README.md](./README.md) +Because the SDK is new and under active development, third-party contribution best-practices are still being established. If you wish to contribute please open a github issue explaining what you'd like to achieve and a developer will follow-up with you. + ## Setup - Install JDK 17 @@ -15,7 +17,9 @@ This file documents developing the SDK itself. If you simply wish to use the SDK - These hooks automatically run common checks for you but CI also runs the same checks before merging to the main branch is allowed - NOTE: this will overwrite existing hooks. Take backups before running -## Running a local OpenTelemetry collector +## Misc Tips + +### Running a local OpenTelemetry collector OpenTelemetry provides a local collector with a debug exporter which logs all traces, logs, and metrics to stdout.