-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathworkflows.ts
More file actions
40 lines (34 loc) · 922 Bytes
/
workflows.ts
File metadata and controls
40 lines (34 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Experimental upcoming beta AI primitve.
// Please refer to the documentation for more information: https://langbase.com/docs for more information.
import 'dotenv/config';
import {Langbase, Workflow} from 'langbase';
const langbase = new Langbase({
apiKey: process.env.LANGBASE_API_KEY!,
});
async function main() {
const {step} = new Workflow({debug: true});
const result = await step({
id: 'sumamrize',
run: async () => {
return langbase.llm.run({
model: 'openai:gpt-4o-mini',
apiKey: process.env.OPENAI_API_KEY!,
messages: [
{
role: 'system',
content:
'You are an expert summarizer. Summarize the user input.',
},
{
role: 'user',
content:
'I am testing workflows. I just created an example of summarize workflow. Can you summarize this?',
},
],
stream: false,
});
},
});
console.log(result['completion']);
}
main();