This section covers how to set up the framework, including prerequisites, package installation, and environment setup.
Installation
1
Prerequisites
Before installing, ensure that you have the following:
- Python 3.7+ installed. You can check your version with:
python --version
- pip (Python package manager) installed. You can check with:
pip --version
2
Install Required Packages
The framework relies on several open-source libraries, including:
- SentenceTransformers (for embeddings)
- FAISS (for fast similarity search)
- Pillow (for image processing)
To install all dependencies, run:
pip install sentence-transformers faiss-cpu pillow
If you plan to use GPU acceleration for FAISS, install the GPU-supported version:
pip install faiss-gpu
3
Environment Setup
To manage dependencies efficiently, it's recommended to set up a virtual environment:
# Create a virtual environment (Linux/Mac)
python -m venv venv
source venv/bin/activate
# (Windows)
python -m venv venv
venv\Scripts\activate
Then, install the required dependencies inside the virtual environment:
pip install -r requirements.txt
If you don't have a requirements.txt
file, create one and add the following:
sentence-transformers
faiss-cpu
pillow
4
Verify Installation
To ensure everything is installed correctly, run the following Python snippet:
import torch
from sentence_transformers import SentenceTransformer
import faiss
from PIL import Image
# Check SentenceTransformers
model = SentenceTransformer('all-MiniLM-L6-v2')
print("SentenceTransformer loaded successfully.")
# Check FAISS
index = faiss.IndexFlatL2(384) # 384 is the embedding dimension
print("FAISS index initialized.")
# Check Pillow
image = Image.new('RGB', (100, 100), color='red')
print("Pillow image created.")
If no errors occur, your environment is set up correctly.
5
Clone the Repository (Optional, if using a GitHub project)
If this framework is hosted on GitHub, you can clone it using:
git clone https://github.com/your-repo-name/ai-agent-framework.git
cd ai-agent-framework
6
Running a Quick Test
After installation, test the framework by creating an agent and processing a query:
from agent import create_agent, run_agent
# Create an agent from the default config
agent = create_agent("agent_config.json", llm_provider="openai")
# Test query
response = run_agent(agent, "Hello, what can you do?")
print("Agent Response:", response)