👋 Welcome!
Hello everyone and welcome to our second guide in the GenAI App Builder Getting Started Series! First things first, GenAI App Builder is now generally available for all customers to purchase or test in SnapLabs. If you are a customer or partner who wants access to SnapLabs, please reach out to your Customer Success Manager and they can grant you access. If you are not yet a customer, you can check out our GenAI App Builder videos then when you’re ready to take the next step, request a demo with our sales team!
🤔 What is GenAI App Builder?
If you’re coming here from Part 1, you may notice that GenAI Builder is now GenAI App Builder. Thank you to our customers who shared feedback on how we could improve the name to better align with the purpose. The original name had led to some confusion that its purpose was to train LLMs.
📑 Purchase Order Processing Example
In this example we will demonstrate how to use GenAI in a SnapLogic Pipeline to act like a function written in natural language to extract information from a PDF. The slide below shows an example of how we use natural language to extract the required fields in JSON format that would allow us to make this small pattern part of a larger app or data integration workflow.
Slide showing an example invoice on the left, the natural language used to extract the required fields, and the output in JSON. Also shown is an example of the SnapLogic Pipeline.
✅ Prerequisites
In order to following along with this guide, you will need the items below to complete this guide:
- Access to GenAI App Builder (in your company’s organization or in SnapLabs)
- Your own API account with access to Azure OpenAI, OpenAI, Amazon Bedrock Claude.
⬆️ Import the pipeline
At the bottom of this post you will find several files if you want to just use a pattern to see this in action in your own environment and explore it further. If you are familiar with SnapLogic and want to build the Pipeline on your own you can do that as well and just download the example PDF or try your own!
- PurchaseOrderExample.pdf
- InvoiceProcessing_CommunityArticlePipeline_2024_06_28.slp (zipped)
Once you are signed in to SnapLogic or SnapLabs you can start with the steps below to import the Pipeline:
- In Designer, click the icon shown in the screenshot below to import the Pipeline:
- Select the file in the File Browser window that pops up
- In the Add New Pipeline panel that opens you can change name and project location if desired
- Press the Save button in the lower-right corner
🚧 Parsing the file
If you imported the pipeline using the steps above, then your pipeline should look like the one below. The steps below assume you imported the pipeline. If you are familiar enough with SnapLogic to build this on your own you can drag the Snaps shown below to create the Pipeline then follow along with us.
🔈 NOTE: The instructions here are completed with the Amazon Bedrock Prompt Generator and the Anthropic Claude on AWS for the last two Snaps in the Pipeline. You can swap these out for Azure OpenAI or OpenAI Snaps if you prefer to use those LLMs.
- Click the File Reader Snap to open its settings
- Click the icon at the far right of the File field as shown in the screenshot below
- Click the Upload File button in the upper-right corner of the window that pops up
- Select the PDF file from your file browser (download the file “” at the bottom of this post if you have not already)
- Save and close the File Reader Snap once your file is selected
- No edits are needed for the PDF Parser Snap, so we'll skip over that one
- Click the Mapper Snap
- Add $text in the Expression field and $context in the Target path fields as shown below
- Save and close the Mapper Snap
- Click on the fourth Snap, the Prompt Generator Snap (we will demonstrate here with the Amazon Bedrock Prompt Generator Snap - you do not have to use Amazon Bedrock though, you can any of the other LLM Prompt Generators we have like Azure OpenAI, OpenAI, etc.)
- Click the Edit Prompt button as shown in the screenshot below so we can modify the prompt used for the LLM
- You should see a pre-generated prompted like the one below:
- Copy the prompt below and replace the default prompt:
Instruction:
Your task is to pull out the company name, the date created,
date shipped, invoice number, P.O. number,
vendor from vendor details, recipient name from recipient details,
subtotal, 'Shipping & handling', tax rate, sales tax, and
total from the context below.
Give the results back in JSON.
Context: {{context}}
- The Prompt Generator text should now look like the screenshot below:
- Click the Ok button in the lower-right corner to save our prompt changes
- Click on the last Snap, the Chat Completions Snap (we will demonstrate here with the Anthropic Claude on AWS Chat Completions Snap - you do not have to use Anthropic Claude on AWS though, you can any of the other LLM Chat Completions Snaps we have like Azure OpenAI, OpenAI, etc.)
- Click the Account tab
- Click Add Account; if you have an existing LLM account to use you can select that here and skip to step 22 below
- Select the type of account you want then press Continue - available options will depend on which LLM Chat Completions Snap you chose
- Enter in the required credentials for the LLM account you chose; here is an example of the Amazon Bedrock Account
- Press the Apply button when done entering the credentials
- Verify your account is now selected in the Account tab
- Click on the Settings
- Click on the Suggest icon to the right of the Model name field as shown in the screenshot below and select the model you want to use
- Type $prompt in the Prompt field as shown in the screenshot below:
- Expand the Model Parameters section by clicking on it (if you are using OpenAI or Azure OpenAI, you can leave Maximum Tokens blank; for Anthropic Claude on AWS you will need to increase Maximum Tokens from 200 to something higher; you can see where we set 50,000 below)
- Save and close the Chat Completions Snap
🎬 Testing our example
At this point we are ready to test our Pipeline and observe the results! The screenshot below shows you where you can click to Validate the Pipeline, which should have every Snap turn green with preview output as shown below. If you have any errors or questions, please reply to share them with us!
Here is the JSON output after the Anthropic Claude on AWS Chat Completions Snap (note that other LLMs will have different API output structures):
Extras!
Want to play with this further?
- Try adding a Copy Snap after the Mapper and sending the file to multiple LLMs at once then review the results.
- Try changing {{context}} in the Prompt Generator to something else so you can drop the Mapper from the pipeline
🏁 Wrapping up
Congratulations, you have now completed at least one GenAI App Builder integration in SnapLogic! 😎 Stay tuned to the SnapLabs channel here in the Integration Nation for more content on GenAI App Builder in the future! Please share any thoughts, comments, concerns, or feedback in a reply or DM @RogerSramkoski!