Build Structures
Generate Pydantic models from your concept definitions.
Usage
pipelex build structures <TARGET> [OPTIONS]
Arguments:
TARGET- Either a library directory containing.plxfiles, or a specific.plxfile
Options:
-o,--output-dir- Output directory for generated Python files (defaults tostructures/in target's directory)
Examples
Generate structures from a library directory:
pipelex build structures ./my_pipelines/
Generate structures from a specific bundle file:
pipelex build structures ./my_pipeline/bundle.plx
Generate structures to a specific output directory:
pipelex build structures ./my_pipelines/ -o ./generated/
What Gets Generated
For each concept in your library, the command generates:
- Pydantic model classes - Full type definitions for your concepts
- Field definitions - Proper types and constraints
- Validation - Based on concept constraints
Why Use Generated Structures?
Now you have your structures as Python code:
- Iterate on them - Modify and extend the generated classes
- Add custom validation - Add Pydantic validators for business logic
- Use as type hints - Get IDE autocompletion and type checking in your code
- Integrate in your app - Use the models directly in your application
Example Output
For a concept defined in a .plx file like:
[concept.CandidateProfile]
description = "A structured representation of a candidate's professional background."
[concept.CandidateProfile.structure]
skills = { type = "text", description = "Technical and soft skills", required = true }
years_of_experience = { type = "number", description = "Total years of experience" }
education = { type = "text", description = "Educational background", required = true }
work_history = { type = "text", description = "Summary of previous roles", required = true }
You get a Pydantic model:
from pipelex.core.stuffs.structured_content import StructuredContent
from pydantic import Field
class CandidateProfile(StructuredContent):
"""Generated CandidateProfile class"""
skills: str = Field(..., description="Technical and soft skills")
years_of_experience: float = Field(..., description="Total years of experience")
education: str = Field(..., description="Educational background")
work_history: str = Field(..., description="Summary of previous roles")
Related Documentation
- Build Pipe - Generate pipelines from natural language
- Build Runner - Generate Python runner scripts
- Concepts - Understanding concept definitions