scikit-llm

Seamlessly integrate LLMs into scikit-learn.

What is scikit-llm?

Seamlessly integrate LLMs into scikit-learn.

Overview of scikit-llm

What it is

Scikit-LLM is an open-source library that integrates large language models (LLMs) into the scikit-learn ecosystem. It allows users to apply models like ChatGPT for text analysis tasks using scikit-learn's familiar API. The project is licensed under MIT and is developed by beastbyte.ai.

Key features

  • Zero-shot text classification using GPT models (e.g., GPT-4)
  • Seamless integration with scikit-learn pipelines and estimators - Support for configuring OpenAI API credentials via SKLLMConfig
  • Built-in dataset loading utilities for classification tasks - Compatible with standard scikit-learn methods like fit and predict

Use cases

  • Text classification without requiring labeled training data (zero-shot)
  • Sentiment analysis (positive, negative, neutral)
  • Any text analysis task that can leverage LLMs within a scikit-learn workflow

Getting started

Install the package: bash pip install scikit-llm Quick start example for zero-shot classification: python from skllm.datasets import get_classification_dataset from skllm.config import SKLLMConfig from skllm.models.gpt.classification.zero_shot import ZeroShotGPTClassifier SKLLMConfig.set_openai_key('') SKLLMConfig.set_openai_org('') X, y = get_classification_dataset() clf = ZeroShotGPTClassifier(model='gpt-4') clf.fit(X, y) clf.predict(X) For full documentation, see the repository README.

License and pricing

The project is open source under the MIT license. There is no stated pricing; the library itself is free to use, but using GPT models requires an OpenAI API key with associated costs.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/fnnx-aiscikit-llm.svg)](https://yunodb.com/tools/fnnx-aiscikit-llm?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/fnnx-aiscikit-llm?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/fnnx-aiscikit-llm.svg" alt="Featured on YunoDB" height="20"></a>