For example, a prompt definition used in the Directory Integration application effectively predicts the Contact Type of a directory record based on its Directory Name. The prompt definition has an input of DirectoryName, an output of ContactType, and includes the following prompt:
Does ${DirectoryName} resemble the name of a Person or an Organization? Respond with either Person or Organization.
When the prompt definition is run on a record with a Directory Name value of Wang, Evelyn, this value is dynamically inserted into the into the prompt sent to the LLM. Most likely, the response returned is "Person," and the Contact Type is set correctly.
In order to dynamically interpolate field values and attachments into your prompt, you must use merge text template syntax. Learn more in Dynamically include field values in prompt definitions.
Prompt definitions are created with the Prompt Definitions application and then used in logic blocks with the Call Model or Prompt action. Learn more in Models, Prompt Definitions application, and Run Model Definition action.
Process attachments with prompt definitions
You can also use a prompt definition to send an attachment, such as a PDF or an image, to an LLM for it to process. For example, you could create a prompt definition that summarizes key clauses of a contract, or that evaluates the condition of an item in a warehouse based on an image.
Use the ${AttachmentGroupID} syntax in your prompt to dynamically interpolate the attachment. These prompt definitions must run on records with only a single attachment.
PDF attachments are processed differently depending on the type of LLM you specify in your prompt definition. When you select a vision model, such as GPT 4.1 Vision, each page of the PDF file is sent to the LLM as an image for visual processing. When you select other models, such as GPT 4.1, the text of the PDF is scraped and sent to the LLM instead.
If you need to extract data from a PDF, you should consider the strengths and weaknesses of these different types of models. Models that scrape the text of the PDF are better at character recognition, but may not interpret the file correctly if the PDF has a complex layout. Vision models can successfully process PDFs with different layouts, as well as any graphs or images within them, but they may occasionally misinterpret different characters, such as 0s and Os. If the attached PDFs were created by scanning printed materials, you must use a vision model.
LLM considerations
Unlike the machine learning models created on the platform and trained on the business data in an environment, LLMs are already trained by external providers. These providers do not store any inputs, prompts, or outputs when a prompt definition runs. Data from the Nextworld Platform is never used to train external models.
The LLMs available to use in your prompt definitions are defined in the AI Model Version Setup application. You must obtain and register the appropriate API keys to use model definitions, and other Nextworld Intelligence features, in your environment. Learn more in Enable AI models in your environment.
Dynamically include field values in prompt definitions
Dynamically interpolate field values into your prompt definitions using syntax.
The format of the syntax is as follows:
${ payloadValuePath }
The payloadValuePath is a period-delimited name that references an input field, and is required for every input field you use in your prompt definition. The syntax is whitespace insensitive, so ${name} and ${ name } are treated the same by the LLM.
For example, to interpolate the value of the StorageTemperature field in your prompt, use the syntax ${StorageTemperature}.
You can also interpolate values of composite data items, table lookup fields, join table fields, and more:
- Composite data items—For example,
${MyCurrency:CurrencyCode}interpolates the currency code of the MyCurrency data item. - Table lookup fields—For example,
${MyCompany_CompanyName}interpolates the value of CompanyName related field on the MyCompany table. - Join table fields—For example,
${JoinTable$FieldName}interpolates the value of FieldName from the table JoinTable. - Attachments—The syntax
${AttachmentGroupID}interpolates an attachment from the record in your prompt, such as a PDF or image. PDFs are processed differently depending on the LLM you select. Learn more in Prompt definitions.