main.ts 366 B

123456789101112131415
  1. import { Ollama} from 'langchain/llms/ollama';
  2. async function main() {
  3. const ollama = new Ollama({
  4. model: 'mistral'
  5. // other parameters can be found at https://js.langchain.com/docs/api/llms_ollama/classes/Ollama
  6. })
  7. const stream = await ollama.stream("Hello");
  8. for await (const chunk of stream) {
  9. process.stdout.write(chunk);
  10. }
  11. }
  12. main();