Ollama in Action: Building Safe, Private AI with LLMs, Function Calling and Agents

Ollama in Action: Building Safe, Private AI with LLMs, Function Calling and Agents

Mark Watson
Buy on Leanpub

Table of Contents

Ollama in Action: Building Safe, Private AI with LLMs, Function Calling and Agents

  • Preface
    • About the Author
    • Requests from the Author
    • Why Should We Care About Privacy?
  • Setting Up Your Computing Environment for Using Ollama and Using Book Example Programs
    • Python Build Tools
  • Using Ollama From the Command Line
    • Using JSON Format
    • Analysis of Images
    • Analysis of Source Code Files
  • Short Examples
    • Using The Ollama Python SDK with Image and Text Prompts
    • Using the OpenAI Compatibility APIs with Local Models Running on Ollama
  • LLM Tool Calling with Ollama
    • Example Showing the Use of Tools Developed Later in this Chapter
    • Tool for Reading and Writing File Contents
    • Tool for Getting File Directory Contents
    • Tool for Accessing SQLite Databases Using Natural Language Queries
    • Tool for Summarizing Text
    • Tool for Web Search and Fetching Web Pages
    • Tools Wrap Up
  • Automatic Evaluation of LLM Results: More Tool Examples
    • Tool For Judging LLM Results
    • Evaluating LLM Responses Given a Chat History
    • A Tool for Detecting Hallucinations
    • Wrap Up
  • Building Agents with Ollama and the Hugging Face Smolagents Library
    • Choosing Specific LLMs for Writing Agents
    • Installation notes
    • Overview of the Hugging Face Smolagents Library
    • Overview for LLM Agents (optional section)
    • Let’s Write Some Code
    • Output from Third Example: “Read the text in the file ‘data/economics.txt’ file and then summarize this text.”
    • Agents Wrap Up
  • Using AG2 Open-Source AgentOS LLM-Based Agent Framework for Generating and Executing Python Code
    • Example Implementation
    • Example Output
    • Wrap Up for Using AG2’s Agent Framework for Generating and Executing Python Code
  • Using the Unsloth Library on Google Colab to FineTune Models for Ollama
    • Colab Notebook 1: A Quick Test of Fine Tuning and Deployment to Ollama on a Laptop
    • Fine Tuning Using a Fun Things To Do in Arizona Data Set
    • Third Colab Notebook That Fine Tunes a Larger Model
    • Fine Tuning Wrap Up
  • Reasoning with Large Language Models
    • A Simple Example
    • Key Features of Marco-o1
    • A More Complex Example: City Traffic Planning
  • Using Property Graph Database with Ollama
    • Overview of Property Graphs
    • Example Using Ollama, LangChain, and the Kuzu Property Graph Database
    • Using LLMs to Create Graph Databases from Text Data
  • Using the Open Codex Command Line Interface Coding Agent
    • Example Use Cases
    • Open Codex Wrap Up
  • Long Term Persistence Using Mem0 and Chroma
    • Code Example Using Mem0 and Chroma
    • Example Output
  • Using Ollama Cloud Services
    • Ollama Cloud Services: Power and Knowledge on Demand
    • Augmenting Models with the Web Search API
    • Wrap-Up: A Unified Local and Cloud Strategy
  • Semantic Navigator App Using Gradio
    • Overview or Semantic Web and Linked Data
    • Design Goals for the Semantic Navigator App
    • Implementation of the Semantic Navigator App Using Gradio
  • Book Wrap Up
Ollama in Action: Building Safe, Private AI with LLMs, Function Calling and Agents/overview

Ollama in Action: Building Safe, Private AI with LLMs, Function Calling and Agents

course_overview

Use Ollama to run LLMs locally for privacy and control of your tech stack. We look at Tools/function calling and agents in detail.

count_chapters
begin_reading
download
p_implied_book_part_name

Ollama in Action: Building Safe, Private AI with LLMs, Function Calling and Agents16 chapters

Begin ›
  1. Preface

  2. Setting Up Your Computing Environment for Using Ollama and Using Book Example Programs

  3. Using Ollama From the Command Line

  4. Short Examples

  5. LLM Tool Calling with Ollama

  6. Automatic Evaluation of LLM Results: More Tool Examples

  7. Building Agents with Ollama and the Hugging Face Smolagents Library

  8. Using AG2 Open-Source AgentOS LLM-Based Agent Framework for Generating and Executing Python Code

  9. Using the Unsloth Library on Google Colab to FineTune Models for Ollama

  10. Reasoning with Large Language Models

  11. Using Property Graph Database with Ollama

  12. Using the Open Codex Command Line Interface Coding Agent

  13. Long Term Persistence Using Mem0 and Chroma

  14. Using Ollama Cloud Services

  15. Semantic Navigator App Using Gradio

  16. Book Wrap Up