Skip to content

Commit 85a1f2f

Browse files
lesebclaude
andauthored
docs: modernize theme, landing page, and API code samples (#5410)
## Summary Comprehensive docs overhaul - theme, landing page, API code samples, and polish. ### Theme (`docs/src/css/custom.css`) - Inter + JetBrains Mono fonts - Purple/teal palette, dark mode as default - Frosted glass navbar, One Dark syntax highlighting - Tighter sidebar with uppercase category labels - Better tables: rounded corners, zebra striping, hover highlights - Hide emoji icons on API category cards ### Landing page (`docs/src/pages/index.js`) - Dark/light adaptive hero with gradient text - Endpoint cards in 3-column grid - Architecture diagram section - Provider tags by category - Compact community links - Fully responsive ### API code samples (`scripts/openapi_generator/code_samples.py`) - OpenAI Python SDK examples for all 38 stable endpoints via `x-codeSamples` - Postinstall patch to hide auto-generated http.client/requests when custom samples exist - Only Python (OpenAI) and curl tabs shown (removed Java, NodeJS) - Fix Batches tag displayName (was showing full description) ### Content fixes - Add File Processors, Admin, Rerank, Connectors to API overview grid - Replace oversized buttons with inline links on docs index ### Docusaurus config - Dark mode default with `respectPrefersColorScheme` - One Dark code theme via prism-react-renderer ## Test plan - [x] Previewed locally with `npx docusaurus start` - [x] Light and dark modes both work - [x] API code samples show OpenAI Python SDK - [x] Tables render with new styling - [x] Pre-commit passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Sébastien Han <seb@redhat.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3b46581 commit 85a1f2f

16 files changed

Lines changed: 1881 additions & 81 deletions

client-sdks/stainless/openapi.yml

Lines changed: 446 additions & 1 deletion
Large diffs are not rendered by default.

docs/docs/api-overview.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ Llama Stack implements the OpenAI API and organizes endpoints by stability level
2929
title: 'Experimental APIs',
3030
tone: 'experimental',
3131
items: [
32-
{ title: 'Eval', endpoint: 'v1alpha', href: '/docs/api-experimental/eval', blurb: 'Evaluation pipelines and benchmark execution' },
33-
{ title: 'Benchmarks', endpoint: 'v1alpha', href: '/docs/api-experimental/benchmarks', blurb: 'Benchmark registration and management' },
34-
{ title: 'Datasets', endpoint: 'v1alpha', href: '/docs/api-experimental/datasets', blurb: 'Dataset management for eval workflows' },
35-
{ title: 'Dataset IO', endpoint: 'v1alpha', href: '/docs/api-experimental/dataset-io', blurb: 'Dataset read/write operations' },
32+
{ title: 'Admin', endpoint: '/v1alpha/admin', href: '/docs/api-experimental/llama-stack-specification-experimental-apis', blurb: 'Providers, routes, health, and version' },
33+
{ title: 'Rerank', endpoint: '/v1alpha/inference/rerank', href: '/docs/api-experimental/rerank-v-1-alpha-inference-rerank-post', blurb: 'Document reranking for search relevance' },
34+
{ title: 'File Processors', endpoint: '/v1alpha/file_processors', href: '/docs/api-experimental/process-file-v-1-alpha-file-processors-process-post', blurb: 'Document ingestion and chunking' },
35+
{ title: 'Connectors', endpoint: '/v1beta/connectors', href: '/docs/api-experimental/llama-stack-specification-experimental-apis', blurb: 'External tool and service connectors' },
36+
{ title: 'Eval', endpoint: '/v1alpha/eval', href: '/docs/api-experimental/eval', blurb: 'Evaluation pipelines and benchmarks' },
37+
{ title: 'Datasets', endpoint: '/v1beta/datasets', href: '/docs/api-experimental/datasets', blurb: 'Dataset management' },
3638
],
3739
},
3840
{

docs/docs/index.mdx

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -65,38 +65,4 @@ llama stack run
6565

6666
Then connect with any OpenAI-compatible client.
6767

68-
<div style={{display: 'flex', gap: '1rem', flexWrap: 'wrap', margin: '2rem 0'}}>
69-
<a href="/docs/getting_started/quickstart"
70-
style={{
71-
background: 'var(--ifm-color-primary)',
72-
color: 'white',
73-
padding: '0.75rem 1.5rem',
74-
borderRadius: '0.5rem',
75-
textDecoration: 'none',
76-
fontWeight: 'bold'
77-
}}>
78-
Quick Start Guide
79-
</a>
80-
<a href="./api-openai"
81-
style={{
82-
border: '2px solid var(--ifm-color-primary)',
83-
color: 'var(--ifm-color-primary)',
84-
padding: '0.75rem 1.5rem',
85-
borderRadius: '0.5rem',
86-
textDecoration: 'none',
87-
fontWeight: 'bold'
88-
}}>
89-
OpenAI API Compatibility
90-
</a>
91-
<a href="https://github.com/llamastack/llama-stack"
92-
style={{
93-
border: '2px solid #666',
94-
color: '#666',
95-
padding: '0.75rem 1.5rem',
96-
borderRadius: '0.5rem',
97-
textDecoration: 'none',
98-
fontWeight: 'bold'
99-
}}>
100-
GitHub
101-
</a>
102-
</div>
68+
[Quick Start Guide](/docs/getting_started/quickstart) | [OpenAI API Compatibility](./api-openai) | [GitHub](https://github.com/llamastack/llama-stack)

docs/docusaurus.config.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,6 @@ const config: Config = {
240240
language: "curl",
241241
logoClass: "curl",
242242
},
243-
{
244-
highlight: "javascript",
245-
language: "nodejs",
246-
logoClass: "nodejs",
247-
},
248-
{
249-
highlight: "java",
250-
language: "java",
251-
logoClass: "java",
252-
},
253243
],
254244
} satisfies Preset.ThemeConfig,
255245

docs/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"clean-api-docs": "docusaurus clean-api-docs",
1717
"gen-api-docs:version": "docusaurus gen-api-docs:version",
1818
"clean-api-docs:version": "docusaurus clean-api-docs:version",
19-
"sync-files": "node scripts/sync-files.js"
19+
"sync-files": "node scripts/sync-files.js",
20+
"postinstall": "bash scripts/patch-openapi-theme.sh"
2021
},
2122
"dependencies": {
2223
"@docusaurus/core": "^3.9.2",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the terms described in the LICENSE file in
6+
# the root directory of this source tree.
7+
8+
# Patch docusaurus-theme-openapi-docs to hide auto-generated code variants
9+
# (http.client, requests) when x-codeSamples are provided in the OpenAPI spec.
10+
# Only the OpenAI SDK examples will show for endpoints that have x-codeSamples.
11+
FILE="node_modules/docusaurus-theme-openapi-docs/lib/theme/ApiExplorer/CodeSnippets/index.js"
12+
[ ! -f "$FILE" ] && exit 0
13+
14+
python3 -c "
15+
with open('$FILE') as f:
16+
c = f.read()
17+
# Skip variants tab when x-codeSamples (samples) exist for this language
18+
old = ' react_1.default.createElement(\n CodeTabs_1.default,\n {\n className: \"openapi-tabs__code-container-inner\",\n action: {\n setLanguage: setLanguage,\n setSelectedVariant: setSelectedVariant,\n },\n includeVariant: true,'
19+
new = ' !lang.samples && react_1.default.createElement(\n CodeTabs_1.default,\n {\n className: \"openapi-tabs__code-container-inner\",\n action: {\n setLanguage: setLanguage,\n setSelectedVariant: setSelectedVariant,\n },\n includeVariant: true,'
20+
if '!lang.samples &&' not in c:
21+
c = c.replace(old, new)
22+
with open('$FILE', 'w') as f:
23+
f.write(c)
24+
print('Patched: x-codeSamples now replace auto-generated variants')
25+
else:
26+
print('Already patched')
27+
"

docs/src/css/custom.css

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,29 +282,68 @@ div[class*='expandButton'] {
282282
/* Better table styling */
283283
table {
284284
display: table;
285-
border-collapse: collapse;
285+
border-collapse: separate;
286+
border-spacing: 0;
286287
width: 100%;
288+
border-radius: 0.75rem;
289+
overflow: hidden;
290+
border: 1px solid rgba(0, 0, 0, 0.08);
291+
margin: 1.5rem 0;
292+
}
293+
294+
[data-theme='dark'] table {
295+
border-color: rgba(255, 255, 255, 0.08);
287296
}
288297

289298
table th {
290-
background: rgba(109, 40, 217, 0.05);
299+
background: rgba(109, 40, 217, 0.06);
291300
font-weight: 600;
292-
font-size: 0.85rem;
301+
font-size: 0.8rem;
293302
text-transform: uppercase;
294-
letter-spacing: 0.03em;
303+
letter-spacing: 0.05em;
304+
color: var(--ifm-color-primary);
305+
border-bottom: 2px solid rgba(109, 40, 217, 0.12);
295306
}
296307

297308
[data-theme='dark'] table th {
298309
background: rgba(167, 139, 250, 0.08);
310+
color: var(--ifm-color-primary-light);
311+
border-bottom-color: rgba(167, 139, 250, 0.15);
299312
}
300313

301314
table td, table th {
302315
padding: 0.75rem 1rem;
303-
border: 1px solid rgba(0, 0, 0, 0.06);
316+
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
317+
border-right: none;
318+
border-left: none;
304319
}
305320

306-
[data-theme='dark'] table td, [data-theme='dark'] table th {
307-
border-color: rgba(255, 255, 255, 0.06);
321+
table tr:last-child td {
322+
border-bottom: none;
323+
}
324+
325+
table tbody tr {
326+
transition: background 0.15s;
327+
}
328+
329+
table tbody tr:hover {
330+
background: rgba(109, 40, 217, 0.02);
331+
}
332+
333+
[data-theme='dark'] table tbody tr:hover {
334+
background: rgba(167, 139, 250, 0.04);
335+
}
336+
337+
[data-theme='dark'] table td {
338+
border-bottom-color: rgba(255, 255, 255, 0.04);
339+
}
340+
341+
table tbody tr:nth-child(even) {
342+
background: rgba(0, 0, 0, 0.01);
343+
}
344+
345+
[data-theme='dark'] table tbody tr:nth-child(even) {
346+
background: rgba(255, 255, 255, 0.015);
308347
}
309348

310349
/* ========== CODE BLOCKS ========== */
@@ -643,3 +682,14 @@ footer.row .col {
643682
[data-theme='dark'] [class*='yearGroupHeading'] {
644683
border-bottom-color: rgba(255, 255, 255, 0.06);
645684
}
685+
686+
/* Hide emoji icons on API doc category cards */
687+
h2[class*="cardTitle"] {
688+
overflow: hidden;
689+
}
690+
691+
h2[class*="cardTitle"] a {
692+
display: block;
693+
text-indent: -1.5em;
694+
padding-left: 1.5em;
695+
}

docs/src/pages/index.module.css

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
font-size: 2.2rem;
340340
font-weight: 700;
341341
letter-spacing: -0.03em;
342-
margin-bottom: 0.5rem;
342+
margin-bottom: 0.25rem;
343343
}
344344

345345
.sectionHead p {
@@ -502,7 +502,7 @@
502502
font-size: 2rem;
503503
font-weight: 700;
504504
letter-spacing: -0.02em;
505-
margin-bottom: 0.5rem;
505+
margin-bottom: 0.25rem;
506506
}
507507

508508
.communityInner > p {
@@ -522,15 +522,13 @@
522522
display: flex;
523523
flex-direction: column;
524524
align-items: center;
525-
gap: 0.25rem;
526-
padding: 1.5rem 1rem;
527-
border-radius: 1rem;
525+
gap: 0.15rem;
526+
padding: 0.75rem 0.75rem;
527+
border-radius: 0.5rem;
528528
border: 1px solid rgba(0, 0, 0, 0.06);
529529
background: var(--ifm-background-color);
530530
text-decoration: none !important;
531-
transition: all 0.25s ease;
532-
backdrop-filter: blur(12px);
533-
-webkit-backdrop-filter: blur(12px);
531+
transition: all 0.2s;
534532
}
535533

536534
[data-theme='dark'] .linkCard {
@@ -539,7 +537,7 @@
539537
}
540538

541539
.linkCard:hover {
542-
transform: translateY(-4px);
540+
transform: translateY(-1px);
543541
border-color: var(--ifm-color-primary-lighter);
544542
box-shadow: 0 12px 32px rgba(109, 40, 217, 0.1);
545543
}
@@ -553,25 +551,26 @@
553551
display: flex;
554552
align-items: center;
555553
justify-content: center;
556-
width: 40px;
557-
height: 40px;
558-
border-radius: 0.75rem;
554+
width: 28px;
555+
height: 28px;
556+
border-radius: 0.5rem;
557+
font-size: 0.85rem;
559558
background: rgba(109, 40, 217, 0.08);
560559
color: var(--ifm-color-primary);
561-
margin-bottom: 0.5rem;
560+
margin-bottom: 0.25rem;
562561
}
563562

564563
[data-theme='dark'] .linkIcon {
565564
background: rgba(167, 139, 250, 0.1);
566565
}
567566

568567
.linkCard strong {
569-
font-size: 0.95rem;
568+
font-size: 0.85rem;
570569
color: var(--ifm-font-color-base);
571570
}
572571

573572
.linkCard span:not(.linkIcon) {
574-
font-size: 0.8rem;
573+
font-size: 0.7rem;
575574
color: var(--ifm-font-color-secondary);
576575
}
577576

docs/static/deprecated-llama-stack-spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11315,7 +11315,7 @@ tags:
1131511315
1131611316
Note: This API is currently under active development and may undergo changes.
1131711317
name: Batches
11318-
x-displayName: The Batches API enables efficient processing of multiple requests in a single operation, particularly useful for processing large datasets, batch evaluation workflows, and cost-effective inference at scale.
11318+
x-displayName: Batches
1131911319
- description: ''
1132011320
name: Benchmarks
1132111321
- description: Protocol for conversation management operations.

0 commit comments

Comments
 (0)