3.2: Customize To App¶
ITERATION STEP 0: Let's fix the error and customize the defaults!
1. Create chat-0.prompty
¶
Our final Contoso Chat application is called chat.prompty
.
Let's reflect that by copying over the basic.prompty
to a starter asset called chat-0.prompty
. We can then bump up the version number with each step to get an intuitive sense of the iterative nature of prompt engineering.
Make sure you are in the sandbox/ folder - then run this command!
cp basic.prompty chat-0.prompty
Open or reload the chat-0.prompty
file in your editor!
2. Before → Identify Fixes¶
Look at the file contents (below). Let's identify the fixes to make in this iteration:
- Update App Metadata: Lines 2-5 should describe the application and developer details.
- Update Model Config: Line 11 should replace
<your-deployment>
with a model name. - Remove Context Lines 17-22 provide sample context that is irrelevant to our app.
- Remove Usage Also remove Lines 35-37 since the context variable no longer exists.
chat-0.prompty (before)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
3. After → Apply Fixes¶
-
For convenience, we've got staged versions that have these fixes completed. Let's copy that over.
cp ../docs/workshop/src/1-build/chat-0.prompty .
-
This is what our first iteration looks like. Let's run this next to validate the fixes.
chat-0.prompty (after)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
--- name: Contoso Chat Prompt description: A retail assistant for Contoso Outdoors products retailer. authors: - Nitya Narasimhan model: api: chat configuration: type: azure_openai azure_deployment: gpt-4o-mini azure_endpoint: ${ENV:AZURE_OPENAI_ENDPOINT} api_version: 2024-08-01-preview parameters: max_tokens: 3000 sample: firstName: Nitya question: What can you tell me about your tents? --- system: You are an AI assistant who helps people find information. As the assistant, you answer questions briefly, succinctly, and in a personable manner using markdown and even add some personal flair with appropriate emojis. # Customer You are helping {{firstName}} to find answers to their questions. Use their name to address them in your responses. # user {{question}}
4. Run The Prompty¶
- Reload
chat-0.prompty
in the VS Code editor to refresh it. -
Run the refreshed prompty (using the play icon or by clicking F5)
You should see a valid response (like this) in the Visual Studio Code terminal
Hello Nitya! 😊 I can’t provide details about a specific company’s tents, but generally, tents come in various types including: - **Dome Tents:** Great for easy setup and stability. - **Backpacking Tents:** Lightweight and compact for hiking. - **Family Tents:** Spacious with room for multiple people. - **Pop-Up Tents:** Quick to pitch, perfect for casual outings. They vary by material, weather resistance, and features like vestibules or built-in storage. If you’re looking for something specific, let me know! 🏕️✨
Note: Generative AI models are stochastic, meaning that the same query will not always generate the same response. Your output may look different - but this validates that the previous error is fixed.
CONGRATULATIONS. You have a functioning prompt asset!