This is basically a full system design in one prompt.
Start by clarifying the problem scope and constraints, then walk through a layered architecture: schema extraction, LLM-based formula generation with grounding, validation, and safe application. Emphasize the importance of a robust output contract and iterative refinement to handle ambiguity and edge cases.
Pro tip: Treat the LLM as a code generator that must be constrained by a strict schema and validated against the live table; always include a dry-run or preview step before applying changes to avoid destructive errors.
Ask clarifying questions about user expectations, supported formula complexity, and safety requirements. Define success metrics and constraints like latency, accuracy, and API rate limits.
Outline components: schema fetcher (via Airtable API), prompt builder, LLM caller, formula parser/validator, and applier. Describe data flow and error handling at each stage.
Explain how to ground the LLM with the table schema (field names, types, relationships) and provide examples. Use few-shot prompting and constrain output to a JSON contract with formula and explanation.
Detail validation steps: syntax check, type inference, dry-run on sample rows, and user confirmation. Discuss safety measures like permission checks, rate limiting, and rollback plans.
Propose evaluation metrics (accuracy, latency, user satisfaction) and a test suite covering edge cases (ambiguous requests, missing fields, complex logic). Describe how to iterate based on feedback.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.