Skip to main content

An agentic framework for building ML models from natural language

Project description

smolmodels ✨

PyPI version Discord

backed-by-yc

Build machine learning models using natural language and minimal code

Quickstart | Features | Installation | Documentation | Benchmarks


smolmodels lets you create machine learning models by describing them in plain language. Simply explain what you want, and the AI-powered system builds a fully functional model through an automated agentic approach.

Demo

1. Quickstart

Installation

pip install smolmodels

Two Ways to Use smolmodels

A. Interactive Chat Interface

Launch the interactive chat interface to build models through conversational AI:

# Start the chat interface
smolmodels

This opens a Gradio UI where you can describe your model, upload datasets, and get explanations throughout the process.

B. Library API

import smolmodels as sm

# Define the model
model = sm.Model(
    intent="Predict sentiment from news articles",
    input_schema={"headline": str, "content": str},
    output_schema={"sentiment": str}
)

# Build and train the model
model.build(
    datasets=[your_dataset],
    provider="openai/gpt-4o-mini",
    max_iterations=10
)

# Use the model
prediction = model.predict({
    "headline": "New breakthrough in renewable energy",
    "content": "Scientists announced a major advancement..."
})

# Save for later use
sm.save_model(model, "sentiment-model")
loaded_model = sm.load_model("sentiment-model.tar.gz")

2. Features

2.1. 💬 Natural Language Model Definition

Define models using plain English descriptions:

model = sm.Model(
    intent="Predict housing prices based on features like size, location, etc.",
    input_schema={"square_feet": int, "bedrooms": int, "location": str},
    output_schema={"price": float}
)

2.2. 🤖 Multi-Agent Architecture

The system uses a team of specialized AI agents to:

  • Analyze your requirements and data
  • Plan the optimal model solution
  • Generate and improve model code
  • Test and evaluate performance
  • Package the model for deployment

2.3. 🎯 Automated Model Building

Build complete models with a single method call:

model.build(
    datasets=[dataset],
    provider="openai/gpt-4o-mini",  # LLM provider
    max_iterations=10,              # Max solutions to explore
    timeout=1800                    # Optional time limit in seconds
)

2.4. 🎲 Data Generation & Schema Inference

Generate synthetic data or infer schemas automatically:

# Generate synthetic data
dataset = sm.DatasetGenerator(
    schema={"features": str, "target": int}
)
dataset.generate(500)  # Generate 500 samples

# Infer schema from intent
model = sm.Model(intent="Predict customer churn based on usage patterns")
model.build(provider="openai/gpt-4o-mini")  # Schema inferred automatically

2.5. 🌐 Multi-Provider Support

Use your preferred LLM provider:

model.build(provider="openai/gpt-4o-mini")    # OpenAI
model.build(provider="anthropic/claude-3-opus")  # Anthropic
model.build(provider="google/gemini-1.5-pro")    # Google

3. Installation

3.1. Installation Options

pip install smolmodels                  # Standard installation
pip install smolmodels[lightweight]     # Minimal dependencies
pip install smolmodels[all]             # With deep learning support

3.2. API Keys

# Set your preferred provider's API key
export OPENAI_API_KEY=<your-key>
export ANTHROPIC_API_KEY=<your-key>
export GEMINI_API_KEY=<your-key>

3.3. Command Line Interface

# Build a model
smolmodels build --intent "Predict customer churn" \
                 --dataset customer_data.csv \
                 --provider openai/gpt-4o-mini \
                 --output churn_model.tar.gz

# Make predictions
smolmodels predict churn_model.tar.gz --input-values usage=high spend=1200 tenure=24

# Show model details
smolmodels info churn_model.tar.gz

4. Documentation

For full documentation, visit docs.plexe.ai.

5. Benchmarks

Evaluated on 20 OpenML benchmarks and 12 Kaggle competitions, showing higher performance in 12/20 datasets. Full results at plexe-ai/plexe-results.

6. Docker Deployment

Deploy as a platform with API and web UI:

git clone https://github.com/plexe-ai/smolmodels.git
cd smolmodels/docker
cp .env.example .env  # Add your API key
docker-compose up -d

Access at:

7. Contributing

See CONTRIBUTING.md for guidelines. Join our Discord to connect with the team.

8. License

Apache-2.0 License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smolmodels-0.15.0.tar.gz (86.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smolmodels-0.15.0-py3-none-any.whl (132.9 kB view details)

Uploaded Python 3

File details

Details for the file smolmodels-0.15.0.tar.gz.

File metadata

  • Download URL: smolmodels-0.15.0.tar.gz
  • Upload date:
  • Size: 86.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.8.0-1021-azure

File hashes

Hashes for smolmodels-0.15.0.tar.gz
Algorithm Hash digest
SHA256 ade8a6fd89c2e354e529a7971792c9a40485c36747bac22eced230642d8e656e
MD5 30bd401bd3bc312eed9708e94799933b
BLAKE2b-256 0efcee71ae8e8ee32a74f41ed067509ccc588d360b9a28a2c9c96ef5a3706c7a

See more details on using hashes here.

File details

Details for the file smolmodels-0.15.0-py3-none-any.whl.

File metadata

  • Download URL: smolmodels-0.15.0-py3-none-any.whl
  • Upload date:
  • Size: 132.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Linux/6.8.0-1021-azure

File hashes

Hashes for smolmodels-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0df72053fa3553b43e7fa7142f2caa3bfb330480fbc43c9da701c193ff61a7f
MD5 7f5674fa23860adbfa85a357cf9f2d15
BLAKE2b-256 8d3feb5b67d1b9772834ff7ab6a6c75004c5cde8c17f4ce772109697314087b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page