multimodal.ts 291 B

123456789101112
  1. import ollama from 'ollama'
  2. const imagePath = './examples/multimodal/cat.jpg'
  3. const response = await ollama.generate({
  4. model: 'llava',
  5. prompt: 'describe this image:',
  6. images: [imagePath],
  7. stream: true,
  8. })
  9. for await (const part of response) {
  10. process.stdout.write(part.response)
  11. }