Skip to main content

Interactive Tutorial Guide

The Ollama SDK provides a comprehensive interactive tutorial to help you learn how to use all its features. This document provides a complete walkthrough of the tutorial experience.

Starting the Tutorial

Run the tutorial with:
You’ll be greeted with the Tekimax ASCII banner and a welcome message. The tutorial presents a menu with these options:

Option 1: List Available Models

This option demonstrates how to list all models available on your local Ollama instance. Command equivalent:
Expected output:
What you’ll see in the tutorial:
  1. A spinner animation while fetching the models
  2. Success message when models are found
  3. A formatted list of models with sizes
  4. Error handling if Ollama isn’t running

Option 2: Generate Text

This option demonstrates text generation capabilities using Ollama models. Command equivalent:
Expected input and output:
Parameters explained:
  • -m, --model: The model name to use (default: llama2)
  • -p, --prompt: The prompt for text generation
  • -s, --stream: Whether to stream the output in real-time
  • -t, --temperature: Controls randomness (0.0-1.0)
  • --top-p: Controls diversity via nucleus sampling

Option 3: Create Embeddings

This option demonstrates creating vector embeddings from text. Command equivalent:
Expected input and output:
Use cases explained in tutorial:
  • Semantic search
  • Document similarity
  • Clustering text by meaning
  • Knowledge base construction

Option 4: Pull a New Model

This option guides you through downloading new models from Ollama. Command equivalent:
Expected input and output:
Notes in tutorial:
  • The tutorial warns that pulling models can take several minutes
  • Shows real-time download progress
  • Verifies the model was installed correctly
  • Handles errors gracefully

Option 5: Show Model Details

This option demonstrates displaying detailed information about a specific model. Command equivalent:
Expected input and output:

Option 6: Read Tutorial Tips

This option provides additional tips and tricks for advanced usage. Topics covered:
  1. Working with Models:
    • Model version specification (llama2:13b, codellama:7b-instruct)
    • Command shorthand flags (-m, -p, -s)
    • Remote server connections (--host http://your-server:11434)
  2. Text Generation:
    • Temperature control (--temperature 0.7)
    • Output redirection (> output.txt)
    • Shell pipeline integration
  3. Common Issues:
    • Ollama server not running
    • Model not found troubleshooting
    • Memory constraints for large models
  4. API Integration:
    • Using the same SDK in TypeScript/JavaScript code
    • Equivalent API calls for CLI commands

Exiting the Tutorial

You can exit the tutorial at any time by:
  1. Selecting option 7 from the main menu
  2. Typing “exit” at any prompt
  3. Using Ctrl+C

Interactive Elements

Throughout the tutorial, you’ll encounter:
  • Color-coded output for better readability
  • Loading animations during longer operations
  • Step-by-step instructions with clear explanations
  • Real-time feedback on operations
  • Error handling with recovery suggestions
  • Equivalent commands shown for each action
This tutorial is designed for both beginners to Ollama and developers looking to quickly understand the SDK’s capabilities before integrating it into their applications.

Next Steps After Tutorial

After completing the tutorial, you can:
  1. Use the CLI commands directly as shown in the tutorial
  2. Integrate the SDK into your TypeScript/JavaScript applications
  3. Explore the OpenAI compatibility layer for migration from OpenAI
  4. Contribute to the SDK development on GitHub