Skip to content

Commit 5439253

Browse files
authored
👌 IMPROVE: SDK syntax (#87)
1 parent 65de1e3 commit 5439253

35 files changed

+142
-128
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ yarn add langbase
3232

3333
### Usage
3434

35-
You can [`langbase.pipe.run()`](https://langbase.com/docs/sdk/pipe/run) to generate or stream from a Pipe.
35+
You can [`langbase.pipes.run()`](https://langbase.com/docs/sdk/pipe/run) to generate or stream from a Pipe.
3636

3737
Check our [SDK documentation](https://langbase.com/docs/sdk) for more details.
3838

@@ -60,9 +60,9 @@ LANGBASE_API_KEY="your-api-key"
6060

6161
---
6262

63-
### Generate text [`langbase.pipe.run()`](https://langbase.com/docs/sdk/pipe/run)
63+
### Generate text [`langbase.pipes.run()`](https://langbase.com/docs/sdk/pipe/run)
6464

65-
Set the `stream` to `false`. For more, check the API reference of [`langbase.pipe.run()`](https://langbase.com/docs/langbase-sdk/generate-text)
65+
Set the `stream` to `false`. For more, check the API reference of [`langbase.pipes.run()`](https://langbase.com/docs/langbase-sdk/generate-text)
6666

6767
```ts
6868
import 'dotenv/config';
@@ -76,7 +76,7 @@ const langbase = new Langbase({
7676

7777
async function main() {
7878
// 2. Run the pipe with a question.
79-
const response = await langbase.pipe.run({
79+
const response = await langbase.pipes.run({
8080
stream: false,
8181
name: 'summary' // pipe name to run
8282
messages: [
@@ -96,9 +96,9 @@ main();
9696

9797
---
9898

99-
### Stream text [`langbase.pipe.run()`](https://langbase.com/docs/sdk/pipe/run)
99+
### Stream text [`langbase.pipes.run()`](https://langbase.com/docs/sdk/pipe/run)
100100

101-
Set the `stream` to `true`. For more, check the API reference of [`langbase.pipe.run()`](https://langbase.com/docs/langbase-sdk/generate-text)
101+
Set the `stream` to `true`. For more, check the API reference of [`langbase.pipes.run()`](https://langbase.com/docs/langbase-sdk/generate-text)
102102

103103
```ts
104104
import 'dotenv/config';
@@ -114,7 +114,7 @@ async function main() {
114114
const userMsg = 'Who is an AI Engineer?';
115115

116116
// 2. Run the pipe with a question.
117-
const {****stre**am**} = await langbase.pipe.run({
117+
const {stream} = await langbase.pipes.run({
118118
stream: true,
119119
name: 'summary', // pipe name to run
120120
messages: [{role: 'user', content: userMsg}],

examples/nextjs/app/langbase/pipe/run-stream/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function POST(req: NextRequest) {
1010
});
1111

1212
// 2. Generate a stream by asking a question
13-
const {stream, threadId} = await langbase.pipe.run({
13+
const {stream, threadId} = await langbase.pipes.run({
1414
messages: options.messages,
1515
stream: true,
1616
name: 'summary',

examples/nextjs/app/langbase/pipe/run/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function POST(req: NextRequest) {
1010
});
1111

1212
// 2. Generate a stream by asking a question
13-
const result = await langbase.pipe.run({
13+
const result = await langbase.pipes.run({
1414
messages: [{role: 'user', content: prompt}],
1515
name: 'summary',
1616
stream: false

examples/nodejs/agents/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default async function Route(request, env) {
66
apiKey: 'API_KEY',
77
});
88

9-
const pipes = await langbase.pipe.list();
9+
const pipes = await langbase.pipes.list();
1010

1111
// User code will be injected here
1212
return new Response(JSON.stringify(pipes), {status: 200});

examples/nodejs/agents/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default async function Route(request, env) {
66
apiKey: 'API_KEY',
77
});
88

9-
const pipes = await langbase.pipe.list();
9+
const pipes = await langbase.pipes.list();
1010

1111
// User code will be injected here
1212
return new Response(JSON.stringify(pipes), {status: 200});

examples/nodejs/agents/summarize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default async function Route(request, env) {
66
apiKey: 'API_KEY',
77
});
88

9-
const pipes = await langbase.pipe.list();
9+
const pipes = await langbase.pipes.list();
1010

1111
// User code will be injected here
1212
return new Response(JSON.stringify(pipes), {status: 200});

examples/nodejs/examples/memory/memory.create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const langbase = new Langbase({
66
});
77

88
async function main() {
9-
const response = await langbase.memory.create({
9+
const response = await langbase.memories.create({
1010
name: 'memory-sdk',
1111
embedding_model: 'cohere:embed-multilingual-v3.0'
1212
});

examples/nodejs/examples/memory/memory.delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const langbase = new Langbase({
66
});
77

88
async function main() {
9-
const response = await langbase.memory.delete({
9+
const response = await langbase.memories.delete({
1010
name: 'memory-sdk',
1111
});
1212

examples/nodejs/examples/memory/memory.docs.delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const langbase = new Langbase({
66
});
77

88
async function main() {
9-
const response = await langbase.memory.documents.delete({
9+
const response = await langbase.memories.documents.delete({
1010
memoryName: 'memory-sdk',
1111
documentName: 'readme.md',
1212
});

examples/nodejs/examples/memory/memory.docs.list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const langbase = new Langbase({
66
});
77

88
async function main() {
9-
const response = await langbase.memory.documents.list({
9+
const response = await langbase.memories.documents.list({
1010
memoryName: 'memory-sdk',
1111
});
1212

0 commit comments

Comments
 (0)