Provide I/O Schemas
Define the expected structure of your model inputs and outputs using Pydantic models or dictionaries.
Specifying input and output schemas helps Plexe understand the data your model will work with and what it should produce. While Plexe can often infer schemas if you provide data during the build
process, explicitly defining them provides clarity and ensures the generated model adheres to your requirements.
You can provide schemas during plexe.Model
initialization using either Pydantic models or Python dictionaries.
Using Pydantic Models
Pydantic models offer robust type validation and are the recommended way to define schemas.
Using Dictionaries
You can also define schemas using simple Python dictionaries mapping field names to their types.
When using dictionaries, Plexe currently supports basic Python types like int
, float
, str
, and bool
. For more complex types or validation rules, use Pydantic models directly.
Schema Inference
If you don’t provide input_schema
or output_schema
but do provide datasets
during the model.build()
call, Plexe will attempt to infer the schemas:
- Identify Target: An LLM analyzes the column names and your
intent
to identify the most likely target variable(s) for the output schema. - Determine Types: Data types are inferred from the provided Pandas DataFrame(s).
- Construct Schemas: Inferred input and output schemas are created.
While schema inference is convenient, providing explicit schemas is generally recommended for clarity and control, especially for complex models or specific data validation requirements.