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:Main Menu Options
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:- A spinner animation while fetching the models
- Success message when models are found
- A formatted list of models with sizes
- Error handling if Ollama isn’t running
Option 2: Generate Text
This option demonstrates text generation capabilities using Ollama models. Command equivalent:-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:- 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:- 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:Option 6: Read Tutorial Tips
This option provides additional tips and tricks for advanced usage. Topics covered:-
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)
- Model version specification (
-
Text Generation:
- Temperature control (
--temperature 0.7) - Output redirection (
> output.txt) - Shell pipeline integration
- Temperature control (
-
Common Issues:
- Ollama server not running
- Model not found troubleshooting
- Memory constraints for large models
-
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:- Selecting option 7 from the main menu
- Typing “exit” at any prompt
- 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
Next Steps After Tutorial
After completing the tutorial, you can:- Use the CLI commands directly as shown in the tutorial
- Integrate the SDK into your TypeScript/JavaScript applications
- Explore the OpenAI compatibility layer for migration from OpenAI
- Contribute to the SDK development on GitHub
