How iryna-kondr/scikit-llm works
Scikit-LLM exposes scikit-learn-style estimators that turn text into classifications, labels, summaries, translations, and vectors using language-model providers. The principal workflow is to configure credentials, load text and optional labels, fit an estimator, build prompts, call a provider, and return predictions. Few-shot classification can additionally embed examples and retrieve neighbors from an in-memory index. The graph preserves provider and task branches documented by the source tree; some unsampled implementations are represented at their existing directories, and their unverified links are omitted.
Main entry points: models Classification estimators · gpt/mixin.py GPT adapter · anthropic/mixin.py Anthropic adapter · base.py Provider interfaces
Components 21
Text tasks
- Classification estimators
skllm/models - Text transforms
skllm/models - Entity tagging
skllm/models - GPT vectorizer
skllm/models/gpt/vectorization.py
Model providers
- GPT adapter
skllm/llm/gpt/mixin.py - Anthropic adapter
skllm/llm/anthropic/mixin.py - Vertex adapter
skllm/llm/vertex/mixin.py - OpenAI embeddings
skllm/llm/gpt/clients/openai/embedding.py
Shared runtime
- Classifier runtime
skllm/models/_base/classifier.py - Text task runtime
skllm/models/_base/text2text.py - Tagging runtime
skllm/models/_base/tagger.py - Vectorizer runtime
skllm/models/_base/vectorizer.py - Prompt builders
skllm/prompts/builders.py - Prompt templates
skllm/prompts/templates.py - Provider interfaces
skllm/llm/base.py
Examples and memory
- Similarity indexes
skllm/memory
Configuration and data
- Credentials config
skllm/config.py - Task datasets
skllm/datasets - Model defaults
skllm/model_constants.py
Other components
- Estimator user
- LLM services
Connections 31
- Estimator user → Classification estimators: fits and predicts
README.md - Estimator user → Task datasets: loads examples
README.md - Classification estimators → Classifier runtime: uses runtime
skllm/models/gpt/classification/few_shot.py - Text transforms → Text task runtime: uses runtime
skllm/models/gpt/text2text/tunable.py - Entity tagging → Tagging runtime: uses runtime
- GPT vectorizer → Vectorizer runtime: extends
skllm/models/gpt/vectorization.py - Classifier runtime → Provider interfaces: implements interface
skllm/models/_base/classifier.py - Vectorizer runtime → Provider interfaces: implements interface
skllm/models/_base/vectorizer.py - Classifier runtime → Prompt builders: builds prompts
skllm/models/_base/classifier.py - Prompt builders → Prompt templates: uses templates
skllm/prompts/builders.py - Classification estimators → GPT adapter: mixes in
skllm/models/gpt/classification/few_shot.py - Classification estimators → Anthropic adapter: mixes in
skllm/models/anthropic/classification/few_shot.py - Classification estimators → Vertex adapter: mixes in
skllm/models/vertex/classification/zero_shot.py - Text transforms → GPT adapter: mixes in
skllm/models/gpt/text2text/summarization.py - Text transforms → Vertex adapter: mixes in
skllm/models/vertex/text2text/tunable.py - Entity tagging → GPT adapter: mixes in
skllm/models/gpt/classification/few_shot.py - Entity tagging → Anthropic adapter: mixes in
skllm/models/anthropic/classification/few_shot.py - GPT adapter → Provider interfaces: implements interface
skllm/llm/gpt/mixin.py - Anthropic adapter → Provider interfaces: implements interface
skllm/llm/anthropic/mixin.py - Vertex adapter → Provider interfaces: implements interface
skllm/llm/vertex/mixin.py - GPT adapter → Credentials config: reads credentials
skllm/llm/gpt/mixin.py - Anthropic adapter → Credentials config: reads credentials
skllm/llm/anthropic/mixin.py - GPT adapter → LLM services: requests completions
skllm/llm/gpt/mixin.py - Vertex adapter → LLM services: requests completions
skllm/llm/vertex/mixin.py - Anthropic adapter → LLM services: requests completions
skllm/llm/anthropic/mixin.py - GPT adapter → OpenAI embeddings: requests embeddings
- GPT vectorizer → GPT adapter: gets embeddings
skllm/models/gpt/vectorization.py - Classification estimators → GPT vectorizer: embeds examples
skllm/models/gpt/classification/few_shot.py - Classification estimators → Similarity indexes: retrieves neighbors
skllm/models/gpt/classification/few_shot.py - Classification estimators → Model defaults: uses defaults
skllm/models/gpt/classification/few_shot.py - Text transforms → Model defaults: uses defaults
skllm/models/gpt/classification/few_shot.py