From the course: Hands-On AI: Build a RAG Model from Scratch with Open Source

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Running Ollama programmatically through Python

Running Ollama programmatically through Python

- [Instructor] Now that we've set up our model file, we can start using our newly created model. We'll cover how to use our LLM for both the usual inference as well as for generating embeddings. Though in practice there are certain models that are known to be much stronger for creating embeddings that help generate good similarity rankings. And we want to get some good results on our first pass. So while we will be covering how to generate embeddings through Ollama using the model that we're using as an LLM, we'll also be attacking embeddings in a different manner later on to make sure that we can get some good strong search results. Now we'll be using Python to call Ollama to generate the embeddings. So let's go ahead and create a virtual environment to manage our dependencies. Let's quickly just check the version of Python that we're using, and let's go ahead and create our virtual environment. That'll be python3 - mvn,…

Contents