chatbotlite 0.3.0 → 0.3.1
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/README.md +93 -53
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -33,21 +33,24 @@ export default function Layout({ children }) {
|
|
|
33
33
|
import { ChatBot } from "chatbotlite";
|
|
34
34
|
|
|
35
35
|
const bot = new ChatBot({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
knowledge: `
|
|
37
|
+
# Acme Plumbing
|
|
38
|
+
Plumbing service in Vancouver & Burnaby. Mon-Sat 8am-6pm.
|
|
39
|
+
|
|
40
|
+
## Services
|
|
41
|
+
- Sink leak inspection: $95
|
|
42
|
+
- Toilet unclogging: $85-150
|
|
43
|
+
- Burst pipe emergency: urgent owner review
|
|
44
|
+
`,
|
|
45
45
|
providers: {
|
|
46
46
|
keys: {
|
|
47
47
|
deepseek: process.env.DEEPSEEK_API_KEY!,
|
|
48
48
|
openai: process.env.OPENAI_API_KEY!
|
|
49
49
|
},
|
|
50
|
-
chain: [
|
|
50
|
+
chain: [
|
|
51
|
+
{ provider: "deepseek", model: "deepseek-chat" },
|
|
52
|
+
{ provider: "openai", model: "gpt-4o-mini" }
|
|
53
|
+
]
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
|
|
@@ -58,6 +61,8 @@ export async function POST(req: Request) {
|
|
|
58
61
|
}
|
|
59
62
|
```
|
|
60
63
|
|
|
64
|
+
That's the **whole** integration. The `knowledge` field is just markdown — works for any business: plumber, restaurant, school, museum, portfolio. No schema to fight.
|
|
65
|
+
|
|
61
66
|
That's the whole integration. You now have a floating chat bubble that:
|
|
62
67
|
|
|
63
68
|
- Knows your business (services, prices, hours, area)
|
|
@@ -139,13 +144,8 @@ export default function ChatMount() {
|
|
|
139
144
|
import { ChatWidget } from "chatbotlite/react";
|
|
140
145
|
|
|
141
146
|
<ChatWidget
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
services: [{ name: "Drop-in class", price: "$22" }]
|
|
145
|
-
}}
|
|
146
|
-
providers={{
|
|
147
|
-
keys: { openai: import.meta.env.VITE_OPENAI_KEY }
|
|
148
|
-
}}
|
|
147
|
+
knowledge="# Sunrise Yoga\n- Drop-in class: $22\n- Open Mon-Sun 6am-9pm"
|
|
148
|
+
providers={{ keys: { openai: import.meta.env.VITE_OPENAI_KEY } }}
|
|
149
149
|
/>
|
|
150
150
|
```
|
|
151
151
|
|
|
@@ -193,16 +193,16 @@ providers: {
|
|
|
193
193
|
openai: "sk-..." // paid fallback, max reliability
|
|
194
194
|
},
|
|
195
195
|
chain: [
|
|
196
|
-
"deepseek
|
|
197
|
-
"groq
|
|
198
|
-
"openai
|
|
196
|
+
{ provider: "deepseek", model: "deepseek-chat" },
|
|
197
|
+
{ provider: "groq", model: "llama-3.3-70b-versatile" },
|
|
198
|
+
{ provider: "openai", model: "gpt-4o-mini" }
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
```
|
|
202
202
|
|
|
203
203
|
Top-to-bottom = priority. When a step throws a retryable error (429, 5xx, timeout), it falls through to the next.
|
|
204
204
|
|
|
205
|
-
###
|
|
205
|
+
### Same provider, cheaper fallback
|
|
206
206
|
|
|
207
207
|
```ts
|
|
208
208
|
providers: {
|
|
@@ -218,44 +218,83 @@ providers: {
|
|
|
218
218
|
|
|
219
219
|
`openai`, `deepseek`, `groq`, `gemini`, `anthropic`, `cerebras`, `sambanova`, `fireworks`, `mistral`, `openrouter`, `moonshot`
|
|
220
220
|
|
|
221
|
-
Use any model the provider supports — just
|
|
221
|
+
Use any model the provider supports — just pass the model name string.
|
|
222
222
|
|
|
223
223
|
---
|
|
224
224
|
|
|
225
|
-
##
|
|
225
|
+
## Knowledge — just markdown
|
|
226
226
|
|
|
227
|
-
The `
|
|
227
|
+
The `knowledge` field is the bot's brain. It's plain markdown. Write it like you'd write a one-page memo for a new receptionist. No JSON schema, no required fields. Works for **any vertical** — plumber, restaurant, school, museum, portfolio site.
|
|
228
228
|
|
|
229
229
|
```ts
|
|
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
|
-
}
|
|
230
|
+
const bot = new ChatBot({
|
|
231
|
+
knowledge: `
|
|
232
|
+
# Acme Plumbing
|
|
233
|
+
Plumbing service in Greater Vancouver since 2018.
|
|
234
|
+
|
|
235
|
+
## Services
|
|
236
|
+
- Sink leak inspection: $95 first-visit fee
|
|
237
|
+
- Toilet unclogging: $85-150
|
|
238
|
+
- Burst pipe emergency: urgent — owner reviews directly
|
|
239
|
+
|
|
240
|
+
## Hours
|
|
241
|
+
Mon-Sat 8am-6pm
|
|
242
|
+
|
|
243
|
+
## Service area
|
|
244
|
+
Vancouver, Burnaby, Richmond
|
|
245
|
+
|
|
246
|
+
## Policies
|
|
247
|
+
- Payment: Interac e-Transfer or major credit cards
|
|
248
|
+
- Cancellation: free up to 24h before appointment
|
|
249
|
+
|
|
250
|
+
## Rules
|
|
251
|
+
- NEVER promise specific arrival times — give windows
|
|
252
|
+
- NEVER give final quotes without inspection
|
|
253
|
+
- Remind customers to send photos of leaks for faster diagnosis
|
|
254
|
+
`,
|
|
255
|
+
providers: { ... }
|
|
256
|
+
});
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The bot uses only what's in your markdown. Ask it about a service not listed → it defers to owner review. Ask for a guaranteed price → it refuses politely.
|
|
260
|
+
|
|
261
|
+
### Loading from a folder
|
|
262
|
+
|
|
263
|
+
For bigger knowledge bases (50+ services / multiple FAQ files), split into files:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
kb/
|
|
267
|
+
about.md
|
|
268
|
+
services.md
|
|
269
|
+
policies.md
|
|
270
|
+
faq.md
|
|
271
|
+
hours.md
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
import { ChatBot } from "chatbotlite";
|
|
276
|
+
import { knowledgeFromDir } from "chatbotlite/node";
|
|
277
|
+
|
|
278
|
+
const bot = new ChatBot({
|
|
279
|
+
knowledge: knowledgeFromDir("./kb"),
|
|
280
|
+
providers: { ... }
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`knowledgeFromDir` concatenates all `.md` / `.markdown` / `.txt` files alphabetically, each headed by its filename.
|
|
285
|
+
|
|
286
|
+
### Loading from a single file
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
import { knowledgeFromFile } from "chatbotlite/node";
|
|
290
|
+
|
|
291
|
+
const bot = new ChatBot({
|
|
292
|
+
knowledge: knowledgeFromFile("./business.md"),
|
|
293
|
+
providers: { ... }
|
|
294
|
+
});
|
|
256
295
|
```
|
|
257
296
|
|
|
258
|
-
|
|
297
|
+
> **Why not a typed JSON schema?** Because your business is yours. A bookstore doesn't have "services with prices". A school doesn't have a "service area". A portfolio doesn't have "hours". Markdown lets every vertical describe themselves naturally — and the LLM is plenty smart to read prose.
|
|
259
298
|
|
|
260
299
|
---
|
|
261
300
|
|
|
@@ -321,8 +360,9 @@ Want a different UI? Use `ChatBot` headless and build your own.
|
|
|
321
360
|
|
|
322
361
|
- [x] **v0.1** — MVP: business config, React widget, fallback chain, basic guards
|
|
323
362
|
- [x] **v0.2** — Polished UI, model-based fallback chain (Vercel-style), attempts metadata
|
|
324
|
-
- [
|
|
325
|
-
- [ ] **v0.4** —
|
|
363
|
+
- [x] **v0.3** — Markdown knowledge (any vertical), object-only chain, folder loader
|
|
364
|
+
- [ ] **v0.4** — Streaming, vanilla JS bundle, image upload, voice input
|
|
365
|
+
- [ ] **v0.5** — Auto-RAG when knowledge > 8k tokens, custom guards API
|
|
326
366
|
- [ ] **v0.5** — Owner-review escalation flow, analytics + conversation export
|
|
327
367
|
- [ ] **v1.0** — API stable
|
|
328
368
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chatbotlite",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Drop-in AI chatbot SDK + React widget. Multi-LLM with fallback, business config, anti-hallucination guards. One import, one config — your site has a chatbot.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "agents.io",
|
|
@@ -77,8 +77,12 @@
|
|
|
77
77
|
"react-dom": ">=18.0.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
|
-
"react": {
|
|
81
|
-
|
|
80
|
+
"react": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"react-dom": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
82
86
|
},
|
|
83
87
|
"devDependencies": {
|
|
84
88
|
"@types/node": "^22.10.0",
|