Skip to content

scikit-ai

ci doc

Category Tools
Development black ruff mypy docformatter
Package version pythonversion downloads
Documentation mkdocs
Communication gitter discussions

Introduction

A unified AI library that brings together classical Machine Learning, Reinforcement Learning, and Large Language Models under a consistent and simple interface.

It mimics the simplicity of scikit-learn’s API and integrates with its ecosystem, while also supporting libraries like TorchRL, oumi, and others.

Installation

For user installation, scikit-ai is currently available on the PyPi's repository, and you can install it via pip:

pip install scikit-ai

Development installation requires to clone the repository and then use PDM to install the project as well as the main and development dependencies:

git clone https://github.com/georgedouzas/scikit-ai.git
cd scikit-ai
pdm install

Usage

We aim to provide a simple and user-friendly API for working with AI models and functionalities.

Classification

Let’s start with a basic text classification example:

X = ['This is a positive review.', 'This is a negative review.']
y = [1, 0]

Now, create a k-shot classifier:

from skai.llm import OpenAIClassifier

clf = OpenAIClassifier()
clf.fit(X, y)
clf.predict([
    'I absolutely loved this movie!',
    'The product was terrible and broke immediately.'
])

By default, the classifier uses reasonable k-shot settings. You can inspect them:

Number of examples used in the prompt:

print(clf.k_shot_)

Instructions given to the model:

print(clf.instructions_)

The complete prompt sent to the language model:

print(clf.prompt_)

You can also customize the classifier in detail by adjusting its parameters. For more options and examples, please consult the full API documentation.