- Craft effective prompts for both word-based and conversational APIs
- Manage conversation history to maintain context
- Assemble building blocks for a responsive customer-service chatbot
- Deploy a sample chatbot for a fictional fast-food burger restaurant
Make sure you have an active OpenAI API key. You can sign up at OpenAI.
Word Completion vs. Chat Completion
| Feature | Word Completion | Chat Completion |
|---|---|---|
| API Endpoint | /v1/completions | /v1/chat/completions |
| Input Format | Plain prompt string | Array of structured messages |
| Best Use Cases | Short text generation, code fixes | Stateful conversations, multi-turn dialogues |
| Model Examples | text-davinci-003 | gpt-3.5-turbo, gpt-4 |
| Context Management | Limited (token-based) | Full message history, system/user/assistant roles |
What You’ll Build
- Prompt Engineering: Learn how to frame user requests for accurate responses.
- Context Storage: Implement a history buffer to pass previous messages to the API.
- Chat Loop: Create an interactive loop to send and receive messages.
- Fast-Food Bot: Deploy a customer-service chatbot that takes orders, answers FAQs, and handles errors.