forked from BerriAI/litellm-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
409 lines (387 loc) · 12.3 KB
/
Copy pathdocusaurus.config.js
File metadata and controls
409 lines (387 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
require('dotenv').config();
// @ts-ignore
const lightCodeTheme = require('prism-react-renderer/themes/vsLight');
// @ts-ignore
const darkCodeTheme = require('prism-react-renderer/themes/nightOwl');
const inkeepApiKey = process.env.INKEEP_API_KEY;
// Conditional check: docs should work if this key is missing.
const hasInkeepSearch = Boolean(inkeepApiKey);
const inkeepConfig = {
baseSettings: {
apiKey: inkeepApiKey,
organizationDisplayName: 'liteLLM',
primaryBrandColor: '#4965f5',
theme: {
styles: [
{
key: "custom-theme",
type: "style",
value: `
.ikp-chat-button__button {
margin-right: 80px !important;
}
`,
},
],
syntaxHighlighter: {
lightTheme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
},
},
searchSettings: {
searchBarPlaceholder: 'Search docs, guides, API reference...',
debounceTimeMs: 0,
maxResults: 7
},
aiChatSettings: {
aiAssistantName: 'LiteLLM AI',
chatSubjectName: 'LiteLLM',
aiAssistantAvatar: '/img/favicon.ico',
placeholder: 'Ask anything about LiteLLM...',
introMessage: 'Hi! I can help you with LiteLLM — proxy setup, model routing, caching, spend tracking, and more. What would you like to know?',
exampleQuestions: [
'How do I set up the LiteLLM proxy?',
'How do I route requests across multiple models?',
'How do I enable response caching?',
'How do I track spend per team or API key?',
],
exampleQuestionsLabel: 'Common questions',
isFirstExampleQuestionHighlighted: true,
shouldOpenLinksInNewTab: true,
isCopyChatButtonVisible: true,
isShareButtonVisible: false,
prompts: [
'You are a helpful assistant specializing in LiteLLM. Answer questions about setup, configuration, model routing, the proxy server, caching, logging, and spend tracking. When referencing configuration options, include YAML or Python code examples where helpful. If a question is outside the scope of LiteLLM, politely redirect the user to the relevant docs or GitHub.',
],
},
};
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'liteLLM',
tagline: 'Simplify LLM API Calls',
favicon: '/img/favicon.ico',
// Set the production url of your site here
url: 'https://docs.litellm.ai/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
plugins: [
require('./plugins/optimize-images'),
...(hasInkeepSearch
? [
[
'@inkeep/cxkit-docusaurus',
{
SearchBar: {
...inkeepConfig,
},
ChatButton: {
...inkeepConfig,
},
},
],
]
: []),
[
'@docusaurus/plugin-ideal-image',
{
quality: 75,
max: 1280,
min: 640,
steps: 2,
disableInDev: false,
},
],
[
'@docusaurus/plugin-content-docs',
{
id: 'release-notes',
path: './release_notes',
routeBasePath: 'release_notes',
sidebarPath: require.resolve('./sidebars-release-notes.js'),
async sidebarItemsGenerator({defaultSidebarItemsGenerator, docs, ...args}) {
const items = await defaultSidebarItemsGenerator({docs, ...args});
// Build map of doc id -> year from frontmatter date
const docYearMap = {};
for (const doc of docs) {
const date = doc.frontMatter && doc.frontMatter.date;
if (date) {
const year = new Date(date).getFullYear();
docYearMap[doc.id] = year;
}
}
function parseVersion(str) {
const match = (str || '').match(/v?(\d+)\.(\d+)\.(\d+)/);
if (!match) return [0, 0, 0];
return [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])];
}
function compareVersionsDesc(a, b) {
const [aMaj, aMin, aPatch] = parseVersion(a.label || a.id || '');
const [bMaj, bMin, bPatch] = parseVersion(b.label || b.id || '');
if (bMaj !== aMaj) return bMaj - aMaj;
if (bMin !== aMin) return bMin - aMin;
return bPatch - aPatch;
}
// Flatten and transform doc items (filter index, shorten labels)
function flattenDocs(list) {
const result = [];
for (const item of list) {
if (item.type === 'doc' && item.id === 'index') continue;
if (item.type === 'doc') {
const label = item.id.replace(/\/index$/, '');
result.push({...item, label});
} else if (item.type === 'category') {
if (item.link && item.link.type === 'doc' && item.link.id !== 'index') {
const id = item.link.id;
const label = id.replace(/\/index$/, '');
result.push({type: 'doc', id, label});
} else {
result.push(...flattenDocs(item.items));
}
}
}
return result;
}
const docItems = flattenDocs(items);
const byYear = {};
for (const item of docItems) {
const year = docYearMap[item.id] || 'Other';
if (!byYear[year]) byYear[year] = [];
byYear[year].push(item);
}
function buildMinorCategories(yearItems, expandNewest) {
const byMinor = {};
for (const item of yearItems) {
const [maj, min] = parseVersion(item.label || item.id || '');
const key = `v${maj}.${min}.x`;
if (!byMinor[key]) byMinor[key] = {maj, min, items: []};
byMinor[key].items.push(item);
}
const keys = Object.keys(byMinor);
for (const key of keys) byMinor[key].items.sort(compareVersionsDesc);
keys.sort((a, b) =>
(byMinor[b].maj - byMinor[a].maj) || (byMinor[b].min - byMinor[a].min));
return keys.map((key, idx) => ({
type: 'category',
label: key,
collapsed: !(expandNewest && idx === 0),
items: byMinor[key].items,
}));
}
const years = Object.keys(byYear).sort(
(a, b) => Number.parseInt(b, 10) - Number.parseInt(a, 10),
);
return years.map((year, idx) => ({
type: 'category',
label: String(year),
collapsed: year !== String(years[0]),
items: buildMinorCategories(byYear[year], idx === 0),
}));
},
},
],
[
'@docusaurus/plugin-content-blog',
{
id: 'blog',
path: './blog',
routeBasePath: 'blog',
blogTitle: 'Blog',
blogSidebarTitle: 'All Posts',
blogSidebarCount: 'ALL',
postsPerPage: 'ALL',
showReadingTime: false,
sortPosts: 'descending',
include: ['**/index.{md,mdx}'],
remarkPlugins: [require('./src/remark/raw-markdown')],
},
],
() => ({
name: 'cripchat',
injectHtmlTags() {
return {
headTags: [
{
tagName: 'script',
innerHTML: `window.$crisp=[];window.CRISP_WEBSITE_ID="be07a4d6-dba0-4df7-961d-9302c86b7ebc";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.chat/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();`,
},
],
};
},
}),
// Ensure gtag exists before the GA script loads.
() => ({
name: 'gtag-shim',
injectHtmlTags() {
return {
headTags: [
{
tagName: 'script',
innerHTML: `window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}if(!window.gtag){window.gtag=gtag;}`,
},
],
};
},
}),
],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
gtag:
process.env.NODE_ENV === 'production'
? {
trackingID: 'G-K7K215ZVNC',
anonymizeIP: true,
}
: undefined,
docs: {
sidebarPath: require.resolve('./sidebars.js'),
remarkPlugins: [require('./src/remark/raw-markdown')],
},
blog: false, // Disable the default blog plugin from preset-classic
pages: {},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
future: {
experimental_faster: {
swcJsLoader: true,
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
mdxCrossCompilerCache: true,
},
},
themes: ['@docusaurus/theme-mermaid'],
markdown: {
mermaid: true,
},
scripts: [
{
async: true,
src: 'https://www.feedbackrocket.io/sdk/v1.2.js',
'data-fr-id': 'GQwepB0f0L-x_ZH63kR_V',
'data-fr-theme': 'dynamic',
}
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: 'img/docusaurus-social-card.png',
navbar: {
title: '🚅 LiteLLM',
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
},
{
type: 'docSidebar',
sidebarId: 'learnSidebar',
position: 'left',
label: 'Learn',
},
{
type: 'docSidebar',
sidebarId: 'integrationsSidebar',
position: 'left',
label: 'Integrations',
},
{
position: 'left',
label: 'Enterprise',
to: "docs/enterprise"
},
{ to: '/release_notes', label: 'Changelog', position: 'left' },
{ to: '/blog', label: 'Blog', position: 'left' },
{
href: 'https://docs.litellm-agent-platform.ai/',
label: 'LiteLLM Agent Platform',
position: 'left',
},
{
href: 'https://github.com/BerriAI/litellm',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
{
href: 'https://www.litellm.ai/support',
position: 'right',
className: 'header-discord-link',
'aria-label': 'Discord / Slack community',
},
...(hasInkeepSearch
? [{type: 'search', position: 'right'}]
: []),
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: 'https://docs.litellm.ai/docs/',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.com/invite/wuPM9dRgDw',
},
{
label: 'Twitter',
href: 'https://twitter.com/LiteLLM',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/BerriAI/litellm/',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} liteLLM`,
},
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
module.exports = config;