Skip to main content

Scikit-Ollama: an extension of Scikit-LLM for Ollama served models.

Leverage the power of Scikit-LLM and the security of self-hosted LLMs.

Installation

pip install scikit-ollama

Support us

You can support the project in the following ways:

  • Support the original Scikit-LLM package. New features will be made available downstream slowly but surely.
  • Star this repository.
  • Provide feedback in the issues section.
  • Share this repository with others.

Quick start & documentation

Assuming you have installed and configured Ollama to run on your machine:

from skllm.datasets import get_classification_dataset
from skollama.models.ollama.classification.zero_shot import ZeroShotOllamaClassifier

X, y = get_classification_dataset()

clf = ZeroShotOllamaClassifier(model="llama3:8b")
clf.fit(X, y)
preds = clf.predict(X)

For more information please refer to the documentation.

Why Scikit-Ollama?

Scikit-Ollama lets you use locally run models for several text classification approaches. Running models locally can be beneficial for cases where data privacy and control are paramount. This also makes you less dependent on 3rd-party APIs and gives you more control over when you want to add changes.

This project builds heavily on Scikit-LLM and has it as a core dependency. Scikit-LLM provides broad and great support to query a variety of backend families, e.g. OpenAI, Vertex, GPT4All. In their version you could already use the OpenAI compatible v1 API backend to query locally run models. However, the issue is that Ollama does not support passing options, such as the context size to that endpoint.

Therefore this model uses the Ollama Python SDK to allow that level of control.

Contributing

For a guide to contributing please follow the steps here.

Citation

@software{Scikit-Ollama,
    author = {Andreas Karasenko},
    year = {2024},
    title = {Scikit-Ollama: an extension of Scikit-LLM for Ollama served models},
    url = {https://github.com/AndreasKarasenko/scikit-ollama}
}

If you consider citing this repository, please also consider citing scikit-llm.

Metadata

Release files for scikit-ollama 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scikit-ollama 0.3.2
File Size Uploaded
scikit_ollama-0.3.2.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scikit-ollama 0.3.2
File Interpreter ABI Platform
scikit_ollama-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / scikit_ollama-0.3.2.tar.gz

Download URL scikit_ollama-0.3.2.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
35d42ed4d9142790996d11daf15e7a33313e0447dd92f62ed79992b17b39688b
BLAKE2b-256 checksum
How to use checksums
a0d5a1ed39d84f699c33c1ce609557483a217657f283fd5b0e6b91cecd131eff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2025.

Transparency log

Release files / scikit_ollama-0.3.2-py3-none-any.whl

Download URL scikit_ollama-0.3.2-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d64ba0ddd1a2096c0b84fb75e7f288a2732ba839ca5eb78c64a7c12b5414158
BLAKE2b-256 checksum
How to use checksums
b75dd19d00672ca5abc270ac0bf8947b0f23b1298a1d1821e05ce87795cbd0a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page