Skip to content

Commit 134fac0

Browse files
authored
Fix tabs not syncing correctly in docs (#2420)
Fixes #2171 <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Improve BAML documentation by adding language-specific examples and correcting tab titles for better syntax highlighting. > > - **Documentation**: > - Add `language` attribute to `<Tab>` components in `streaming.mdx` and `openapi-howto-rely-on-envvars.mdx` for better syntax highlighting. > - Correct tab titles in `streaming.mdx` for Ruby and PHP to include `language` attribute. > - Add detailed examples for streaming in various languages (Python, TypeScript, Go, Ruby) in `streaming.mdx`. > - Add examples for using environment variables in API clients for multiple languages (Go, Java, PHP, Ruby, Rust) in `openapi-howto-rely-on-envvars.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 330b769. 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 39e731a commit 134fac0

13 files changed

Lines changed: 135 additions & 135 deletions

File tree

fern/01-guide/02-languages/rest.mdx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
2525
### Install NPX + OpenAPI
2626

2727
<Tabs>
28-
<Tab title="macOS (brew)">
28+
<Tab title="macOS (brew)" language="bash">
2929
```bash
3030
brew install npm openapi-generator
3131
# 'npm' will install npx
3232
# 'openapi-generator' will install both Java and openapi-generator-cli
3333
```
3434
</Tab>
3535

36-
<Tab title="Linux (apt)">
36+
<Tab title="Linux (apt)" language="bash">
3737
OpenAPI requires `default-jdk`
3838

3939
```bash
@@ -42,7 +42,7 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
4242
```
4343
</Tab>
4444

45-
<Tab title="Linux (yum/dnf)">
45+
<Tab title="Linux (yum/dnf)" language="bash">
4646
OpenAPI requires Java
4747

4848
```bash
@@ -67,7 +67,7 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
6767
```
6868
</Tab>
6969

70-
<Tab title="Windows">
70+
<Tab title="Windows" language="powershell">
7171
To install `npx` and `java` (for OpenAPI):
7272

7373
1. Use the [Node.js installer](https://nodejs.org/en/download/prebuilt-installer) to install `npx` (default installer settings are fine).
@@ -82,7 +82,7 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
8282
```
8383
</Tab>
8484

85-
<Tab title="Other">
85+
<Tab title="Other" language="bash">
8686
To install `npx`, use the [Node.js installer](https://nodejs.org/en/download/prebuilt-installer).
8787

8888
To install `java` (for OpenAPI), use the [Adoptium OpenJDK packages](https://adoptium.net/installation/linux/).
@@ -93,14 +93,14 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
9393
This will give you some starter BAML code in a `baml_src` directory.
9494
<Tabs>
9595

96-
<Tab title="C#">
96+
<Tab title="C#" language="bash">
9797
```bash
9898
npx @boundaryml/baml init \
9999
--client-type rest/openapi --openapi-client-type csharp
100100
```
101101
</Tab>
102102

103-
<Tab title="C++">
103+
<Tab title="C++" language="bash">
104104

105105
<Tip>OpenAPI supports [5 different C++ client types][openapi-client-types];
106106
any of them will work with BAML.</Tip>
@@ -111,14 +111,14 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
111111
```
112112
</Tab>
113113

114-
<Tab title="Go">
114+
<Tab title="Go" language="bash">
115115
```bash
116116
npx @boundaryml/baml init \
117117
--client-type rest/openapi --openapi-client-type go
118118
```
119119
</Tab>
120120

121-
<Tab title="Java">
121+
<Tab title="Java" language="bash">
122122

123123
```bash
124124
npx @boundaryml/baml init \
@@ -138,28 +138,28 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
138138

139139
</Tab>
140140

141-
<Tab title="PHP">
141+
<Tab title="PHP" language="bash">
142142
```bash
143143
npx @boundaryml/baml init \
144144
--client-type rest/openapi --openapi-client-type php
145145
```
146146
</Tab>
147147

148-
<Tab title="Ruby">
148+
<Tab title="Ruby" language="bash">
149149
```bash
150150
npx @boundaryml/baml init \
151151
--client-type rest/openapi --openapi-client-type ruby
152152
```
153153
</Tab>
154154

155-
<Tab title="Rust">
155+
<Tab title="Rust" language="bash">
156156
```bash
157157
npx @boundaryml/baml init \
158158
--client-type rest/openapi --openapi-client-type rust
159159
```
160160
</Tab>
161161

162-
<Tab title="Other">
162+
<Tab title="Other" language="bash">
163163

164164
As long as there's an OpenAPI client generator that works with your stack,
165165
you can use it with BAML. Check out the [full list in the OpenAPI docs][openapi-client-types].
@@ -210,7 +210,7 @@ We integrate with [OpenAPI](https://www.openapis.org/) (universal API definition
210210

211211
<Tabs>
212212

213-
<Tab title="Go">
213+
<Tab title="Go" language="go">
214214

215215
Run this with `go run main.go`:
216216

@@ -241,7 +241,7 @@ func main() {
241241
```
242242
</Tab>
243243

244-
<Tab title="Java">
244+
<Tab title="Java" language="java">
245245
First, add the OpenAPI-generated client to your project.
246246

247247
<AccordionGroup>
@@ -374,7 +374,7 @@ public class Example {
374374
```
375375
</Tab>
376376

377-
<Tab title="PHP">
377+
<Tab title="PHP" language="php">
378378

379379
<Warning>
380380
The PHP OpenAPI generator doesn't support OpenAPI's `oneOf` type, which is
@@ -417,7 +417,7 @@ try {
417417
```
418418
</Tab>
419419

420-
<Tab title="Ruby">
420+
<Tab title="Ruby" language="ruby">
421421

422422
Use `ruby -Ilib/baml_client app.rb` to run this:
423423

@@ -457,7 +457,7 @@ end
457457
```
458458
</Tab>
459459

460-
<Tab title="Rust">
460+
<Tab title="Rust" language="rust">
461461

462462
<Tip>
463463
If you're using `cargo watch -- cargo build` and seeing build failures because it can't find

fern/01-guide/03-development/deploying/openapi.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ CMD baml-cli serve --preview --port 2024
5353

5454
<Tabs>
5555

56-
<Tab title="Using docker-compose">
56+
<Tab title="Using docker-compose" language="bash">
5757

5858
Assuming you intend to run your own application in a container, we recommend
5959
using `docker-compose` to run your app and BAML-over-HTTP side-by-side:
@@ -96,7 +96,7 @@ services:
9696

9797
</Tab>
9898

99-
<Tab title="Using docker">
99+
<Tab title="Using docker" language="bash">
100100

101101
If you don't care about using `docker-compose`, you can just run:
102102

@@ -188,15 +188,15 @@ To secure your BAML server, you can also set a password on it using the
188188

189189
<Tabs>
190190

191-
<Tab title="bash">
191+
<Tab title="bash" language="bash">
192192

193193
```bash
194194
BAML_PASSWORD=sk-baml-your-secret-password \
195195
baml-cli serve --preview --port 2024
196196
```
197197
</Tab>
198198

199-
<Tab title="Dockerfile">
199+
<Tab title="Dockerfile" language="docker">
200200

201201
```docker
202202
FROM node:20
@@ -224,14 +224,14 @@ If you attach your password to the request, you'll see that it now returns `200
224224

225225
<Tabs>
226226

227-
<Tab title="Using HTTP basic auth">
227+
<Tab title="Using HTTP basic auth" language="bash">
228228
```bash
229229
export BAML_PASSWORD=sk-baml-your-secret-password
230230
curl "http://baml:${BAML_PASSWORD}@localhost:2024/_debug/status"
231231
```
232232
</Tab>
233233

234-
<Tab title="Using X-BAML-API-KEY">
234+
<Tab title="Using X-BAML-API-KEY" language="bash">
235235
```bash
236236
export BAML_PASSWORD=sk-baml-your-secret-password
237237
curl "http://localhost:2024/_debug/status" -H "X-BAML-API-KEY: ${BAML_PASSWORD}"

fern/01-guide/04-baml-basics/abort-signal.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Abort controllers allow you to cancel ongoing LLM operations, which is essential
1414
## Quick Start
1515

1616
<Tabs>
17-
<Tab title="TypeScript">
17+
<Tab title="TypeScript" language="typescript">
1818
```typescript
1919
import { b } from '@/baml_client'
2020

@@ -51,7 +51,7 @@ Abort controllers allow you to cancel ongoing LLM operations, which is essential
5151
```
5252
</Tab>
5353

54-
<Tab title="Python">
54+
<Tab title="Python" language="python">
5555
```python
5656
from baml_client import b
5757
# Python doesn't have a native abort controller construct,
@@ -76,7 +76,7 @@ Abort controllers allow you to cancel ongoing LLM operations, which is essential
7676
```
7777
</Tab>
7878

79-
<Tab title="Go">
79+
<Tab title="Go" language="go">
8080
```go
8181
import (
8282
"context"
@@ -108,7 +108,7 @@ Abort controllers allow you to cancel ongoing LLM operations, which is essential
108108
Automatically cancel operations that take too long:
109109

110110
<Tabs>
111-
<Tab title="TypeScript">
111+
<Tab title="TypeScript" language="typescript">
112112
```typescript
113113
// Modern approach using AbortSignal.timeout()
114114
async function extractWithTimeout(text: string, timeoutMs: number = 30000) {
@@ -151,7 +151,7 @@ Automatically cancel operations that take too long:
151151
```
152152
</Tab>
153153

154-
<Tab title="Python">
154+
<Tab title="Python" language="python">
155155
```python
156156
import asyncio
157157
from baml_py import AbortController
@@ -181,7 +181,7 @@ Automatically cancel operations that take too long:
181181
```
182182
</Tab>
183183

184-
<Tab title="Go">
184+
<Tab title="Go" language="go">
185185
```go
186186
func extractWithTimeout(text string, timeout time.Duration) (Result, error) {
187187
ctx, cancel := context.WithTimeout(context.Background(), timeout)
@@ -206,7 +206,7 @@ Automatically cancel operations that take too long:
206206
Build responsive backend services that allow users to cancel long-running operations:
207207

208208
<Tabs>
209-
<Tab title="TypeScript (Express)">
209+
<Tab title="TypeScript (Express)" language="typescript">
210210
```typescript
211211
import express from 'express'
212212
import { b } from '@/baml_client'
@@ -251,7 +251,7 @@ Build responsive backend services that allow users to cancel long-running operat
251251
```
252252
</Tab>
253253

254-
<Tab title="Python (FastAPI)">
254+
<Tab title="Python (FastAPI)" language="python">
255255
```python
256256
from fastapi import FastAPI, BackgroundTasks
257257
from baml_py import AbortController
@@ -291,7 +291,7 @@ Build responsive backend services that allow users to cancel long-running operat
291291
Abort controllers work seamlessly with streaming responses:
292292

293293
<Tabs>
294-
<Tab title="TypeScript">
294+
<Tab title="TypeScript" language="typescript">
295295
```typescript
296296
const controller = new AbortController()
297297

@@ -321,7 +321,7 @@ Abort controllers work seamlessly with streaming responses:
321321
```
322322
</Tab>
323323

324-
<Tab title="Python">
324+
<Tab title="Python" language="python">
325325
```python
326326
controller = AbortController()
327327

@@ -344,7 +344,7 @@ Abort controllers work seamlessly with streaming responses:
344344
```
345345
</Tab>
346346

347-
<Tab title="Go">
347+
<Tab title="Go" language="go">
348348
```go
349349
ctx, cancel := context.WithCancel(context.Background())
350350
defer cancel()
@@ -373,7 +373,7 @@ Abort controllers work seamlessly with streaming responses:
373373
Properly handle abort errors to distinguish cancellations from other failures:
374374

375375
<Tabs>
376-
<Tab title="TypeScript">
376+
<Tab title="TypeScript" language="typescript">
377377
```typescript
378378
import { BamlAbortError } from '@/baml_client'
379379

@@ -400,7 +400,7 @@ Properly handle abort errors to distinguish cancellations from other failures:
400400
```
401401
</Tab>
402402

403-
<Tab title="Python">
403+
<Tab title="Python" language="python">
404404
```python
405405
from baml_py import BamlAbortError, BamlValidationError
406406

@@ -426,7 +426,7 @@ Properly handle abort errors to distinguish cancellations from other failures:
426426
```
427427
</Tab>
428428

429-
<Tab title="Go">
429+
<Tab title="Go" language="go">
430430
```go
431431
result, err := b.ExtractResume(ctx, text)
432432
if err != nil {
@@ -454,7 +454,7 @@ Properly handle abort errors to distinguish cancellations from other failures:
454454
### When to Use Each Pattern
455455

456456
<Tabs>
457-
<Tab title="TypeScript">
457+
<Tab title="TypeScript" language="typescript">
458458
```typescript
459459
// ✅ Use AbortSignal.timeout() for simple timeouts
460460
const result = await b.ExtractResume(text, {

0 commit comments

Comments
 (0)