Scikit-LLM integrates large language models with scikit-learn for text analysis tasks. It provides zero-shot classification capabilities and example code for GPT-based classifiers.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
Scikit-LLM aims to integrate powerful language models into scikit-learn workflows to enhance text analysis tasks, including zero-shot classification examples using GPT models.
How it works
The project provides modules that allow configuring OpenAI credentials via a config class and using GPT-based classifiers within a scikit-learn-like interface. An example shows loading a dataset, configuring keys, and applying a ZeroShotGPTClassifier with a specified model.
Getting started
Install the package with:
pip install scikit-llm
Then follow the Quick Start example:
# Import the necessary modules
from skllm.datasets import get_classification_dataset
from skllm.config import SKLLMConfig
from skllm.models.gpt.classification.zero_shot import ZeroShotGPTClassifier
# Configure the credentials
SKLLMConfig.set_openai_key("<YOUR_KEY>")
SKLLMConfig.set_openai_org("<YOUR_ORGANIZATION_ID>")
# Load a demo dataset
X, y = get_classification_dataset() # labels: positive, negative, neutral
# Initialize the model and make the predictions
clf = ZeroShotGPTClassifier(model="gpt-4")
clf.fit(X,y)
clf.predict(X)
For more information please refer to the documentation.
Recent releases
- v1.4.3 (2026-01-21): Fix prompt typo templates.py (#125); Remove debug print statement and bump to v1.4.3 (#129)
- v1.4.2 (2025-09-20): Features: Added model constants file and standardize model name usage (#124); Added Anthropic API support (#118); Added support for reasoning models/gpt-5
- v1.4.1 (2024-11-09): Fixed labels extraction for multi-label classifiers (#117)
- v1.4.0 (2024-08-04): Replaced gpt4all with llama-cpp-python (#110)
- v1.3.1 (2024-07-24): Added gpt-4o-mini to the list of tunable models (#108)
Traction
Stars: 3530
Behind the repo
Not provided in the README.
Caveats
License: MIT Created: 2023-05-12 Last push: 2026-08-01 Open issues: 21






