generate.ts 292 B

12345678910
  1. import ollama from '../../src/index';
  2. async function main(): Promise<void> {
  3. const stream = await ollama.generate({model: "mistral", prompt: "Why is the sky blue?", stream: true});
  4. for await (const part of stream) {
  5. process.stdout.write(part.response);
  6. }
  7. }
  8. await main();