adaptive-memory-multi-model-router 2.13.18 → 2.13.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +82 -0
- package/.env.example +303 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +83 -12
- package/.github/ISSUE_TEMPLATE/config.yml +12 -6
- package/.github/ISSUE_TEMPLATE/feature_request.md +61 -10
- package/.github/PULL_REQUEST_TEMPLATE.md +53 -26
- package/.github/dependabot.yml +9 -0
- package/.github/workflows/codeql.yml +38 -0
- package/.github/workflows/npm-publish.yml +20 -0
- package/.github/workflows/stale.yml +56 -0
- package/ARCHITECTURE.md +346 -0
- package/AUDIT_REPORT.md +28 -0
- package/CHANGELOG.md +386 -22
- package/CONTRIBUTORS.md +20 -0
- package/Dockerfile +53 -0
- package/Dockerfile.proxy +33 -0
- package/PR_STATUS_REPORT.md +148 -0
- package/README.md +22 -0
- package/RUNKIT.md +83 -0
- package/_schema.html +61 -15
- package/articles/AI_AGENT_LLM_ROUTING.md +150 -0
- package/articles/FROM_ZERO_TO_10K.md +107 -0
- package/articles/LLM_BENCHMARK_DEEP_DIVE.md +153 -0
- package/articles/TWEETS_10K_DOWNLOADS.md +47 -0
- package/articles/TWEETS_BENCHMARK_FIRST.md +46 -0
- package/articles/TWEETS_MCP_PLAY.md +51 -0
- package/articles/TWEETS_SEQUENTIAL_BROKEN.md +49 -0
- package/articles/TWEETS_WHY_BUILD.md +54 -0
- package/benchmark-results.json +26 -45
- package/cli/a3m +840 -0
- package/demo/package.json +13 -0
- package/demo/public/index.html +762 -0
- package/demo/server.js +405 -0
- package/dist/cli.js +4 -0
- package/docker-compose.yml +74 -0
- package/docs/.nojekyll +0 -0
- package/docs/BENCHMARK.md +96 -22
- package/docs/_config.yml +49 -0
- package/docs/api.html +513 -0
- package/docs/benchmark.html +387 -0
- package/docs/cli-cheatsheet.md +339 -0
- package/docs/comparison.md +108 -0
- package/docs/curl-examples.md +247 -0
- package/docs/index.html +390 -99
- package/docs/openapi.yaml +1318 -0
- package/docs/quick-start.html +366 -0
- package/docs/robots.txt +1 -1
- package/docs/sitemap.xml +23 -5
- package/docs/styles.css +682 -0
- package/examples/README.md +61 -0
- package/examples/a3m-sdk.js +124 -0
- package/examples/basic-route.js +54 -0
- package/examples/chat-loop.js +202 -0
- package/examples/classify-then-route.js +102 -0
- package/examples/cost-compare.js +120 -0
- package/examples/ensemble.js +160 -0
- package/integrations/langchain/README.md +216 -0
- package/integrations/langchain/a3m_langchain.ts +1360 -0
- package/integrations/langchain/example.ts +287 -0
- package/integrations/vercel-ai-sdk/README.md +49 -0
- package/integrations/vercel-ai-sdk/a3m_provider.ts +78 -0
- package/integrations/vercel-ai-sdk/example.ts +25 -0
- package/llms-full.txt +43 -0
- package/llms.txt +9 -0
- package/mcp-server/README.md +188 -0
- package/mcp-server/package.json +29 -0
- package/mcp-server/src/index.ts +744 -0
- package/mcp-server/tsconfig.json +19 -0
- package/package.json +3 -3
- package/proxy/README.md +227 -0
- package/proxy/package-lock.json +831 -0
- package/proxy/package.json +17 -0
- package/proxy/rate-limit.js +145 -0
- package/proxy/rate-limit.test.js +311 -0
- package/proxy/server.js +970 -0
- package/scripts/banner.js +29 -0
- package/scripts/compare-providers.sh +230 -0
- package/scripts/cross_post.py +443 -0
- package/scripts/publish_fcc.py +106 -0
- package/scripts/push-to-gitee.sh +52 -0
- package/src/tui/dashboard.ts +13 -0
- package/tests/__mocks__/tokenUtils.ts +22 -0
- package/tests/memory/episodicMemory.test.ts +227 -0
- package/tests/package-lock.json +1628 -0
- package/tests/package.json +18 -0
- package/tests/routing/ensembleVoting.test.ts +236 -0
- package/tests/routing/providerRetry.test.ts +360 -0
- package/tests/routing/queryTypePresets.test.ts +206 -0
- package/tests/tsconfig.json +21 -0
- package/tests/vitest.config.ts +18 -0
- package/.env +0 -2
package/docs/styles.css
ADDED
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
/* ===== A3M Router — Global Styles ===== */
|
|
2
|
+
/* Dark theme, professional, minimal */
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
--bg-primary: #0d1117;
|
|
6
|
+
--bg-secondary: #161b22;
|
|
7
|
+
--bg-tertiary: #1c2128;
|
|
8
|
+
--border: #30363d;
|
|
9
|
+
--border-light: #21262d;
|
|
10
|
+
--text-primary: #e6edf3;
|
|
11
|
+
--text-secondary: #8b949e;
|
|
12
|
+
--text-muted: #6e7681;
|
|
13
|
+
--accent-blue: #58a6ff;
|
|
14
|
+
--accent-green: #3fb950;
|
|
15
|
+
--accent-orange: #f0c000;
|
|
16
|
+
--accent-purple: #bc8cff;
|
|
17
|
+
--accent-red: #f85149;
|
|
18
|
+
--header-bg: rgba(13, 17, 23, 0.85);
|
|
19
|
+
--card-hover: #1c2128;
|
|
20
|
+
|
|
21
|
+
--font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;
|
|
22
|
+
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Roboto, sans-serif;
|
|
23
|
+
|
|
24
|
+
--max-width: 960px;
|
|
25
|
+
--radius: 12px;
|
|
26
|
+
--radius-sm: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
*, *::before, *::after {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
html {
|
|
36
|
+
scroll-behavior: smooth;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
body {
|
|
40
|
+
font-family: var(--font-sans);
|
|
41
|
+
background: var(--bg-primary);
|
|
42
|
+
color: var(--text-primary);
|
|
43
|
+
line-height: 1.6;
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
-moz-osx-font-smoothing: grayscale;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ===== Links ===== */
|
|
49
|
+
a {
|
|
50
|
+
color: var(--accent-blue);
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
transition: color 0.15s ease;
|
|
53
|
+
}
|
|
54
|
+
a:hover {
|
|
55
|
+
color: #79c0ff;
|
|
56
|
+
text-decoration: underline;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ===== Header / Nav ===== */
|
|
60
|
+
.site-header {
|
|
61
|
+
position: sticky;
|
|
62
|
+
top: 0;
|
|
63
|
+
z-index: 100;
|
|
64
|
+
background: var(--header-bg);
|
|
65
|
+
backdrop-filter: blur(12px);
|
|
66
|
+
-webkit-backdrop-filter: blur(12px);
|
|
67
|
+
border-bottom: 1px solid var(--border);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.nav-container {
|
|
71
|
+
max-width: var(--max-width);
|
|
72
|
+
margin: 0 auto;
|
|
73
|
+
padding: 0 20px;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
height: 56px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.nav-brand {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: 8px;
|
|
84
|
+
font-weight: 700;
|
|
85
|
+
font-size: 18px;
|
|
86
|
+
color: var(--text-primary);
|
|
87
|
+
}
|
|
88
|
+
.nav-brand:hover {
|
|
89
|
+
text-decoration: none;
|
|
90
|
+
color: var(--text-primary);
|
|
91
|
+
}
|
|
92
|
+
.nav-brand-icon {
|
|
93
|
+
font-size: 22px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.nav-links {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
gap: 24px;
|
|
100
|
+
list-style: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.nav-links a {
|
|
104
|
+
color: var(--text-secondary);
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
transition: color 0.15s ease;
|
|
108
|
+
}
|
|
109
|
+
.nav-links a:hover {
|
|
110
|
+
color: var(--text-primary);
|
|
111
|
+
text-decoration: none;
|
|
112
|
+
}
|
|
113
|
+
.nav-links a.active {
|
|
114
|
+
color: var(--accent-blue);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.nav-github-btn {
|
|
118
|
+
display: inline-flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 6px;
|
|
121
|
+
padding: 6px 14px;
|
|
122
|
+
border: 1px solid var(--border);
|
|
123
|
+
border-radius: 20px;
|
|
124
|
+
font-size: 13px;
|
|
125
|
+
color: var(--text-secondary);
|
|
126
|
+
background: var(--bg-secondary);
|
|
127
|
+
transition: all 0.15s ease;
|
|
128
|
+
}
|
|
129
|
+
.nav-github-btn:hover {
|
|
130
|
+
border-color: var(--text-muted);
|
|
131
|
+
color: var(--text-primary);
|
|
132
|
+
text-decoration: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Mobile nav toggle */
|
|
136
|
+
.nav-toggle {
|
|
137
|
+
display: none;
|
|
138
|
+
background: none;
|
|
139
|
+
border: none;
|
|
140
|
+
color: var(--text-secondary);
|
|
141
|
+
font-size: 24px;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
padding: 4px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (max-width: 640px) {
|
|
147
|
+
.nav-links {
|
|
148
|
+
display: none;
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 56px;
|
|
151
|
+
left: 0;
|
|
152
|
+
right: 0;
|
|
153
|
+
background: var(--bg-primary);
|
|
154
|
+
border-bottom: 1px solid var(--border);
|
|
155
|
+
padding: 16px 20px;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
gap: 12px;
|
|
158
|
+
align-items: flex-start;
|
|
159
|
+
}
|
|
160
|
+
.nav-links.open {
|
|
161
|
+
display: flex;
|
|
162
|
+
}
|
|
163
|
+
.nav-toggle {
|
|
164
|
+
display: block;
|
|
165
|
+
}
|
|
166
|
+
.nav-github-btn {
|
|
167
|
+
display: none;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* ===== Main Content ===== */
|
|
172
|
+
.container {
|
|
173
|
+
max-width: var(--max-width);
|
|
174
|
+
margin: 0 auto;
|
|
175
|
+
padding: 0 20px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.page {
|
|
179
|
+
padding: 48px 0 80px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Headings */
|
|
183
|
+
h1 {
|
|
184
|
+
font-size: 48px;
|
|
185
|
+
font-weight: 800;
|
|
186
|
+
letter-spacing: -1.5px;
|
|
187
|
+
line-height: 1.15;
|
|
188
|
+
color: var(--text-primary);
|
|
189
|
+
margin-bottom: 16px;
|
|
190
|
+
}
|
|
191
|
+
h2 {
|
|
192
|
+
font-size: 28px;
|
|
193
|
+
font-weight: 700;
|
|
194
|
+
letter-spacing: -0.5px;
|
|
195
|
+
color: var(--text-primary);
|
|
196
|
+
margin: 40px 0 16px;
|
|
197
|
+
padding-bottom: 8px;
|
|
198
|
+
border-bottom: 1px solid var(--border-light);
|
|
199
|
+
}
|
|
200
|
+
h3 {
|
|
201
|
+
font-size: 20px;
|
|
202
|
+
font-weight: 600;
|
|
203
|
+
color: var(--text-primary);
|
|
204
|
+
margin: 32px 0 12px;
|
|
205
|
+
}
|
|
206
|
+
h4 {
|
|
207
|
+
font-size: 16px;
|
|
208
|
+
font-weight: 600;
|
|
209
|
+
color: var(--text-primary);
|
|
210
|
+
margin: 24px 0 8px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
p {
|
|
214
|
+
color: var(--text-secondary);
|
|
215
|
+
margin-bottom: 16px;
|
|
216
|
+
font-size: 16px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
strong {
|
|
220
|
+
color: var(--text-primary);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* ===== Hero ===== */
|
|
224
|
+
.hero {
|
|
225
|
+
text-align: center;
|
|
226
|
+
padding: 80px 0 40px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.hero h1 {
|
|
230
|
+
font-size: 56px;
|
|
231
|
+
margin-bottom: 16px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.hero .tagline {
|
|
235
|
+
font-size: 20px;
|
|
236
|
+
color: var(--text-secondary);
|
|
237
|
+
margin-bottom: 32px;
|
|
238
|
+
max-width: 600px;
|
|
239
|
+
margin-left: auto;
|
|
240
|
+
margin-right: auto;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* ===== Badges / Tags ===== */
|
|
244
|
+
.badges {
|
|
245
|
+
display: flex;
|
|
246
|
+
gap: 10px;
|
|
247
|
+
flex-wrap: wrap;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
margin-bottom: 40px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.badge {
|
|
253
|
+
display: inline-flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
gap: 4px;
|
|
256
|
+
background: rgba(56, 139, 253, 0.12);
|
|
257
|
+
border: 1px solid rgba(56, 139, 253, 0.3);
|
|
258
|
+
color: var(--accent-blue);
|
|
259
|
+
padding: 5px 14px;
|
|
260
|
+
border-radius: 20px;
|
|
261
|
+
font-size: 13px;
|
|
262
|
+
font-weight: 500;
|
|
263
|
+
}
|
|
264
|
+
.badge.green {
|
|
265
|
+
background: rgba(63, 185, 80, 0.12);
|
|
266
|
+
border-color: rgba(63, 185, 80, 0.3);
|
|
267
|
+
color: var(--accent-green);
|
|
268
|
+
}
|
|
269
|
+
.badge.orange {
|
|
270
|
+
background: rgba(240, 192, 0, 0.12);
|
|
271
|
+
border-color: rgba(240, 192, 0, 0.3);
|
|
272
|
+
color: var(--accent-orange);
|
|
273
|
+
}
|
|
274
|
+
.badge.purple {
|
|
275
|
+
background: rgba(188, 140, 255, 0.12);
|
|
276
|
+
border-color: rgba(188, 140, 255, 0.3);
|
|
277
|
+
color: var(--accent-purple);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* ===== Buttons ===== */
|
|
281
|
+
.btn {
|
|
282
|
+
display: inline-flex;
|
|
283
|
+
align-items: center;
|
|
284
|
+
gap: 8px;
|
|
285
|
+
padding: 12px 24px;
|
|
286
|
+
border-radius: var(--radius-sm);
|
|
287
|
+
font-size: 15px;
|
|
288
|
+
font-weight: 600;
|
|
289
|
+
transition: all 0.15s ease;
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
border: none;
|
|
292
|
+
}
|
|
293
|
+
.btn:hover {
|
|
294
|
+
text-decoration: none;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.btn-primary {
|
|
298
|
+
background: #238636;
|
|
299
|
+
color: #fff;
|
|
300
|
+
}
|
|
301
|
+
.btn-primary:hover {
|
|
302
|
+
background: #2ea043;
|
|
303
|
+
color: #fff;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.btn-secondary {
|
|
307
|
+
background: var(--bg-secondary);
|
|
308
|
+
color: var(--text-primary);
|
|
309
|
+
border: 1px solid var(--border);
|
|
310
|
+
}
|
|
311
|
+
.btn-secondary:hover {
|
|
312
|
+
background: var(--card-hover);
|
|
313
|
+
border-color: var(--text-muted);
|
|
314
|
+
color: var(--text-primary);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.btn-ghost {
|
|
318
|
+
background: transparent;
|
|
319
|
+
color: var(--accent-blue);
|
|
320
|
+
border: 1px solid rgba(56, 139, 253, 0.3);
|
|
321
|
+
}
|
|
322
|
+
.btn-ghost:hover {
|
|
323
|
+
background: rgba(56, 139, 253, 0.1);
|
|
324
|
+
color: var(--accent-blue);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.cta-buttons {
|
|
328
|
+
display: flex;
|
|
329
|
+
gap: 12px;
|
|
330
|
+
justify-content: center;
|
|
331
|
+
flex-wrap: wrap;
|
|
332
|
+
margin-bottom: 48px;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* ===== Cards ===== */
|
|
336
|
+
.card {
|
|
337
|
+
background: var(--bg-secondary);
|
|
338
|
+
border: 1px solid var(--border);
|
|
339
|
+
border-radius: var(--radius);
|
|
340
|
+
padding: 24px 28px;
|
|
341
|
+
margin-bottom: 20px;
|
|
342
|
+
transition: border-color 0.15s ease;
|
|
343
|
+
}
|
|
344
|
+
.card:hover {
|
|
345
|
+
border-color: #3d444d;
|
|
346
|
+
}
|
|
347
|
+
.card h3 {
|
|
348
|
+
margin-top: 0;
|
|
349
|
+
margin-bottom: 12px;
|
|
350
|
+
font-size: 18px;
|
|
351
|
+
}
|
|
352
|
+
.card p {
|
|
353
|
+
margin-bottom: 0;
|
|
354
|
+
font-size: 14px;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.card-grid {
|
|
358
|
+
display: grid;
|
|
359
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
360
|
+
gap: 16px;
|
|
361
|
+
margin: 24px 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.card-icon {
|
|
365
|
+
font-size: 28px;
|
|
366
|
+
margin-bottom: 12px;
|
|
367
|
+
display: inline-block;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/* ===== Code blocks ===== */
|
|
371
|
+
code, pre {
|
|
372
|
+
font-family: var(--font-mono);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
pre {
|
|
376
|
+
background: #0d1117;
|
|
377
|
+
border: 1px solid var(--border);
|
|
378
|
+
border-radius: var(--radius-sm);
|
|
379
|
+
padding: 16px 20px;
|
|
380
|
+
overflow-x: auto;
|
|
381
|
+
font-size: 13px;
|
|
382
|
+
line-height: 1.5;
|
|
383
|
+
margin: 16px 0;
|
|
384
|
+
color: #e6edf3;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
code:not(pre code) {
|
|
388
|
+
background: rgba(56, 139, 253, 0.1);
|
|
389
|
+
color: var(--accent-blue);
|
|
390
|
+
padding: 2px 6px;
|
|
391
|
+
border-radius: 4px;
|
|
392
|
+
font-size: 13px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* Syntax highlighting */
|
|
396
|
+
.hljs-keyword { color: #ff7b72; }
|
|
397
|
+
.hljs-string { color: #a5d6ff; }
|
|
398
|
+
.hljs-comment { color: #6e7681; font-style: italic; }
|
|
399
|
+
.hljs-function { color: #d2a8ff; }
|
|
400
|
+
.hljs-number { color: #79c0ff; }
|
|
401
|
+
.hljs-built_in { color: #ffa657; }
|
|
402
|
+
.hljs-title { color: #d2a8ff; }
|
|
403
|
+
.hljs-params { color: #e6edf3; }
|
|
404
|
+
.hljs-literal { color: #79c0ff; }
|
|
405
|
+
.hljs-type { color: #ffa657; }
|
|
406
|
+
|
|
407
|
+
/* ===== Tables ===== */
|
|
408
|
+
.table-wrapper {
|
|
409
|
+
overflow-x: auto;
|
|
410
|
+
margin: 16px 0;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
table {
|
|
414
|
+
width: 100%;
|
|
415
|
+
border-collapse: collapse;
|
|
416
|
+
font-size: 14px;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
th, td {
|
|
420
|
+
padding: 10px 14px;
|
|
421
|
+
text-align: left;
|
|
422
|
+
border-bottom: 1px solid var(--border-light);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
th {
|
|
426
|
+
font-weight: 600;
|
|
427
|
+
color: var(--text-primary);
|
|
428
|
+
background: var(--bg-tertiary);
|
|
429
|
+
white-space: nowrap;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
td {
|
|
433
|
+
color: var(--text-secondary);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
tr:hover td {
|
|
437
|
+
background: rgba(56, 139, 253, 0.04);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* ===== Stats ===== */
|
|
441
|
+
.stats-grid {
|
|
442
|
+
display: grid;
|
|
443
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
444
|
+
gap: 20px;
|
|
445
|
+
margin: 32px 0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.stat-card {
|
|
449
|
+
text-align: center;
|
|
450
|
+
background: var(--bg-secondary);
|
|
451
|
+
border: 1px solid var(--border);
|
|
452
|
+
border-radius: var(--radius);
|
|
453
|
+
padding: 24px 16px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.stat-value {
|
|
457
|
+
font-size: 32px;
|
|
458
|
+
font-weight: 800;
|
|
459
|
+
color: var(--text-primary);
|
|
460
|
+
line-height: 1.1;
|
|
461
|
+
letter-spacing: -1px;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.stat-label {
|
|
465
|
+
font-size: 13px;
|
|
466
|
+
color: var(--text-muted);
|
|
467
|
+
margin-top: 6px;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/* ===== Comparison tables ===== */
|
|
471
|
+
.comparison-table {
|
|
472
|
+
width: 100%;
|
|
473
|
+
font-size: 13px;
|
|
474
|
+
}
|
|
475
|
+
.comparison-table th, .comparison-table td {
|
|
476
|
+
padding: 10px 12px;
|
|
477
|
+
}
|
|
478
|
+
.comparison-table .check { color: var(--accent-green); }
|
|
479
|
+
.comparison-table .cross { color: var(--text-muted); }
|
|
480
|
+
|
|
481
|
+
/* ===== Image / Chart ===== */
|
|
482
|
+
.chart-container {
|
|
483
|
+
margin: 32px 0;
|
|
484
|
+
text-align: center;
|
|
485
|
+
}
|
|
486
|
+
.chart-container img {
|
|
487
|
+
max-width: 100%;
|
|
488
|
+
height: auto;
|
|
489
|
+
border-radius: var(--radius);
|
|
490
|
+
border: 1px solid var(--border);
|
|
491
|
+
}
|
|
492
|
+
.chart-caption {
|
|
493
|
+
font-size: 13px;
|
|
494
|
+
color: var(--text-muted);
|
|
495
|
+
margin-top: 8px;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/* ===== Callout boxes ===== */
|
|
499
|
+
.callout {
|
|
500
|
+
padding: 16px 20px;
|
|
501
|
+
border-radius: var(--radius-sm);
|
|
502
|
+
margin: 16px 0;
|
|
503
|
+
border-left: 4px solid;
|
|
504
|
+
font-size: 14px;
|
|
505
|
+
}
|
|
506
|
+
.callout-info {
|
|
507
|
+
background: rgba(56, 139, 253, 0.08);
|
|
508
|
+
border-color: var(--accent-blue);
|
|
509
|
+
color: var(--accent-blue);
|
|
510
|
+
}
|
|
511
|
+
.callout-success {
|
|
512
|
+
background: rgba(63, 185, 80, 0.08);
|
|
513
|
+
border-color: var(--accent-green);
|
|
514
|
+
color: var(--accent-green);
|
|
515
|
+
}
|
|
516
|
+
.callout-warning {
|
|
517
|
+
background: rgba(240, 192, 0, 0.08);
|
|
518
|
+
border-color: var(--accent-orange);
|
|
519
|
+
color: var(--accent-orange);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/* ===== Tabs (benchmark page) ===== */
|
|
523
|
+
.tabs {
|
|
524
|
+
display: flex;
|
|
525
|
+
gap: 4px;
|
|
526
|
+
margin: 24px 0 0;
|
|
527
|
+
border-bottom: 1px solid var(--border);
|
|
528
|
+
}
|
|
529
|
+
.tab-btn {
|
|
530
|
+
padding: 10px 20px;
|
|
531
|
+
background: transparent;
|
|
532
|
+
border: none;
|
|
533
|
+
color: var(--text-muted);
|
|
534
|
+
font-size: 14px;
|
|
535
|
+
font-weight: 500;
|
|
536
|
+
cursor: pointer;
|
|
537
|
+
border-bottom: 2px solid transparent;
|
|
538
|
+
transition: all 0.15s ease;
|
|
539
|
+
}
|
|
540
|
+
.tab-btn:hover {
|
|
541
|
+
color: var(--text-primary);
|
|
542
|
+
}
|
|
543
|
+
.tab-btn.active {
|
|
544
|
+
color: var(--accent-blue);
|
|
545
|
+
border-bottom-color: var(--accent-blue);
|
|
546
|
+
}
|
|
547
|
+
.tab-content {
|
|
548
|
+
display: none;
|
|
549
|
+
padding: 24px 0;
|
|
550
|
+
}
|
|
551
|
+
.tab-content.active {
|
|
552
|
+
display: block;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/* ===== Timeline ===== */
|
|
556
|
+
.timeline {
|
|
557
|
+
position: relative;
|
|
558
|
+
margin: 24px 0;
|
|
559
|
+
padding-left: 28px;
|
|
560
|
+
}
|
|
561
|
+
.timeline::before {
|
|
562
|
+
content: '';
|
|
563
|
+
position: absolute;
|
|
564
|
+
left: 8px;
|
|
565
|
+
top: 0;
|
|
566
|
+
bottom: 0;
|
|
567
|
+
width: 2px;
|
|
568
|
+
background: var(--border);
|
|
569
|
+
}
|
|
570
|
+
.timeline-item {
|
|
571
|
+
position: relative;
|
|
572
|
+
margin-bottom: 24px;
|
|
573
|
+
}
|
|
574
|
+
.timeline-item::before {
|
|
575
|
+
content: '';
|
|
576
|
+
position: absolute;
|
|
577
|
+
left: -24px;
|
|
578
|
+
top: 6px;
|
|
579
|
+
width: 12px;
|
|
580
|
+
height: 12px;
|
|
581
|
+
border-radius: 50%;
|
|
582
|
+
background: var(--accent-blue);
|
|
583
|
+
border: 2px solid var(--bg-primary);
|
|
584
|
+
}
|
|
585
|
+
.timeline-item h4 {
|
|
586
|
+
margin: 0 0 4px;
|
|
587
|
+
}
|
|
588
|
+
.timeline-item p {
|
|
589
|
+
margin: 0;
|
|
590
|
+
font-size: 14px;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/* ===== Footer ===== */
|
|
594
|
+
.site-footer {
|
|
595
|
+
border-top: 1px solid var(--border);
|
|
596
|
+
padding: 32px 0;
|
|
597
|
+
margin-top: 48px;
|
|
598
|
+
text-align: center;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.footer-content {
|
|
602
|
+
max-width: var(--max-width);
|
|
603
|
+
margin: 0 auto;
|
|
604
|
+
padding: 0 20px;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.footer-links {
|
|
608
|
+
display: flex;
|
|
609
|
+
gap: 20px;
|
|
610
|
+
justify-content: center;
|
|
611
|
+
flex-wrap: wrap;
|
|
612
|
+
margin-bottom: 12px;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.footer-links a {
|
|
616
|
+
font-size: 14px;
|
|
617
|
+
color: var(--text-muted);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.footer-copyright {
|
|
621
|
+
font-size: 13px;
|
|
622
|
+
color: var(--text-muted);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/* ===== TOC ===== */
|
|
626
|
+
.toc {
|
|
627
|
+
background: var(--bg-secondary);
|
|
628
|
+
border: 1px solid var(--border);
|
|
629
|
+
border-radius: var(--radius-sm);
|
|
630
|
+
padding: 16px 20px;
|
|
631
|
+
margin: 24px 0;
|
|
632
|
+
}
|
|
633
|
+
.toc h4 {
|
|
634
|
+
margin: 0 0 8px;
|
|
635
|
+
font-size: 14px;
|
|
636
|
+
color: var(--text-muted);
|
|
637
|
+
text-transform: uppercase;
|
|
638
|
+
letter-spacing: 0.5px;
|
|
639
|
+
}
|
|
640
|
+
.toc ul {
|
|
641
|
+
list-style: none;
|
|
642
|
+
padding: 0;
|
|
643
|
+
margin: 0;
|
|
644
|
+
}
|
|
645
|
+
.toc li {
|
|
646
|
+
margin-bottom: 4px;
|
|
647
|
+
}
|
|
648
|
+
.toc a {
|
|
649
|
+
font-size: 14px;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/* ===== Responsive ===== */
|
|
653
|
+
@media (max-width: 768px) {
|
|
654
|
+
h1 { font-size: 36px; }
|
|
655
|
+
.hero h1 { font-size: 36px; }
|
|
656
|
+
h2 { font-size: 24px; }
|
|
657
|
+
.hero { padding: 48px 0 24px; }
|
|
658
|
+
.page { padding: 32px 0 48px; }
|
|
659
|
+
.stats-grid { grid-template-columns: repeat(2, 1fr); }
|
|
660
|
+
pre { font-size: 12px; padding: 12px 14px; }
|
|
661
|
+
.card-grid { grid-template-columns: 1fr; }
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
@media (max-width: 480px) {
|
|
665
|
+
h1 { font-size: 28px; }
|
|
666
|
+
.hero h1 { font-size: 28px; }
|
|
667
|
+
.hero .tagline { font-size: 16px; }
|
|
668
|
+
.stats-grid { grid-template-columns: repeat(2, 1fr); }
|
|
669
|
+
.stat-value { font-size: 24px; }
|
|
670
|
+
.badges { gap: 6px; }
|
|
671
|
+
.badge { font-size: 12px; padding: 4px 10px; }
|
|
672
|
+
.cta-buttons { flex-direction: column; align-items: center; }
|
|
673
|
+
.cta-buttons .btn { width: 100%; justify-content: center; }
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/* ===== Print ===== */
|
|
677
|
+
@media print {
|
|
678
|
+
.site-header { display: none; }
|
|
679
|
+
.site-footer { display: none; }
|
|
680
|
+
body { background: #fff; color: #000; }
|
|
681
|
+
pre { background: #f6f8fa; border: 1px solid #d0d7de; }
|
|
682
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# A3M Router Usage Examples
|
|
2
|
+
|
|
3
|
+
Practical examples showing how to use the **Adaptive Memory Multi-Model Router** in real-world scenarios.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install adaptive-memory-multi-model-router
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Set at least one API key in your environment:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
export OPENAI_API_KEY=sk-...
|
|
15
|
+
export GROQ_API_KEY=gsk_...
|
|
16
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
17
|
+
export GEMINI_API_KEY=...
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
| # | File | Description |
|
|
23
|
+
|----|--------------------------|-----------------------------------------------------------------------------|
|
|
24
|
+
| 1 | `basic-route.js` | Route a query to the best provider. Shows the routing decision with model, cost, confidence, and reasoning. |
|
|
25
|
+
| 2 | `ensemble.js` | Query multiple providers in parallel and merge results. A3M's signature capability. |
|
|
26
|
+
| 3 | `classify-then-route.js` | Classify a query's domain first (code, math, creative, etc.), then route to the optimal provider for that domain. |
|
|
27
|
+
| 4 | `chat-loop.js` | Interactive terminal chat loop with auto-routing, cost tracking, and guardrails. |
|
|
28
|
+
| 5 | `cost-compare.js` | Compare estimated costs across providers for the same prompt. Find the cheapest and fastest routes. |
|
|
29
|
+
| 6 | `a3m-sdk.js` | Use the TypeScript SDK class — `route()`, `analyze()`, `recommend()`, batch routing, and the proxy server. |
|
|
30
|
+
|
|
31
|
+
## Running Examples
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Route a query (dry-run — no API call)
|
|
35
|
+
node examples/basic-route.js
|
|
36
|
+
|
|
37
|
+
# Ensemble across multiple providers
|
|
38
|
+
node examples/ensemble.js
|
|
39
|
+
|
|
40
|
+
# Classify then route
|
|
41
|
+
node examples/classify-then-route.js
|
|
42
|
+
|
|
43
|
+
# Interactive chat loop
|
|
44
|
+
node examples/chat-loop.js
|
|
45
|
+
|
|
46
|
+
# Cost comparison
|
|
47
|
+
node examples/cost-compare.js
|
|
48
|
+
|
|
49
|
+
# SDK showcase
|
|
50
|
+
node examples/a3m-sdk.js
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## What Makes A3M Unique
|
|
54
|
+
|
|
55
|
+
- **Parallel ensemble voting** — query multiple LLMs and compare results (no other router does this)
|
|
56
|
+
- **RouteLLM-style routing** — learned cost-quality tradeoff based on arXiv:2404.06035
|
|
57
|
+
- **47+ providers** — free, cheap, mid, premium, enterprise tiers
|
|
58
|
+
- **Semantic cache** — returns cached responses for semantically similar queries
|
|
59
|
+
- **Budget enforcement** — hard caps per API key with monthly reset
|
|
60
|
+
- **Guardrails** — prompt injection detection, PII redaction, content filtering
|
|
61
|
+
- **LangChain adapter** — drop-in replacement for ChatOpenAI
|