|
2 | 2 | Order: 4
|
3 | 3 | Area: intelligentapps
|
4 | 4 | TOCTitle: Prompt Builder
|
5 |
| -ContentId: |
| 5 | +ContentId: bd3d7555-3d84-4500-ae95-6dcd39641af0 |
6 | 6 | PageTitle: Prompt Builder
|
7 |
| -DateApproved: |
| 7 | +DateApproved: 04/09/2025 |
8 | 8 | MetaDescription: Get Started with creating, iterating and optimizing your prompts in AI Toolkit.
|
9 | 9 | ---
|
10 |
| -# Prompt Engineering in AI Toolkit |
| 10 | +# Prompt engineering in AI Toolkit |
11 | 11 |
|
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. |
| 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. |
13 | 13 |
|
14 |
| - |
| 14 | + |
15 | 15 |
|
16 | 16 | ## Create, edit and test prompts
|
17 | 17 |
|
18 |
| -To access the Prompt Builder: |
19 |
| -- In AI Toolkit view, select **Prompt Builder** |
| 18 | +To access the prompt builder, use one of these options: |
| 19 | +- In the AI Toolkit view, select **Prompt Builder** |
20 | 20 | - Select **Try in Prompt Builder** from a model card in the model catalog
|
21 | 21 |
|
22 | 22 | To test a prompt in the prompt builder, follow these steps:
|
23 |
| -1. In **Models**, select a model from the dropdown list or click **Browser models** to add another model from model catalog. |
24 |
| -  |
25 |
| -2. Enter **System prompt** and **User prompt** |
| 23 | +1. In **Models**, select a model from the dropdown list, or select **Browse models** to add another model from the model catalog. |
| 24 | +  |
| 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. |
| 27 | + |
26 | 28 | > [!TIP]
|
27 |
| - > - System prompt is optional, it is used to provide instructions with relevant context to guide the model response |
28 |
| - > - User prompt is mandatory, it is the input you want to send to the model |
29 |
| - > - If you don't know how to input these prompts, you can simply describe your project idea in natural language and let the AI-powered feature generate prompts for you to experiment with |
30 |
| - >  |
31 |
| -3. Click **Run** to send the prompts to the selected model |
32 |
| -4. Optionally, you can click **Add Prompts** to add more User and Assistant prompts to the conversation, or **Use Response as Assistant Prompt** as the history and context you send to the model to further guide the model's behavior |
33 |
| -5. You can repeat the above steps to iterate over your prompts by observing the model response and making changes to the prompts |
| 29 | + > 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 | +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 |
34 | 34 |
|
35 | 35 | ## Structured output
|
36 | 36 |
|
37 | 37 | Structured output support helps you design prompts to deliver outputs in a structured, predictable format.
|
38 |
| - |
| 38 | + |
39 | 39 |
|
40 | 40 | To test a prompt in the prompt builder, follow these steps:
|
41 | 41 |
|
42 |
| -1. Click on **Format** dropdown In **Response** area, and select **json_schema** |
43 |
| -2. Click on **Prepare schema** |
44 |
| -3. From the command palette, you have two options, you can either use your own schema by selecting **Select local file**, or use a predefined schema by selecting **Use an example** |
45 |
| -4. If you proceed with an example, you can select a schema from the dropdown list |
46 |
| -5. Click on **Run** to send the prompts to the selected model |
47 |
| -6. You can also edit the schema by clicking on **Edit** |
48 |
| -  |
| 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** |
| 48 | +  |
49 | 49 |
|
50 | 50 | ## Integrate prompt engineering into your application
|
51 |
| -After experimenting with models and prompts, you can get into coding right away by viewing ready-to-use Python code automatically generated |
52 |
| - |
53 | 51 |
|
54 |
| -To access the code, follow these steps: |
55 |
| -1. Click on **View Code** |
56 |
| -2. Select the inference SDK you want to use if it's hosted by GitHub |
57 |
| - > [!TIP] |
58 |
| - > AI Toolkit will generate the code for the corresponding model you selected 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 model provider such as [OpenAI SDK](https://platform.openai.com/docs/libraries) or [Mistral API](https://docs.mistral.ai/api). |
59 |
| -3. You can view the generated code snippet in a new file window and copy them into your application. |
60 |
| - > [!TIP] |
61 |
| - > To authenticate with the model you will normally need 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 |
| 52 | +After experimenting with models and prompts, you can get into coding right away with the automatically generated Python code. |
| 53 | + |
| 54 | +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 | + |
| 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). |
| 59 | +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 |
62 | 62 |
|
63 | 63 | ## Next steps
|
64 | 64 |
|
65 |
| -- [Run a set of prompts](/docs/intelligentapps/bulkrun.md) in an imported dataset, individually or in a full batch |
| 65 | +- [Run an evaluation job](/docs/intelligentapps/evaluation.md) for the popular evaluators |
66 | 66 | - [Run evaluation](/docs/intelligentapps/evaluation.md) job for the popular evaluators
|
0 commit comments