Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sixty-seals-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": minor
---

feat: Add `langsmith` tracing
10 changes: 10 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ title = "Braintrust SDK gitleaks config"
# Use the default gitleaks ruleset as the base
useDefault = true

[[allowlists]]
description = "LangSmith E2E variant identifiers are not API keys"
condition = "AND"
targetRules = ["generic-api-key"]
regexes = ['''^langsmith-v0-(3-30|5-11|8-1)$''']
paths = [
'''^e2e/config/pr-comment-scenarios\.json$''',
'''^e2e/scenarios/langsmith-instrumentation/scenario\.test\.ts$''',
]

[[rules]]
id = "braintrust-api-key"
description = "Braintrust API key"
Expand Down
10 changes: 10 additions & 0 deletions e2e/config/pr-comment-scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@
"label": "LangGraph Auto-Instrumentation",
"metadataScenario": "langgraph-auto-instrumentation"
},
{
"scenarioDirName": "langsmith-instrumentation",
"label": "LangSmith Instrumentation",
"metadataScenario": "langsmith-instrumentation",
"variants": [
{ "variantKey": "langsmith-v0-3-30", "label": "v0.3.30" },
{ "variantKey": "langsmith-v0-5-11", "label": "v0.5.11" },
{ "variantKey": "langsmith-v0-8-1", "label": "v0.8.1" }
]
},
{
"scenarioDirName": "mistral-instrumentation",
"label": "Mistral Instrumentation",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{
"span_tree": [
{
"name": "support-assistant",
"type": "task",
"children": [
{
"name": "retrieve-context",
"type": "tool",
"children": [],
"input": {
"query": "What is the refund window?"
},
"output": {
"documents": [
"Refund policy"
]
},
"tags": [
"knowledge-base"
],
"metadata": {
"data_source": "support-kb",
"scenario": "langsmith-instrumentation"
}
},
{
"name": "ChatOpenAI",
"type": "llm",
"children": [],
"input": {
"args": [
{
"max_tokens": 64,
"messages": [
{
"content": "Answer using only this context: Refund requests are accepted within 30 days of purchase.",
"role": "system"
},
{
"content": "What is the refund window?",
"role": "user"
}
],
"model": "gpt-4o-mini",
"temperature": 0
},
{}
]
},
"output": {
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "Refund requests are accepted within 30 days of purchase.",
"role": "assistant"
}
}
],
"created": 0,
"id": "<span:1>",
"model": "gpt-4o-mini-2024-07-18",
"object": "chat.completion"
},
"tags": [
"openai",
"chat-completion"
],
"metadata": {
"customer_tier": "enterprise",
"deployment": "local-fixture",
"max_tokens": 64,
"model": "gpt-4o-mini",
"provider": "openai",
"scenario": "langsmith-instrumentation",
"temperature": 0
},
"metrics": {
"completion_tokens": 7,
"prompt_cached_tokens": 4,
"prompt_tokens": 18,
"tokens": 25
}
}
],
"input": {
"question": "What is the refund window?"
},
"output": {
"answer": "Refund requests are accepted within 30 days of purchase.",
"source": "Refund policy"
},
"tags": [
"support"
],
"metadata": {
"customer_id": "customer-123",
"scenario": "langsmith-instrumentation"
}
},
{
"name": "lookup-customer-record",
"type": "tool",
"children": [],
"metadata": {
"scenario": "langsmith-instrumentation"
},
"error": "Error: customer record unavailable"
},
{
"name": "manual-rag-pipeline",
"type": "task",
"children": [
{
"name": "embed-query",
"type": "llm",
"children": [],
"input": {
"text": "Which policy applies?"
},
"output": {
"embedding": [
0.1,
0.2
]
},
"tags": [
"manual"
],
"metadata": {
"model": "manual-model",
"provider": "manual-provider"
},
"metrics": {
"completion_tokens": 0,
"prompt_cached_tokens": 1,
"prompt_tokens": 3,
"time_to_first_token": 0,
"tokens": 3
}
}
],
"input": {
"question": "Which policy applies?"
},
"output": {
"matched_document": "Refund policy"
},
"metadata": {
"scenario": "langsmith-instrumentation"
}
},
{
"name": "direct-search-index",
"type": "tool",
"children": [],
"input": {
"query": "refund window",
"top_k": 3
},
"output": {
"documents": [
"Refund policy"
]
},
"metadata": {
"scenario": "langsmith-instrumentation"
}
},
{
"name": "offline-document-enrichment",
"type": "task",
"children": [
{
"name": "extract-keywords",
"type": "tool",
"children": [],
"input": {
"document": "Refund requests are accepted within 30 days."
},
"output": {
"keywords": [
"refund",
"30 days"
]
}
}
],
"input": {
"document_count": 1
},
"output": {
"enriched_documents": 1
},
"metadata": {
"scenario": "langsmith-instrumentation"
}
}
]
}
Loading
Loading