Skip to main content
This tutorial guides you through the essential steps to install the plexe library, define a model using natural language, build it using your data, and make predictions.

1. Installation

First, install the plexe library using pip. You can choose between a standard installation, a lightweight version (without deep learning dependencies), or include all optional dependencies.

2. Set Up Environment Variables

Plexe uses Large Language Models (LLMs) under the hood via the LiteLLM library. You need to configure API keys for the LLM provider you want to use. Set them as environment variables:
Plexe defaults to openai/gpt-4o-mini if no provider is specified.

3. Prepare Your Data

For this example, let’s assume you have a CSV file named housing_data.csv with features like square_footage, bedrooms, bathrooms, and a target column price.

4. Define and Build the Model

Import the plexe library and create a Model instance. Define your goal using the intent parameter. You can also specify input and output schemas, though Plexe can often infer them.
The build process involves multiple steps orchestrated by AI agents: planning, code generation, execution, analysis, and potentially fixing code. Enabling chain_of_thought=True provides verbose output showing these steps.

5. Make Predictions

Once the model state is READY, you can use the predict method.

6. Inspect the Model

You can get metadata and a description of the built model.

7. Save and Load (Optional)

Persist your trained model for later use.
That’s it! You’ve built, trained, and used a machine learning model using natural language with the plexe library. Explore the other tutorials and guides to learn about more advanced features.