Skip to content

Commit 146f4b4

Browse files
authored
feat: add env var docs for studio v2 (#2347)
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Add documentation for `BOUNDARY_API_KEY` environment variable for Boundary Studio integration, replacing older variables and providing framework-specific examples. > > - **Environment Variables**: > - Add `BOUNDARY_API_KEY` documentation for Boundary Studio integration in `environment-variables.mdx`. > - Replace `BOUNDARY_PROJECT_ID` and `BOUNDARY_SECRET` with `BOUNDARY_API_KEY` in `studio.mdx` and `01-quick-start.mdx`. > - **Framework Examples**: > - Add examples for setting `BOUNDARY_API_KEY` in `setting-env-vars.mdx` for Next.js, Express.js, Flask, and Rails. > - **Misc**: > - Minor whitespace changes in `studio.mdx`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for de7efeb. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 7c8a444 commit 146f4b4

4 files changed

Lines changed: 53 additions & 13 deletions

File tree

‎fern/01-guide/03-development/environment-variables.mdx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,16 @@ client<llm> GPT4o {
2222

2323
<Markdown src="/snippets/setting-env-vars.mdx" />
2424

25+
## Boundary Studio Integration
26+
27+
When you use BAML in your application, logs and traces are automatically sent to Boundary Studio for monitoring and debugging. To enable this integration, you need to set the `BOUNDARY_API_KEY` environment variable with an API key from your Boundary Studio dashboard.
28+
29+
The API key is used to:
30+
- Authenticate your application with Boundary Studio
31+
- Associate logs and traces with your specific project and environment
32+
- Control access permissions for different operations
33+
34+
<Markdown src="/snippets/setting-env-vars.mdx" />
35+
2536
## Setting LLM API Keys per Request
2637
You can set the API key for an LLM dynamically by passing in the key as a header or as a parameter (depending on the provider), using the [ClientRegistry](/guide/baml-advanced/llm-client-registry).

‎fern/01-guide/07-observability/studio.mdx‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ For 2025 Q1, Boundary Studio is free for new accounts!
88
Boundary Studio 2 will be released in 2025 Q2 with a new pricing model.
99
</Tip>
1010

11-
To enable observability with BAML, you'll first need to sign up for a [Boundary Studio](https://app.boundaryml.com) account.
11+
To enable observability with BAML, you'll first need to sign up for a [Boundary Studio](https://app.boundaryml.com) account.
1212

13-
Once you've signed up, you'll be able to create a new project and get your project token.
13+
Once you've signed up, you'll be able to create a new project and get your API key.
1414

15-
Then simply add the following environment variables prior to running your application:
15+
Then simply add the following environment variable prior to running your application:
1616

1717
```bash
18-
export BOUNDARY_PROJECT_ID=project_uuid
19-
export BOUNDARY_SECRET=your_token
18+
export BOUNDARY_API_KEY=your_api_key_here
2019
```
2120

2221
There you'll be able to see all the metrics and logs from your application including:
@@ -110,7 +109,7 @@ package main
110109
import (
111110
"context"
112111
"fmt"
113-
112+
114113
b "example.com/baml_client"
115114
)
116115

@@ -121,23 +120,23 @@ type AuthorInfo struct {
121120

122121
func main() {
123122
ctx := context.Background()
124-
123+
125124
// BAML functions are automatically traced when using Boundary Studio
126125
bookSummary, err := b.GenerateBookSummary(
127126
ctx,
128127
"The Great Gatsby",
129128
AuthorInfo{
130-
FirstName: "F. Scott",
129+
FirstName: "F. Scott",
131130
LastName: "Fitzgerald",
132131
},
133132
"A classic American novel...",
134133
)
135134
if err != nil {
136135
panic(fmt.Sprintf("Failed to generate book summary: %v", err))
137136
}
138-
137+
139138
fmt.Printf("Book Summary: %s\n", bookSummary)
140-
139+
141140
// Note: Tracing non-BAML functions is not yet supported in Go.
142141
// Custom function tracing will be available in a future release.
143142
// Please contact us if this feature is needed for your use case.

‎fern/01-guide/08-frameworks/01-react-nextjs/01-quick-start.mdx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ To enable observability with BAML, you'll first need to sign up for a [Boundary
194194

195195

196196
```.env .env.local
197-
BOUNDARY_PROJECT_ID=sk-...
198-
BOUNDARY_SECRET=sk-...
197+
BOUNDARY_API_KEY=your_api_key_here
199198
200199
OPENAI_API_KEY=sk-...
201200
```

‎fern/snippets/setting-env-vars.mdx‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ Once you open a `.baml` file in VSCode, you should see a small button over every
88

99
Or type `BAML Playground` in the VSCode Command Bar (`CMD + Shift + P` or `CTRL + Shift + P`) to open the playground.
1010

11+
### For Boundary Studio Integration
12+
13+
To send logs and traces to Boundary Studio, you need to set the `BOUNDARY_API_KEY` environment variable. This key is provided when you create an API key in your Boundary Studio dashboard.
14+
15+
<Tabs>
16+
<Tab title="Next.js">
17+
```bash
18+
# .env.local
19+
BOUNDARY_API_KEY=your_api_key_here
20+
```
21+
</Tab>
22+
<Tab title="Express.js">
23+
```bash
24+
# .env
25+
BOUNDARY_API_KEY=your_api_key_here
26+
```
27+
</Tab>
28+
<Tab title="Flask">
29+
```bash
30+
# .env
31+
BOUNDARY_API_KEY=your_api_key_here
32+
```
33+
</Tab>
34+
<Tab title="Rails">
35+
```yaml
36+
# config/application.yml
37+
BOUNDARY_API_KEY: your_api_key_here
38+
```
39+
</Tab>
40+
</Tabs>
41+
1142
### For Your App (Default)
1243
1344
BAML will do its best to load environment variables from your program. Any of the following strategies for setting env vars are compatible with BAML:
@@ -38,7 +69,7 @@ python my_program_using_baml.py
3869
```
3970
</Tab>
4071
<Tab title="typescript">
41-
72+
4273
```typescript
4374
import dotenv from 'dotenv'
4475
import { b } from './baml_client'

0 commit comments

Comments
 (0)