write the readme of tutorial 0

This commit is contained in:
pong 2025-02-20 22:13:51 +08:00
parent a8cee2c398
commit e0981356b2

View File

@ -0,0 +1,94 @@
# SmolAgents Tutorial 0: Installation and Setup
## Table of Contents
- [Overview](#overview)
- [Installation](#installation)
- [Install Ollama](#install-ollama)
- [Hugging Face API Setup](#hugging-face-api-setup)
- [Conda Environment Setup](#conda-environment-setup)
- [SmolAgent Installation](#smolagent-installation)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
## Overview
SmolAgents is a development toolkit designed to help you build and experiment with AI agents. This tutorial series guides you through the complete setup and installation process, serving as your starting point for working with SmolAgents.
Key features of this tutorial:
- Complete environment setup instructions
- Multiple model support (Ollama and Hugging Face)
- Step-by-step installation process
- Python environment configuration
This initial tutorial (T0) focuses on the installation and setup requirements to ensure you have a proper development environment for working with SmolAgents. You'll learn how to set up both local models through Ollama and cloud-based models via Hugging Face, giving you flexibility in your development approach.
Target audience:
- Developers interested in AI agent development
- Researchers working with language models
- Anyone looking to experiment with SmolAgents
After completing this tutorial, you'll have a fully configured environment ready for developing and testing SmolAgents applications.
## Installation
### Install Ollama
#### macOS
[Download](https://ollama.com/download/Ollama-darwin.zip)
#### Windows
[Download](https://ollama.com/download/OllamaSetup.exe)
#### Linux
```shell
curl -fsSL https://ollama.com/install.sh | sh
```
### Pull Test Model
```shell
ollama pull phi3.4
```
## OR
### Hugging Face API Setup
To use Hugging Face models with SmolAgents, follow these steps to set up your API access:
1. **Create a Hugging Face Account**
- Visit the Hugging Face website
- Click on "Sign Up" in the top right corner
- Choose your preferred sign-up method (Google, GitHub, or email)
- Complete the registration process
- Verify your email if required
2. **Generate an API Token**
- Log in to your Hugging Face account
- Navigate to Settings → Access Tokens
- Click on "New Token"
- Select "Read" access for basic model inference
- Give your token a descriptive name (e.g., "SmolAgents-API")
- Copy and save your token securely
3. **Configure Your Environment**
```bash
# Set your API token as an environment variable
# For Linux/MacOS
export HUGGING_FACE_API_KEY='your-api-token-here'
# For Windows (Command Prompt)
set HUGGING_FACE_API_KEY=your-api-token-here
# For Windows (PowerShell)
$env:HUGGING_FACE_API_KEY='your-api-token-here'
### Conda Environment Setup
```bash
conda create -n smolagent python=3.12
conda activate smolagent