What problem does it solve?
Sagebase projects using BAML often struggle with maintaining consistent, type-safe bindings between defined BAML schemas and generated clients. This skill consolidates best practices for creating BAML definitions, regenerating clients, and applying hybrid design patterns to ensure reliable, scalable integrations.
Core Features & Use Cases
- BAML Definitions: Create and manage .baml files in baml_src/ to describe prompts, schemas, and client behavior.
- Client Regeneration: Automate regeneration of the baml_client code after changes, ensuring synchronization with definitions.
- Hybrid Patterns: Implement hybrid approaches (rule-based matching + BAML) to optimize performance and cost, while maintaining accuracy.
- Factory Patterns: Use factory patterns to instantiate BAML-based services and promote modularity.
Quick Start
Create a new .baml definition in baml_src/ (e.g., politician_matching.baml) and run the BAML client generation script to produce or update the corresponding Python client under baml_client/. Then integrate the generated client into your service.