AI Engineering Cookbook
Welcome to the Cookbook. This is a collection of copy-paste ready code snippets and patterns for common AI engineering tasks.
How to use
- Find the recipe you need.
- Copy the code into your project.
- Adjust imports (we use standard libraries like
ai,openai,zod).
🧩 UI Patterns
- Chat UI Component: A reusable, styled chat interface with streaming support.
- Form Autocomplete: "Magic Fill" buttons for your forms.
🛡️ Security & Reliability
- API Proxy: Securely calling LLMs from the backend.
- Content Moderation: Filtering inputs/outputs.
- Error Handling: Retries, timeouts, and fallbacks.
🚀 Performance
- Local Embeddings: Semantic search in the browser (Transformers.js).
Contributing
Got a cool pattern?
- Fork the repo.
- Add a markdown file in
docs/cookbook/. - Submit a PR.