MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / main

Function main

examples/nodejs/examples/pipe.git-memory.stream.text.ts:7–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5const pipe = new Pipe(chatWithRepo());
6
7async function main() {
8 const {stream, threadId, rawResponse} = await pipe.run({
9 messages: [
10 {
11 role: 'user',
12 content: 'Generate example of chat with docs using pipe',
13 },
14 ],
15 stream: true,
16 });
17
18 // Convert the stream to a stream runner.
19 const runner = getRunner(stream);
20
21 // Method 1: Using event listeners
22 runner.on('connect', () => {
23 console.log('Stream started.\n');
24 });
25
26 runner.on('content', content => {
27 process.stdout.write(content);
28 });
29
30 runner.on('end', () => {
31 console.log('\nStream ended.');
32 });
33
34 runner.on('error', error => {
35 console.error('Error:', error);
36 });
37}
38
39main();

Callers 1

Calls 3

getRunnerFunction · 0.90
runMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected