|
1 | 1 | ---
|
2 |
| -Order: 4 |
3 |
| -Area: intelligentapps |
4 |
| -TOCTitle: Prompt Builder |
5 | 2 | ContentId: bd3d7555-3d84-4500-ae95-6dcd39641af0
|
6 |
| -PageTitle: Prompt Builder |
7 | 3 | DateApproved: 04/09/2025
|
8 | 4 | MetaDescription: Get Started with creating, iterating and optimizing your prompts in AI Toolkit.
|
9 | 5 | ---
|
10 | 6 | # Prompt engineering in AI Toolkit
|
11 | 7 |
|
12 |
| -Prompt builder in AI Toolkit streamlines the prompt engineering workflow by generating starter prompts, helping you iterate and refine with each run, breaking down complex tasks through prompt chaining and structured outputs, and providing easy access to code for seamless LLM integration via APIs. |
| 8 | +Prompt builder in AI Toolkit streamlines the prompt engineering workflow. It can generate starter prompts, helping you iterate and refine with each run, break down complex tasks through prompt chaining and structured outputs, and provide easy access to code for seamless Large Language Model (LLM) integration via APIs. |
13 | 9 |
|
14 | 10 | 
|
15 | 11 |
|
16 |
| -## Create, edit and test prompts |
| 12 | +## Create, edit, and test prompts |
| 13 | + |
| 14 | +To access the prompt builder, use either of these options: |
17 | 15 |
|
18 |
| -To access the prompt builder, use one of these options: |
19 | 16 | - In the AI Toolkit view, select **Prompt Builder**
|
20 | 17 | - Select **Try in Prompt Builder** from a model card in the model catalog
|
21 | 18 |
|
22 | 19 | To test a prompt in the prompt builder, follow these steps:
|
| 20 | + |
23 | 21 | 1. In **Models**, select a model from the dropdown list, or select **Browse models** to add another model from the model catalog.
|
| 22 | + |
24 | 23 | 
|
25 |
| -2. Enter a **User prompt** and optionally enter a **System prompt** |
26 |
| - The user prompt is the input that you want to send to the model. The optional system prompt is used to provide instructions with relevant context to guide the model response. |
| 24 | + |
| 25 | +1. Enter a **User prompt** and optionally enter a **System prompt**. |
| 26 | + |
| 27 | + The *user prompt* is the input that you want to send to the model. The optional *system prompt* is used to provide instructions with relevant context to guide the model response. |
27 | 28 |
|
28 | 29 | > [!TIP]
|
29 | 30 | > If you don't know how to input these prompts, you can describe your project idea in natural language and let the AI-powered feature generate prompts for you to experiment with.
|
30 | 31 | > 
|
31 |
| -3. Select **Run** to send the prompts to the selected model |
32 |
| -4. Optionally, select **Add Prompts** to add more user and assistant prompts to the conversation, or select **Use Response as Assistant Prompt** as the history and context you send to the model to further guide the model's behavior |
33 |
| -5. Repeat the previous steps to iterate over your prompts by observing the model response and making changes to the prompts |
| 32 | +
|
| 33 | +1. Select **Run** to send the prompts to the selected model. |
| 34 | + |
| 35 | +1. Optionally, select **Add Prompts** to add more user and assistant prompts to the conversation, or select **Use Response as Assistant Prompt** as the history and context you send to the model to further guide the model's behavior. |
| 36 | + |
| 37 | +1. Repeat the previous steps to iterate over your prompts by observing the model response and making changes to the prompts. |
34 | 38 |
|
35 | 39 | ## Structured output
|
36 | 40 |
|
37 | 41 | Structured output support helps you design prompts to deliver outputs in a structured, predictable format.
|
| 42 | + |
38 | 43 | 
|
39 | 44 |
|
40 | 45 | To test a prompt in the prompt builder, follow these steps:
|
41 | 46 |
|
42 |
| -1. Select the **Format** dropdown in the **Response** area, and select **json_schema** |
43 |
| -2. Select **Prepare schema** |
44 |
| -3. From the Command Palette, either select **Select local file** to use your own schema, or select **Use an example** to use a predefined schema |
45 |
| - If you proceed with an example, you can select a schema from the dropdown list |
46 |
| -5. Select **Run** to send the prompts to the selected model |
47 |
| -6. You can also edit the schema by selecting **Edit** |
| 47 | +1. Select the **Format** dropdown in the **Response** area, and select **json_schema**. |
| 48 | + |
| 49 | +1. Select **Prepare schema**, and then select **Select local file** to use your own schema, or select **Use an example** to use a predefined schema. |
| 50 | + |
| 51 | + If you proceed with an example, you can select a schema from the dropdown list. |
| 52 | + |
| 53 | +1. Select **Run** to send the prompts to the selected model. |
| 54 | + |
| 55 | +1. You can also edit the schema by selecting **Edit**. |
| 56 | + |
48 | 57 | 
|
49 | 58 |
|
50 | 59 | ## Integrate prompt engineering into your application
|
51 | 60 |
|
52 | 61 | After experimenting with models and prompts, you can get into coding right away with the automatically generated Python code.
|
| 62 | + |
53 | 63 | 
|
| 64 | + |
54 | 65 | To view the Python code, follow these steps:
|
55 |
| -1. Select **View Code** |
56 |
| -1. Select the inference SDK you want to use if it's hosted by GitHub |
57 | 66 |
|
58 |
| - AI Toolkit generates the code for the model you selected by using the provider's client SDK. For models hosted by GitHub, you have the option to select the inference SDK you want to use: [Azure AI Inference SDK](https://learn.microsoft.com/python/api/overview/azure/ai-inference-readme?view=azure-python-preview) or the SDK from the model provider, such as [OpenAI SDK](https://platform.openai.com/docs/libraries) or [Mistral API](https://docs.mistral.ai/api). |
| 67 | +1. Select **View Code**. |
| 68 | + |
| 69 | +1. For models hosted on GitHub, select the inference SDK you want to use. |
| 70 | + |
| 71 | + AI Toolkit generates the code for the model you selected by using the provider's client SDK. For models hosted by GitHub, you can choose which inference SDK you want to use: [Azure AI Inference SDK](https://learn.microsoft.com/python/api/overview/azure/ai-inference-readme?view=azure-python-preview) or the SDK from the model provider, such as [OpenAI SDK](https://platform.openai.com/docs/libraries) or [Mistral API](https://docs.mistral.ai/api). |
| 72 | + |
59 | 73 | 1. The generated code snippet is shown in a new editor, where you can copy it into your application.
|
60 |
| -1. You can view the generated code snippet in a new file window and copy them into your application. |
61 |
| - > To authenticate with the model you usually need an API key from the provider. To access models hosted by GitHub, [generate a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) (PAT) in your GitHub settings |
| 74 | + |
| 75 | + > To authenticate with the model, you usually need an API key from the provider. To access models hosted by GitHub, [generate a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) (PAT) in your GitHub settings. |
62 | 76 |
|
63 | 77 | ## Next steps
|
64 | 78 |
|
65 | 79 | - [Run an evaluation job](/docs/intelligentapps/evaluation.md) for the popular evaluators
|
66 |
| -- [Run evaluation](/docs/intelligentapps/evaluation.md) job for the popular evaluators |
|
0 commit comments