Design API parameters to support future extension without breaking changes. Use string enums instead of boolean flags when the parameter might need additional values later, implement comprehensive parameter forwarding with **kwargs, and avoid overly specific parameter designs that limit future flexibility.
Key patterns to follow:
String enums over booleans: Instead of contains_ontology_schema: bool = False
, use html_parser: str = "v1"
to allow future parser versions without new parameters.
Comprehensive parameter forwarding: Use **kwargs
to forward all parameters to delegate functions rather than explicitly listing each one:
```python
elements = _partition_doc(filename, file=file, **kwargs)
elements = _partition_doc( filename=filename, file=file, infer_table_structure=infer_table_structure, languages=languages, strategy=strategy, **kwargs, ) ```
This approach ensures APIs can evolve gracefully, reduces maintenance overhead when adding new parameters, and provides a consistent experience for API consumers. All partitioners automatically receive new parameters through kwargs without requiring explicit updates to forwarding logic.
Enter the URL of a public GitHub repository