predikit  by Tejas-TA

Bridge ML models with AI agents and LLMs

Created 1 month ago
447 stars

Top 66.4% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

Predikit bridges the gap between machine learning models and AI agents, enabling developers to transform trained scikit-learn or XGBoost models into LLM-callable tools. It automates the generation of JSON schemas, enforces typed I/O, and significantly reduces boilerplate code, making ML model integration with AI agents seamless and efficient.

How It Works

The core of Predikit lies in its ModelTool class, which wraps compatible ML estimators. It automatically generates OpenAPI-compliant function-calling schemas and Pydantic input schemas, allowing LLMs to understand and invoke the underlying model. ModelEnsemble allows for parallel execution and reconciliation of multiple models using strategies like averaging or voting, while ToolRegistry groups tools for bulk export to LLM frameworks.

Quick Start & Requirements

  • Install: pip install predikit
  • XGBoost Support: pip install predikit[xgboost]
  • LangChain Support: pip install predikit[langchain]
  • MLflow/Snowflake Support: pip install predikit[mlflow] or predikit[snowflake]
  • Prerequisites: Python, fitted scikit-learn or XGBoost models.
  • Resources: A 30-second example is provided in the README demonstrating basic usage.

Highlighted Details

  • ModelTool & ModelEnsemble: Wraps individual models or ensembles into LLM-friendly tools with typed inputs/outputs and auto-generated schemas.
  • LLM Framework Integration: Directly exports tools as OpenAI function schemas (.to_openai()) or LangChain tools (.to_langchain()).
  • Strict Input Validation: Leverages Pydantic for robust input validation, enforcing that schema field names precisely match model training feature names.
  • Confidence Routing: Supports classifiers with predict_proba to handle low-confidence predictions via warn, raise, or fallback modes.
  • Model Registry Loaders: Built-in support for loading models directly from MLflow and Snowflake Model Registries.

Maintenance & Community

The project includes a CONTRIBUTING.md file detailing development setup and guidelines, and a CHANGELOG tracks notable changes. Specific community channels or active maintainer information are not detailed in the README.

Licensing & Compatibility

The project is released under the permissive MIT license. This license allows for broad compatibility with commercial and closed-source applications, with minimal restrictions.

Limitations & Caveats

Currently, predikit primarily supports scikit-learn and XGBoost models. Support for HuggingFace, PyTorch, and TensorFlow models is planned for future releases. The strict field naming rule between Pydantic schemas and model features requires careful attention to avoid runtime ValueError exceptions.

Health Check
Last Commit

5 days ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
18
Star History
344 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Magnus Müller Magnus Müller(Cofounder of Browser Use), and
86 more.

langchain by langchain-ai

0.4%
141k
Framework for building LLM-powered applications
Created 3 years ago
Updated 1 day ago
Feedback? Help us improve.