oblien 1.0.2 → 1.0.3
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 +13 -13
- package/index.d.ts +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Server-side SDK for building AI-powered applications with Oblien platform.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install oblien
|
|
8
|
+
npm install oblien
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## What This SDK Does
|
|
@@ -24,7 +24,7 @@ npm install oblien-core
|
|
|
24
24
|
### 1. Initialize Client
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
|
-
import { OblienClient } from 'oblien
|
|
27
|
+
import { OblienClient } from 'oblien';
|
|
28
28
|
|
|
29
29
|
const client = new OblienClient({
|
|
30
30
|
apiKey: 'your-api-key',
|
|
@@ -35,7 +35,7 @@ const client = new OblienClient({
|
|
|
35
35
|
### 2. Create Chat Session
|
|
36
36
|
|
|
37
37
|
```javascript
|
|
38
|
-
import { OblienChat } from 'oblien
|
|
38
|
+
import { OblienChat } from 'oblien/chat';
|
|
39
39
|
|
|
40
40
|
const chat = new OblienChat(client);
|
|
41
41
|
|
|
@@ -105,7 +105,7 @@ function App() {
|
|
|
105
105
|
For anonymous users, create guest sessions based on IP address:
|
|
106
106
|
|
|
107
107
|
```javascript
|
|
108
|
-
import { OblienChat } from 'oblien
|
|
108
|
+
import { OblienChat } from 'oblien/chat';
|
|
109
109
|
|
|
110
110
|
const chat = new OblienChat(client);
|
|
111
111
|
|
|
@@ -146,7 +146,7 @@ app.post('/api/guest-session', async (req, res) => {
|
|
|
146
146
|
Works out of the box - no setup needed:
|
|
147
147
|
|
|
148
148
|
```javascript
|
|
149
|
-
import { OblienChat } from 'oblien
|
|
149
|
+
import { OblienChat } from 'oblien/chat';
|
|
150
150
|
|
|
151
151
|
const chat = new OblienChat(client);
|
|
152
152
|
// Uses NodeCacheStorage by default
|
|
@@ -156,7 +156,7 @@ const chat = new OblienChat(client);
|
|
|
156
156
|
### Option 1: Custom NodeCache Settings
|
|
157
157
|
|
|
158
158
|
```javascript
|
|
159
|
-
import { OblienChat, NodeCacheStorage } from 'oblien
|
|
159
|
+
import { OblienChat, NodeCacheStorage } from 'oblien/chat';
|
|
160
160
|
|
|
161
161
|
const storage = new NodeCacheStorage(86400); // 24 hours TTL
|
|
162
162
|
|
|
@@ -172,7 +172,7 @@ console.log(storage.getStats());
|
|
|
172
172
|
|
|
173
173
|
```javascript
|
|
174
174
|
import { createClient } from 'redis';
|
|
175
|
-
import { OblienChat, RedisStorage } from 'oblien
|
|
175
|
+
import { OblienChat, RedisStorage } from 'oblien/chat';
|
|
176
176
|
|
|
177
177
|
const redis = createClient();
|
|
178
178
|
await redis.connect();
|
|
@@ -186,7 +186,7 @@ const chat = new OblienChat(client, {
|
|
|
186
186
|
### Option 3: Simple In-Memory (Dev Only)
|
|
187
187
|
|
|
188
188
|
```javascript
|
|
189
|
-
import { OblienChat, InMemoryStorage } from 'oblien
|
|
189
|
+
import { OblienChat, InMemoryStorage } from 'oblien/chat';
|
|
190
190
|
|
|
191
191
|
const chat = new OblienChat(client, {
|
|
192
192
|
guestStorage: new InMemoryStorage(),
|
|
@@ -241,7 +241,7 @@ await chat.cleanupGuests(); // Clean expired
|
|
|
241
241
|
Manual guest management:
|
|
242
242
|
|
|
243
243
|
```javascript
|
|
244
|
-
import { GuestManager } from 'oblien
|
|
244
|
+
import { GuestManager } from 'oblien/chat';
|
|
245
245
|
|
|
246
246
|
const guestManager = new GuestManager({
|
|
247
247
|
storage?: StorageAdapter,
|
|
@@ -263,7 +263,7 @@ await guestManager.cleanup();
|
|
|
263
263
|
|
|
264
264
|
```javascript
|
|
265
265
|
import express from 'express';
|
|
266
|
-
import { OblienClient, OblienChat } from 'oblien
|
|
266
|
+
import { OblienClient, OblienChat } from 'oblien';
|
|
267
267
|
|
|
268
268
|
const app = express();
|
|
269
269
|
app.use(express.json());
|
|
@@ -312,7 +312,7 @@ app.listen(3000);
|
|
|
312
312
|
|
|
313
313
|
```javascript
|
|
314
314
|
// pages/api/session.js
|
|
315
|
-
import { OblienClient, OblienChat } from 'oblien
|
|
315
|
+
import { OblienClient, OblienChat } from 'oblien';
|
|
316
316
|
|
|
317
317
|
const client = new OblienClient({
|
|
318
318
|
apiKey: process.env.OBLIEN_API_KEY,
|
|
@@ -390,7 +390,7 @@ Check the `/examples` folder for complete examples:
|
|
|
390
390
|
Full TypeScript definitions included:
|
|
391
391
|
|
|
392
392
|
```typescript
|
|
393
|
-
import { OblienClient, OblienChat } from 'oblien
|
|
393
|
+
import { OblienClient, OblienChat } from 'oblien';
|
|
394
394
|
|
|
395
395
|
const client: OblienClient = new OblienClient({
|
|
396
396
|
apiKey: string,
|
|
@@ -449,7 +449,7 @@ MIT
|
|
|
449
449
|
## Links
|
|
450
450
|
|
|
451
451
|
- [Documentation](https://oblien.com/docs/core-sdk)
|
|
452
|
-
- [GitHub](https://github.com/oblien/oblien
|
|
452
|
+
- [GitHub](https://github.com/oblien/oblien)
|
|
453
453
|
- [Website](https://oblien.com)
|
|
454
454
|
- [React Chat Agent](https://npmjs.com/package/react-chat-agent) - Client-side chat component
|
|
455
455
|
- [Agent Sandbox](https://npmjs.com/package/agent-sandbox) - Sandbox SDK
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oblien",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Server-side SDK for Oblien AI Platform - Build AI-powered applications with chat, agents, and workflows",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
|
-
".":
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./index.js",
|
|
11
|
+
"default": "./index.js"
|
|
12
|
+
},
|
|
10
13
|
"./chat": "./chat.js",
|
|
11
14
|
"./agents": "./agents.js",
|
|
12
15
|
"./workflows": "./workflows.js",
|