Background to the issue
The composite system example is prone to data format mismatch or state inconsistency problems when the retrieval system, classification system, and generation system work in tandem.
prescription
- Standardization of middleware: Agree on a uniform JSON Schema data exchange format across all subroutines.
- Condition Monitoring: Tracking module inputs and outputs using LangWatch's visualization capabilities
- Rollback mechanism: Add data validation logic in run.py to automatically fallback to the previous step in case of an exception
carry out in practice
- Create shared_schema.py to uniformly define data fields and validation rules
- Modify signatures.py of each subroutine to inherit the base signatures
- Add jsonschema dependency in requirements.txt for data validation
best practice
It is recommended to start with composite examples of document processing classes (e.g., rag_system), whose textual data has lower consistency risk than structured data and is easier to debug.
This answer comes from the articleDSPy Examples: Practical examples demonstrating DSPy functionalityThe































