Skip to content

Core‐Concepts

Tejas edited this page May 30, 2026 · 1 revision

Core Concepts

At its heart, predikit performs three critical functions: Validation, Transformation, and Inference.

1. The Validation Layer

When an LLM calls a tool, it often passes arguments as a JSON string. predikit uses your input_schema (Pydantic) to ensure:

  • All required features are present.
  • Data types (ints, floats, bools) are correct.
  • Out-of-range values are caught before they hit the model.

2. Feature Mapping

Machine Learning models are picky about feature order.

  • DataFrame Models: If your model was trained on a DataFrame, predikit automatically aligns the LLM's input keys to the correct column order.
  • NumPy Models: If no feature names are found, predikit maps the Pydantic fields to the model input based on the order they are defined in the class.

3. Coercion Logic

LLMs are "chatty." They might pass the string "1" instead of the integer 1. predikit includes built-in coercion logic, especially for Booleans (mapping "yes", "true", "on" to True), to prevent common agent failure points.

Clone this wiki locally