All skills
14 of 113 — copy any prompt into Lovable, or read the guide.
AI cost guardrails
Set per-user daily caps and short-circuit before calling the model.
AI eval loop
Ship a small eval set before iterating on prompts — otherwise you're guessing.
Build a tiny eval harness for prompts
Stop guessing whether a prompt change helped — score it against a fixed set of cases before shipping.
Chat completion via Lovable AI Gateway
Call a hosted Gemini/OpenAI chat model from a server function — no API keys needed.
Choose the right model
Match model to task: Flash for cheap/fast, Pro for reasoning, image models for pixels.
Embeddings + RAG
Store document embeddings in pgvector and retrieve top-k chunks for a chat prompt.
Generate an image
Use the AI Gateway to generate an image and save it to Cloud storage.
Model fallback and graceful degradation
Keep AI features alive when a model is rate limited, over budget, or simply down.
Prompt-injection and safety
Treat all model output and all retrieved content as untrusted input.
Speech-to-text
Accept an audio blob and return a transcript with word timestamps.
Stream a chat response
Stream tokens to the browser using a server route + Web Streams.
Structured JSON output
Force the model to return typed JSON matching a Zod schema.
Text-to-speech
Generate an MP3 from text and stream it back to the client.
Tool / function calling
Give the model tools it can call and route them to your server functions.