AI Prompts for Adding AI Features
“Add an AI chat widget using the OpenAI API with streaming responses. Show messages in a chat bubble layout with the user on the right and AI on the left. Include a text input and send button.”
Free AI prompt · The Code Book
A ready-to-use prompt from the chapter AI Integration. Paste it into Claude, ChatGPT, Lovable, Bolt or any AI coding tool.
“Add an AI-powered search to my documentation site. Use OpenAI embeddings to find the most relevant docs based on the user's question, then generate a natural language answer with citations.”
“Add an AI chat widget using the OpenAI API with streaming responses. Show messages in a chat bubble layout with the user on the right and AI on the left. Include a text input and send button.”
“Set up the Gemini API in my Next.js app using the free tier. Create an /api/chat route that uses the latest Gemini Flash model with streaming, and show me the env variable I need and where to get the API key.”
“Swap the chat widget in my project from OpenAI to Gemini using the Vercel AI SDK. Keep everything else the same and point me to which env variables I need to change.”
“Add a 'Generate Description' button next to my product form. When clicked, use the AI to generate a product description based on the product name and category fields. Show a loading spinner.”
“Add a text summarization feature. Users paste an article into a textarea and click 'Summarize'. Use the Anthropic API to return a 3-bullet summary. Stream the response.”
“Set up the Vercel AI SDK with OpenAI in my Next.js app. Create an API route at /api/chat and a chat page with streaming messages, a stop button, and conversation history.”