DEV Community

Cover image for Running local LLM (Ollama) in your nodejs project.

Running local LLM (Ollama) in your nodejs project.

Aniket Dhakane on November 28, 2024

We all love AI, and since recent years the boom in Artificial Intelligence has changed the world and is taking it into a new era. For any use probl...
Collapse
 
thesohailjafri profile image
Sohail SJ | TheZenLabs •

hey, it would be great to see chat input-output in terminal for better interaction with LLM as well as how to manage new context in token window.

Just a suggestion, great read, saving for future ref. happy coding!

Collapse
 
hisukurifu profile image
Aniket Dhakane •

Actually a great idea, I will look into how I can code that! Thanks!

Collapse
 
thesohailjafri profile image
Sohail SJ | TheZenLabs •

Yes. Connect if you need any help setting that up. happy to give a helping hand!

Thread Thread
 
hisukurifu profile image
Aniket Dhakane •

Sent a connection req on LIn😸

Thread Thread
 
thesohailjafri profile image
Sohail SJ | TheZenLabs •

Connected 🤝

Collapse
 
muhammadahsanmirza profile image
Muhammad Ahsan •

Is it for typescript only?
What can a JS developer do?

Collapse
 
hisukurifu profile image
Aniket Dhakane •

As Claudio said, you'll have to change the import statements.
Here's one stack overflow question similar to your situation - stackoverflow.com/questions/783506...

Collapse
 
thesohailjafri profile image
Sohail SJ | TheZenLabs •

learn TS 😉

Collapse
 
klawdyo profile image
Claudio Medeiros •

You need to change the "dev" command, removing the "tsc -b && " and then changing the way the lib is imported.

Collapse
 
dsaga profile image
Dusan Petkovic •

Very interesting, seams easy, how resource intensive is it ? what kind of linux machine could host this?

Collapse
 
hisukurifu profile image
Aniket Dhakane •

The LLM model I am using is codellama with 7Billion parameters and my ancient gtx 1650 can handle it which has only 3.2GB of VRAM memory allocated to it. And for linux distro, any which can handle the gpu tasks would do i guess.

Collapse
 
nishant_adhav_37a02a8adb3 profile image
Nishant Adhav •

Thanks for information

Collapse
 
hisukurifu profile image
Aniket Dhakane •

Glad I could help!