Prompt engineering in AI Toolkit
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.
Create, edit, and test prompts
To access the prompt builder, use either of these options:
- In the AI Toolkit view, select Prompt Builder
- Select Try in Prompt Builder from a model card in the model catalog
To test a prompt in the prompt builder, follow these steps:
-
In Models, select a model from the dropdown list, or select Browse models to add another model from the model catalog.
-
Enter a User prompt and optionally enter a System prompt.
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.
TipIf 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.
-
Select Run to send the prompts to the selected model.
-
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.
-
Repeat the previous steps to iterate over your prompts by observing the model response and making changes to the prompts.
Structured output
Structured output support helps you design prompts to deliver outputs in a structured, predictable format.
To test a prompt in the prompt builder, follow these steps:
-
Select the Format dropdown in the Response area, and select json_schema.
-
Select Prepare schema, and then select Select local file to use your own schema, or select Use an example to use a predefined schema.
If you proceed with an example, you can select a schema from the dropdown list.
-
Select Run to send the prompts to the selected model.
-
You can also edit the schema by selecting Edit.
Integrate prompt engineering into your application
After experimenting with models and prompts, you can get into coding right away with the automatically generated Python code.
To view the Python code, follow these steps:
-
Select View Code.
-
For models hosted on GitHub, select the inference SDK you want to use.
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 or the SDK from the model provider, such as OpenAI SDK or Mistral API.
-
The generated code snippet is shown in a new editor, where you can copy it into your application.
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 (PAT) in your GitHub settings.
Next steps
- Run an evaluation job for the popular evaluators