Skip to content

Commit ea4385b

Browse files
committed
👌 IMPROVE: Chunk example
1 parent aa40e35 commit ea4385b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

examples/nodejs/chunk/index.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
// Experimental upcoming beta AI primitve.
22
// Please refer to the documentation for more information: https://langbase.com/docs for more information.
33
import 'dotenv/config';
4-
import fs from 'fs';
54
import {Langbase} from 'langbase';
6-
import path from 'path';
75

86
const langbase = new Langbase({
97
apiKey: process.env.LANGBASE_API_KEY!,
108
});
119

1210
async function main() {
13-
const documentPath = path.join(process.cwd(), 'chunk', 'index.ts');
14-
1511
const results = await langbase.chunk({
16-
document: fs.readFileSync(documentPath),
17-
documentName: 'chunk.txt',
18-
contentType: 'text/plain',
19-
chunkMaxLength: '1024',
20-
chunkOverlap: '256',
12+
content: `Langbase is the most powerful serverless AI platform for building AI agents with memory.
13+
Build, deploy, and scale AI agents with tools and memory (RAG). Simple AI primitives with a world-class developer experience without using any frameworks.
14+
15+
Compared to complex AI frameworks, Langbase is serverless and the first composable AI platform.
16+
17+
Build AI agents without any bloated frameworks. You write the logic, we handle the logistics.
18+
19+
Start by building simple AI agents (pipes)
20+
Then train serverless semantic Memory agents (RAG) to get accurate and trusted results
21+
Langbase provides several options to get started:
22+
23+
AI Studio: Build, collaborate, and deploy AI Agents with tools and Memory (RAG).
24+
Langbase SDK: Easiest wasy to build AI Agents with TypeScript. (recommended)
25+
HTTP API: Build AI agents with any language (Python, Go, PHP, etc.).
26+
or BaseAI.dev: Local-first, open-source web AI framework.`,
27+
chunkOverlap: 256,
28+
chunkMaxLength: 1024,
2129
});
2230

2331
console.log(results);

0 commit comments

Comments
 (0)