Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

How to Get Started With Ollama (Summary)

You’ve set up Ollama on your system, pulled a couple of language models, and connected them to Python through the ollama library. You’ve explored both the chat and text-generation interfaces, learned how to maintain conversation context, and streamed responses to achieve a smoother user experience.

Running LLMs locally matters for privacy, cost control, and offline reliability. With these skills, you can start prototyping, building, and shipping AI-powered apps without depending on external online services.

In this video course, you’ve learned how to:

  • Install and run Ollama, and then pull models to use locally
  • Use chat() for multi-turn conversations with roles and context
  • Use generate() for one-shot text and code generation

With these skills, you can build privacy-focused, cost-effective assistants that run fully on your local machine. Keep experimenting with prompts, response streaming, and custom tools to tailor local LLM workflows to your Python projects.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

00:00 Congratulations on making it to the end of the course! In summary, you learned how to set up Ollama to work with your Python projects, and how to pull local language models and some of the differences between them, and how to call the chat() and generate() functions from the ollama Python package.

00:16 When setting up Ollama, you need to first download and install Ollama on your operating system and possibly start the server. Then you’ll pull the models you want to use, and install the ollama package for Python through pip.

00:30 Note that if you use conda instead of pip, the package is called ollama-python. You can find available models to pull at ollama.com/library.

00:41 The repository hosts official models, like llama3.2, as well as additional user-uploaded ones. When searching for models to use, look for the capabilities you need, like special features or training specializations, as well as the size that your hardware can handle. Use the ollama pull command to pull a model based on its name.

01:01 Here are some additional resources on Real Python. The first is the original source tutorial that this course is based on. At the end, it also includes an example of using tool calling to pass a Python function in that the model can use when formulating a response.

01:18 The second is more focused on installing Ollama onto your machine and running it locally through the command line and less on integrating it with Python.

01:28 It also shows you how to connect coding tools like Claude to use Ollama and local models in the backend. The third is about prompt engineering, which shows different techniques for how to formulate prompts so that the language models can better accomplish what you want them to.

01:45 While this was an introductory course, getting you familiar with the basics of Ollama, there are many more features that you can look into. Many of these have relevant code examples in the examples folder of the source code on GitHub.

01:58 Tool calling was mentioned earlier. It allows you to pass a Python function in that the models can use when formulating a response. Note that this is only available currently through the chat() function.

02:09 Thinking mode allows you to see not only the response that the model generated, but the thought process it used to generate the response. Vision and audio allows you to send images and audio files along with your prompt.

02:22 There’s also currently experimental support for image generation, which will likely become more established over time. And structured output. Usually, when you prompt a model, you get back unstructured text.

02:34 Even if you’re asking for a single number or calculation, it will often return additional text about how it got the answer. This makes using responses difficult in code when creating data. A solution to this, besides prompt engineering, is using structured output to request the response in a specific JSON schema.

02:55 And that’s what structured output is.

02:57 Lastly, Ollama also supports cloud models, for when your local models or hardware are not quite powerful enough for the task at hand. While the cost of this may be similar to other AI providers, with Ollama, you have more control over the models that you’re using, and none of the data is ever logged or trained on.

03:16 That concludes “How to Get Started With Ollama.” My name is Arianne Dee, and it’s been a pleasure guiding you through this course.

Become a Member to join the conversation.