multimodal.ts 366 B

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