AIPLLM ConfigurationMar 2, 2026

Speedrun: Your First AIP Workflow

#AIP#workflow#speedrun#getting started#development
✦ AI SUMMARY

This document outlines a quick start guide for building your first workflow within Palantir's Artificial Intelligence Platform (AIP). It aims to accelerate the initial setup and development process for new users, providing a streamlined approach to getting a workflow operational.

Speedrun: Your First AIP Workflow

Course Introduction

In this course, you will build a fully functional, end-to-end workflow using AIP.

You will start off with a set of PDF documents provided in the curriculum

You will then build a data transformation to extract their contents and split them into short chunks of text. Going forward, we'll assume that each of these chunks contains a single point of information, which can be combined to answer related questions.

In this first section, you will also use an LLM to batch process these chunks and extract the most important entities they mention.

Your output datasets will then be added to the Ontology, Foundry's semantic layer which underpins the rapid development of a host of interactive applications.

With your Ontology Objects ready - Chunks and Entities - you'll get your first view of your knowledge graph. This graph allows you to understand the most significant entities covered by your documents, and investigate their relationships by reviewing mutually related text chunks. In fact, you will also configure your first AIP Agent to leverage this graph and respond to your questions reliably, without hallucinations.

Finally, you will build an interactive app to allow users to ask such questions and see the segment of your knowledge graph used to formulate the answers.

By the end of the Speedrun you will have experienced a large portion of the full-stack Foundry toolkit. You will be ready to take on the Deep Dive training courses or even dive into our documentation and get building your use-cases.

Training Application

Your organization's Foundry Platform Administrator may have posted local documentation within Foundry's Training application. This will typically cover any user restrictions that exist in your specific Foundry enrollment regarding creating projects, uploading data, creating or editing objects, or deploying Marketplace bundles. It may also include organization-specific training content.

You can open the Training app from the bottom of Foundry’s left navigation bar by selecting Support > Training.

Permissions

To complete this specific learning course, you will need access to the following platform components:

  • Pipeline Builder
  • Ontology Manager
  • Vertex
  • Logic
  • Workshop
  • AIP features

You will need the following permissions in order to run all steps of this learning course:

Permissions Required 

Workaround if permissions are not available

Create Learning Project 

Platform Admin team will need to create Learning Project for each user.

Upload Files

Platform Admin will need to Upload Files and provide instructions to copy them to the Learning Course Folder.

Create Ontology assets (Object Types, Links and Actions)

None. Permission needs to be granted.

Edit Learning Project

None. Permission needs to be granted.

Create Foundry Resources (Builder files, Vertex graphs, Workshop apps) 

None. Permission needs to be granted.

Use AIP Developer Capabilities (LLM block in Pipeline Builder, AIP Logic)

None. Permission needs to be granted.

Documentation

You can find out more about any of the Foundry applications or concepts presented in this course by searching in the Foundry documentation: https://www.palantir.com/docs/foundry

The Use Case

For the purpose of this course, you work for a charity focusing on expanding access to medication in underdeveloped regions. You just joined a new team focusing on Tuberculosis, one of history's most devastating diseases. Onboarding to the team went smoothly and you are excited for the work. Unfortunately, there's a daunting library of studies detailing the latest advances in fighting this disease.

It would take months to read through this material, so you decide to leverage your team's access to AIP and build an Foundry workflow to get answers to your most important questions based on the knowledge library at hand. In preparation for the work you drew the following architecture graph.

Solve Operational Problems

  • Interactive Workshop App - Allow users to ask questions and inspect the data underpinning the answers.
  • Knowledge Graph in Vertex - Discover the relationship between the most important concepts via connections in your source truth.
  • AIP Agent in Logic - Outsource literature search to an AI agent for improved efficiency.

Create the API of Your Organization

  • Semantic Layer in the Ontology - Abstract away and hide the data engineering from non-technical operators.

Leverage Your Data Asset

  • Data Transformation in Pipeline Builder - Supercharge your data engineering speed by combining the hundreds of optimized, common data operations.

Setting Up Your Project and Folder

Introduction

All of the resources you create in Foundry need to live inside a Project. For production use cases, these resources likely need to be shared across your organization and it is recommended you create a Project for each stage of the workflow, as noted in our online documentation. 

Uploading the Data

In this section you will set up a Project, where you'll develop your workstream. You will also populate it with your unstructured input data, stored in a Media Set.

Upload Data

Step 1: Start file upload

  1. Click on New in your course folder, inside your personal Learning Project
  2. Click on Upload files...

Transforming the Data

Introduction

In this section, you will process the previously uploaded PDFs to break them down into short chunks of text. You will also leverage an LLM to summarize these chunks and extract the most important entities they mention.

Create a New Pipeline

Step 1: Start pipeline creation

Step 2: Finish pipeline creation

  1. Name your new pipeline "Document Processing Transform"
  2. Select the pipeline style as Batch pipeline
  3. Click on Create pipeline

Add Data

Step 1: Open the "Add data" window

  1. Click on Add Foundry data
    • You can find this Add Data dialog in the top left of the Pipeline Builder screen if you want to add more data later. It might be particularly useful for setting up mock datasets (or configuration datasets) using the Manually Enter Data option.

Step 2: Select and add data

  1. Add the Articles media set to your selection using the button
  2. Click Add data in the bottom right to confirm selection

Process PDFs

Step 1: Start new transformation

  1. Back on the main Pipeline Builder graph, select the new Articles transform node
  2. Click the Transform button
    • This will create a transform Node, where transformation steps can be chained and a resulting dataset can be visualized

Step 2: Rename transform

  1. Rename the new transform node to "Process PDFs" in the top left corner

Step 3: Add first transform block

Step 4: Add second transform block

For each row, the "Explode Array with Position" transform block takes the input array and creates a new row for each element of the array. Each new row is identical to the original, except the output column ("content" in the case above), which contains the corresponding element of the input array and its index in a struct.

Step 5: Add third transform block

Step 6: Add fourth transform block

Takeaways

The text you extracted from the PDF files is simpler to interact with than the raw files you've uploaded. This makes it possible to easily run data transformations and AIP interactions on it.

Extract Chunks

Step 1: Start new transformation

  1. Rename the new transform node to "Extract Chunks" in the top left

Step 2: Add first transform block

  1. Search for and add a Chunk string transform block
  2. Set the content column as the input expression
  3. Set Chunk size to 512
    • Smaller values lead to more specific information in the chunks but much longer execution time. 512 strikes a nice balance in this use-case.
  4. Set the output column name to "content," which will replace the existing column 
  5. Click Apply

The "Chunk String" transform block splits a string into similar length segments, possibly with overlapping. It's particularly useful when trying to create small blocks of text, each of which contains a single argument without accidentally chopping off too much related content (hence the overlap).

Step 3: Add second transform block

Step 4: Add third transform block

Takeaways

Chunking the text creates segments short enough that you can assume they contain single bits of information. By filtering these chunks, you can find all information contained in your data asset related to a particular topic. This filtered collection will be used to constrain LLMs to answer your questions using only real information.

Create Chunk ID

Step 1: Start new transformation

  1. Select the Extract Chunks transform node
  2. Click the Transform button
  3. Rename the new transform node to "Create Chunk ID" in the top left

Step 2: Add transform block

  1. Search for and add a Concatenate strings transform block
  2. Set the separator as an underscore "_"
  3. Set the first element in the concatenation to be the media_Item_Rid column
  4. Set the second element in the concatenation to be a Cast expression with type String applied to the pageNumber column
  5. Click in Add item
  6. Set the third element in the concatenation to be a Cast expression with type String applied to the chunkNumber column
  7. Name the new column "chunkId"
  8. Click Apply

Takeaways

ChunkId will be used as the primary key to uniquely reference the Chunk objects that you will create in the Ontology later on. It is very important to design a primary key that is unique (and not null) when planning the architecture of your application. When possible, you should use a combination of other columns rather than a randomly generated or hashed code. This makes it easier to debug any potential duplication

Use LLM

Step 1: Start an LLM call

  1. Select the Create Chunk ID transform node
  2. Click the Use LLM button

Note: If you do not see the 'Use LLM' option in your Foundry instance, you may not have access to AIP features. Contact your organization's Foundry administrator or your Palantir representative for assistance. 

Step 2: Choose prompt type

  1. Click on Empty prompt

Step 3: Configure LLM call

  1. Keep the default name "Use LLM"
  2. Add the following prompt to the instructions field:

Your task is to summarize a short text snippet from a scientific article, and extract a list of entities mentioned.

The list of entities could be of any one of the following categories:
- "biological specimens" - For example: neuron, liver, human, etc...
- "harmful agents" - For example: e coli, coronavirus, alcohol, etc...
- "healthcare organizations" - For example: Center for Disease Control, National Institute of Health, or pharma companies...
- "treatments" - For example: paracetamol, penicillin, etc...
- "symptoms" - For example: cough, fever, nausea, etc ...
Please do not include any entities that don't fall in any of the above categories. If the text contains no relevant entities, return an empty list.

Make sure each item in the list of entities refers to only one entity in the singular form without any adjective prefixes or explanation.
So I expect the entity to be "T Cell" instead of "inactive T Cells and B Cells".

It is very important that there are no duplicates in your final list of entities!

  1. Type forward-slash "/" in the input data field and pick the content column
  2. Set the output type to be a struct with one string property called "summary" and one array of strings called "entities"
  3. Rename the output to "response"

Step 4: Select rows for a trial run

  1. Click on Input table in the bottom left corner
  2. Select a couple of rows by dragging your cursor over the row numbers
  3. Click Use rows for trial run

Sometimes the LLM may return duplicates in the entities array. If this happens add a deduplication step to make sure the entities are unique.

Step 4: Select rows for a trial run

  1. Click on Input table in the bottom left corner
  2. Select a couple of rows by dragging your cursor over the row numbers
  3. Click Use rows for trial run

Step 5: Start a trial run

  1. Click Run in the top right corner.
  2. Check the example results
  3. If you are unhappy with the response, feel free to modify the prompt

Step 6: Finish configuring LLM call

  1. Click Apply
  2. Click Close

Takeaways

Pipeline Builder takes your prompt template, resolves the placeholders (adds the actual text from the content column in this case), and sends it to AIP for each row of input. Under the hood, it takes care of optimizing performance by issuing parallel calls, while respecting the various models' rate limits.

Embedding

Step 1: Start new transformation

Select the Use LLM transform node

Click the Transform button

Rename the transform node to "Embed Chunks" in the top left

Step 2: Add first transform block

  1. Search for and add a Get struct field transform block
  2. Set the response column as the struct to process
  3. Set summary as the property to extract into a new column called "summary"
  4. Click Apply

Step 3: Add second transform block

  1. Search for and add the Text to embeddings transform block
  2. Set summary as the column to embed
  3. Next to Model type, click on Select a model
  4. Select one of the recommended models
    • In this example, we use text-embedding-ada-002

The "Text to Embedding" transform block creates a vector representation of the subject of the input. When compared to other rows, the strings with embeddings nearest each-other will contain similar topics. (In a simplified case, "hot" might be embedded as [0.8], "cold" as [0.2], and "freezing" as [0.1]. "Cold" and "freezing" are similar, therefore their embeddings are near too.)

Step 4: Add third transform block

  1. Search for and add the Drop columns transform block
  2. Select response as the column to drop
  3. Click Apply

Takeaways

Embedding represents text as a point in a high dimensional space, such that similar concepts end up near each-other. This property can be used to carry out semantic search. Specifically, it allows you to find text chunks that cover similar topics to your question, which can the be used to formulate an answer.

Add Output for Chunks

Step 1: Create new output dataset

  1. Select the Embed Chunks transform node
  2. Click the Add output button

Step 2: Rename output dataset

  1. Rename the output dataset to "Chunks" in the configuration panel on the right

The output configuration tab also allows you to set data expectations, such as "no nulls allowed", "column value must be between N and K", or "column values must be unique". These allow you to uphold high data quality and build robust, production pipelines.

Get Entities

Step 1: Start new transformation

  1. Select the Use LLM transform node again
  2. Click the Transform button to start a second transform path from the node 
  3. Rename the transform node to "Get Entities" in the top left

Step 2: Add first transform block

  1. Search for and add a Get struct field transform block
  2. Set the response column as the struct to process
  3. Set entities as the property to extract into a new column called "entities"
  4. Click Apply


Step 3: Add second transform block

  1. Search for and add an Explode array transform block
  2. Set the entities column as the array to explode

  1. Set the output column name to "entityName"
  2. Click Apply

Resolve Entities

Step 1: Start new transformation

  1. Select the Get Entities transform node
  2. Click the Transform button
  3. Rename the transform node to "Deduplicate Entities" in the top left

Step 2: Add first transform block

  1. Search for and add a Select columns transform block
  2. Select the entityName column to keep
  3. Click Apply

Step 3: Add second transform block

  1. Search for and add a Drop duplicates transform block
  2. Select entityName to be the basis of de-duplication
  3. Click Apply

Takeaways

The entities extracted from the document chunks allow you to discover and understand relationships between the most significant concepts in your data asset.

Add Output for Entities

Step 1: Create new output dataset

  1. Select the Deduplicate Entities transform node
  2. Click the Add output button

Step 2: Rename output dataset

  1. Rename the output dataset to "Entities" in the configuration panel on the right

Define Join Table

Step 1: Start new transformation

The relationship between Chunks and Entities is many-to-many. That is, one Chunk can contain many Entities, and an Entity can be present in many Chunks. To map this relationship, a column is not enough; we need a join table.

  1. Select the Get Entities transform node
  2. Click the Transform button
  3. Rename the transform node to "Get Join Table" in the top left

Step 2: Add transform block

  1. Search for and add a Select columns transform block
  2. Select the entityName and chunkId columns to keep
  3. Click Apply

Add Output for the Join Table

Step 1: Create new output dataset

  1. Select the Layout nodes button in the top left to automatically clean-up your graph
  2. Select the Get Join Table transform node
  3. Click the Add output button
  4. Click the New dataset button

Step 2: Rename output dataset

  1. Rename the output dataset to "Join Table" in the configuration panel on the right

Takeaways

A single chunk might mention multiple entities, and a single entity might be mentioned in multiple chunks. Therefore, this connection cannot be described using simple primary and foreign key columns on the source datasets. Instead, we create a list of all chunk-entity pairs, called a join table.

Deploy Pipeline

  1. Click Save in the top right corner
  2. Click Deploy in the top right corner
  3. In Select outputs to build, make sure all datasets are selected
  4. Click Deploy pipeline in the bottom right corner

In case you get a warning about resources

  1. Click Import resources in the warning pop-up

  1. Click Add references in the import pop-up

  1. You may need to click Deploy pipeline once more 

In case you get a "All outputs that share a cached LLM upstream must be placed in the same non-default job grouping" error

You need to add the outputs of the pipeline to the same job grouping. Follow the steps below to do this:

  1. Click Deploy Settings next to the Errors tab
  2. Click Configure
  3. Mouse over the Chunks output under Single jobs to reveal the Move to group... button and then click it
  4. Click New Group, this will move the Chunks output to a custom job grouping called Group 1
  5. Repeat this process for the Entities and Join Table outputs, however, instead of adding them to a new group, add them to Group 1
  6. After all the outputs have been added to Group 1, click Apply in the top right of the panel and then Save
  7. You should now be able to Deploy pipeline successfully

Summary

You now have a data transformation taking PDF documents as an input and turning them into chunks, which represent nuggets of information. You are also extracting the most significant entities from these chunks which will allow you to discover relationships between chunks in later steps.

For now, you should take a look at your build's progress:

  1. Click on the Deploy Pipeline icon in the right-side bar
  2. Click View deployment history in the right panel that opened up
  3. Click Build report in the row corresponding to the current build
  4. Your datasets should build in a little over 5 minutes.

Pipeline Builder is Foundry's no-code solution for authoring data transformations. It comes with hundreds of optimized data operations out of the box, as well as support for core software engineering concepts such as version control, scheduling, and incremental execution. It is well suited for the majority of data-pipeline building tasks, and provides a boilerplate free entry point when rapid development is priority over complex technical configuration.

To learn more about Pipeline Builder you might follow this course up with the Pipeline Deep Dive course, or by taking a look at the documentation.

Foundry also provides a high-code transform authoring environment called Code Repositories. It allows you to leverage the fine controls of python and java to create performant transforms, and rely on popular libraries for specialized functionality.

To learn more about Transform authoring in Code Repositories, take a look at the documentation.

Configuring the Ontology

Introduction

An Ontology directly describes your data, representing your data assets as well as their relationships. It allows you to define the ways in which operational users can view and interact with your data assets. 

In this section you will create Ontology objects, backed by the chunks and entities datasets created in the previous step. These will underpin all interactive, user-facing features that you'll implement in the following sections

To get started, please open the Ontology Manager app.

Create the Chunk Object Type

Step 1: Create new object type

  1. Click New in the top right corner
  2. Select Object type from the dropdown

The following steps are only relevant for users where the 'New' button is not selectable. Proceed to Step 2 below if you are able to select the 'New' button. 

Note that some Organizations limit edits to the production Ontology via Ontology Proposals. If the 'New' button in the screenshot above is not clickable, you may need to create a custom branch of the Ontology for the following steps and seek approval from your Organization's Administrator for merging in the changes to the Main branch of the Ontology.

If you can not directly edit the Main Ontology, you can continue by creating a custom branch of the Ontology with the steps below. At the end of the 'Configuring the Ontology' module, you will need to seek approval for merging in your changes to the Main Ontology before continuing. Further instructions for this can be found in the Foundry documentation. 

  1. Click the Main button in the top right of your screen next to the New button 

  1. Type the name for your custom branch "<your_username>/e2eaipspeedrun"
  2. Click the grey arrow to create the branch with that name 
  3. Click Create branch

  1. If you have the Enable indexing on this branch toggle available on your Foundry instance, select the toggle on and proceed to the next steps.
  2. If you do not have the toggle available, you will need to have your branch merged into the Main Ontology branch in order to proceed with the following steps. Contact your organization's Foundry Platform Administrator or Palantir representative for assistance. 
  3. Click Create branch

Step 2: Select backing datasource

  1. In the Create a new object type window, under Datasource, select Use existing datasource
  2. Click on the button Select datasource
  3. Search and select your Chunks dataset within your training project and folder


. Step 3: Define metadata

  1. Name your Object as "(<username>) Chunk", where <username> is your username. The plural name should auto-populate.
  2. Select an icon that you think helps describe the Chunk object
  3. Click Next  

Step 4: Create object properties

  1. Select Chunk Id as the Primary key of the new Object; this serves as each Object's unique identifier 
  2. Select Summary as the Title of the new Object; this serves as the name of the Object that will be displayed across the platform
  3. Click Next

Don't worry if there is a warning next to Embedding, as shown in the screenshot above. This is just to let you know that it is an advanced type and you may need to edit the configuration of this property later. For this course, the default settings are sufficient for what we need. 

Step 5: Generate action types

The Actions tab allows you to automatically create common Actions that can be taken upon the new Object Type and select what users are allowed to make these Actions. You can also make these Actions or others manually through Ontology Manager after creating an Object Type. 

  1. Click Create on the bottom right corner to create your Object Type 

Step 6: Edit the Media Reference property

You'll now edit some of the properties of the Object to allow them to be properly used in the Ontology. 

  1. Select the Media Reference property from the list
  2. Change the Base type to Media Reference in the right panel
  3. On the Select media source window, select Media Set
  4. Then click in Select existing
  5. Navigate and select the Articles media set imported at the beginning of this exercise.
  6. Click Select
  7. Click Set as media reference property

Step 7: Save object type

Your Object is now created, but needs to be saved to the Ontology

  1. Click Save in the top right of the screen 
  2. On the following pop-up window, click Save to Ontology
    • Object index will start after changes are saved to the ontology, which can take a few minutes

Create the Entity Object Type

Step 1: Create new object type

  1. Click New in the top right corner
  2. Select Object type from the dropdown

Step 2: Select backing datasource

  1. In the Create a new object type window, in the Datasource step, pick Use existing datasource
  2. Click on Select datasource

 

  1. Search and select your Entities dataset within your training project and folder


Step 3: Set object metadata

  1. Name your Object as "(<username>) Entity", where <username> is your username. The plural name should auto-populate.
  2. Select an icon that you think helps describe the Entity object
  3. Click Next  

Step 4: Create object properties

  1. Select Entity Name as both the Primary key and the Title
  2. Click Next

Step 5: Generate action types

  1. Select Create and Delete Action Types
    • You are unable to select Modify as the only field is also the Primary Key which can not be modified via an Action 
  2. Select only your own user to be able to execute the Action types 
  3. Click Create to create your Object Type 

Step 6: Save object to ontology

Your Object is now created, but needs to be saved to the Ontology

  1. Click Save in the top right of the screen 
  2. On the following window, click Save to ontology

Configure the Object Relation

Step 1: Create new link type

In order to establish the link between Chunks and Entities, we can use the join table we created in Pipeline Builder.

  1. On the Overview page of the new Entity object type, scroll down to Link types
  2. Click Create new link type
    • Alternatively, you can click New in the top right corner and select Object Relation

Step 2: Select link relationship type

  1. Select the Join table dataset as the relationship type
  2. Click Next

Step 3: Link objects

  1. Select (<username>) Chunk as the other end of the relation.
  2. In the Select join table dataset section, click Select join table
  3. Navigate to the Join Table in your Project and select it
  4. Pick entityName as the primary key column for the Entity end of the relation
  5. Pick chunkId as the primary key column for the Chunk end of the relation
  6. Click Next

Step 4: Set link type name

  1. Here you will see an overview of the link you have created. The API Name should be auto-generated

Step 5: Save link type to ontology

Your Object Relation is now created, but needs to be saved to the Ontology

  1. Click Save in the top right of the screen 
  2. On the following window, click Save to ontology

Summary

Your Ontology now describes two Object Types - Chunks and Entities. These represent major, high-quality, data assets in your organization as well as their relations. In a way, this setup acts like an API for your app builders and business users who no longer need to re-derive data features, nor understand the potential complexities of data engineering pipelines. You are ready to start building interactive features on top of your existing groundwork.

Beyond just being an indexed data-store and knowledge graph, the Ontology also allows you to define (and restrict) the ways in which operational users can update your data assets. Once such Actions are configured, app builders only need to curate the various Object views and interactive capabilities, speeding up their development process. Furthermore, the Ontology is shared across your organization, allowing you to benefit from Object Types and Actions already configured by your colleagues.

To learn more about Ontology building, you might follow this course up with the Ontology Deep Dive, or by taking a look at the documentation.

Exploring Object Relations

Introduction

In this section you will visualise the relationship between the Chunks and Entities derived from your documents. This will allow you to identify which entities connect different chunks of text.

For this task you will use Vertex, Foundry's graph and simulation tool.

Create a Vertex Graph

  1. Navigate to your training folder inside your learning project
  2. Click New in the top right corner
    • Alternatively, you can right-click in your folder and pick New
  3. Select Vertex graph from the dropdown

Visualize Object Relations

Step 1: Add objects to the graph

  1. Rename the Graph as Knowledge Graph
  2. Click Add object in the top left corner
  3. Search for your object types by typing your <username> in the search box
  4. Select your Chunk object from the list on the left
  5. Select a dozen objects from the list on the right
    1. You can do this by holding down shift and clicking on multiple rows
  6. Click Add selected
  7. Click anywhere in the graph to drop the Chunk objects

Step 2: Add links to the graph

  1. Select all objects on the Vertex canvas
    • You can either press Ctrl + A or press the Select all button
  2. Click on the Search Around button in the toolbar on the top
  3. Click on the relationship to the Entity object
  4. The Ontology indexes both objects and relations, making it easy to find related concepts instantly.

Step 3: Layout nodes in the graph

  1. Once again, select all objects on the canvas
  2. Click on the Layout button in the toolbar on the top
  3. Click on Radial in the dropdown

Configure a Vertex Template

Step 1: Start template creation

  1. Click on the dropdown next to the Save button and select Save as template...

Vertex templates allow you to procedurally recreate Object relationship graphs, enabling context-relevant displays.

Step 2: Configure parameters

  1. Click Add parameter in the Object parameters section
  2. Select your Chunk object type
  3. Click Continue

Step 3: Configure search arounds

  1. Click Add Search Around below your Chunks object
  2. Select the relationship to your Entity object
  3. Click Continue

Step 4: Configure layers

  1. Click Continue
    • This summarises any style changes made to the nodes and edges; they are fine as they are

Step 5: Configure graph

  1. Name your Vertex template Knowledge Graph Template
  2. Set the layout to Radial and leave the default configuration as it is
  3. Click Continue

Step 6: Finish and save template

  1. Click View summary
  2. Click Save template

3 Pick your training folder, on your learning Project, as the save location

  1. Click Save

Summary

You now have a reusable template to display subsets of your Knowledge Graph. This will be used in the last section of this course to visualise the knowledge AIP is using to answer your questions.

 

Beyond being a tool to visualise Ontology Objects and their Links, Vertex also allows you to model complex systems. You can chain statistical or machine learning models to simulate how changes to one Object might affect properties of others.

To learn more about Vertex and its advanced modelling capabilities, please take a look at the documentation.

Creating an AIP Logic Function

Introduction

In this section you will develop an interactive AIP function to answer questions based on the knowledge base you created earlier. Leveraging the Ontology in such a way enables you to deliver solutions specific to your work without having to retrain LLMs or worry about hallucinations.

Create a Logic Function

Step 1: Create AIP Logic function

  1. Navigate to your training folder
  2. Click New in the top right corner
    • Alternatively, you can right-click in your folder and pick New
  3. Select AIP Logic from the dropdown

Step 2: Name and save your function

  1. Rename your Logic function "Ontology Augmented Generation"
  2. Ensure you are saving to your training folder
  3. Click Save

Compose Your Function

Step 1: Add inputs

  1. Click Add function inputs
  2. Name the new input "userQuestion"
  3. Select String as its type

Step 2: Add semantic search block

  1.  Click the magnifying glass icon to add a Semantic search function block
  2. Click on the Object set dropdown
  3. Select Create new object set and then your Chunk object type
  4. Select Embedding as the Property to search
  5. Set the Number of returned objects to 10
  6. Set the userQuestion variable as the Query
    • A new variable Searched All (<username>) Chunks will be created by this block

Step 3: Add LLM block

  1. Click the AIP icon to insert a Use LLM function block

  1. Add the following prompt in the Instructions (System prompt) field

Your task is to answer the user's question using only the reference text provided. If the references don't allow you to answer the question, say so.
It is very important that you don't use any prior knowledge, and only rely on the references provided.

  1. Add the below prompt in the Provide input data (Task prompt) field

Please answer the following question: [ user question ]

To compose your response, you may only depend on the following information:
[ semantic search ]

  1. Replace "[ user question ]" with the corresponding variable
    1. Type "/" (forward slash)
    2. Select userQuestion in the variable picker
  2. Replace "[ semantic search ]" with the corresponding variable
    1. Type "/" (forward slash)
    2. Select Searched All (<username>) Chunks in the variable picker
    3. Select Content in the property picker
    4. Click Add 1 property
      • A new variable Searched All (<username>) Chunks - formatted will be created and added to the Task prompt
  3. Change the Prompting strategy to Single completion

 

When writing prompts for AIP, it might help to imagine that the prompt is a message to the newest member on your team. It will only be able to provide reliable responses if the task you give is clearly described without the use of any jargon, and if it has access to all the data required to solve your problem.

Step 4: Set function output

  1. Check that the output variable is set to Use LLM

Test Your Function

  1. Click on the play button in the top right corner

  1. For the userQuestion input, enter a test question such as:
    • What is the recommended treatment for Tuberculosis?
    • How common is Tuberculosis these days?
  2. Click the blue Preview run button at the bottom of the drawer
    • Alternatively, you can click Ctrl + Shift + D

  1. Verify that the Result returned makes sense
  2. (Optional) Modify your LLM prompt to change the output format (eg: length, language, style...)

Takeaway

Testing is essential for developing reliable AIP applications. This becomes increasingly important when working on complex applications using the Chain of Thought execution mode. In this mode, your function has access to various tools, such as running simulations and querying and editing the Ontology. Then AIP decides which tools, or sequence of tools, to use in completing the task. The Debugger tab in Logic allows you to review the decision-making process of your function.

Takeaway

Testing is essential for developing reliable AIP applications. This becomes increasingly important when working on complex applications using the Chain of Thought execution mode. In this mode, your function has access to various tools, such as running simulations and querying and editing the Ontology. Then AIP decides which tools, or sequence of tools, to use in completing the task. The Debugger tab in Logic allows you to review the decision-making process of your function.

Summary

You now have a basic, AIP powered function which can be used to answer your questions based on the Ontology, your organizations knowledge graph. All you have left to release this tool to your team is to construct a user interface.

AIP Logic starts to truly shine as you start building on top of its Chain of Thought execution mode. This way, AIP becomes a true agent, working alongside you. It leverages its decision making ability to query data and pick and use tools made available to it via the Ontology. This allows it to tackle even tasks it was never specifically programmed to perform. At the same time, you didn't have to write a single line of boilerplate code!

If you're interested in learning more about this technology, you can review our documentation. Additionally, Palantir's YouTube channel is continuously updated with demos of AIP across many applications and industries. 

Building an App

Introduction

In this final section, you will create an interactive application which ties all your previous work together. This app will allow you to query your documents in natural language and receive trustworthy responses.

Create a Workshop App

  1. Navigate to your training project
  2. Right-click in your Project and pick New
    • Alternatively, you can click New in the top right corner
  3. Select Workshop module from the dropdown

Organize the Layout

  1. Name the app as "Ontology Augmented Generation App" on the top left corner
  2. In the left side navigation bar, click on the Layout icon (the stacked squares) 
  3. Click on the Page layer
    • Not to be confused with the Page (Default) page identifier
  4. In the right side configuration panel, under Layout, set padding to Regular
  5. Change Layout direction to Rows

A Workshop app is organized as a tree of nested Sections and Widgets, which you can see on the left hand panel in the Layout tab. Each Section and Widget comes with configuration options to refine their functionality and appearance.

Get User Input

Step 1: Create new section

  1. Click on the top Section to select it
  2. In the top toolbar, click on the Above button to insert a new section above the one selected

Step 2: Add a text input widget

  1. Click on the Add Widget button in the newly created section
  2. Search for the Text input widget
  3. Click on the Text input widget to add it to the app

Step 3: Configure the text input widget

  1. Click on the newly inserted text input widget
  2. Click on the widget variable (under string value) in the configuration panel on the right
  3. Rename the variable to "User Question"

Each widget acts like a function, taking existing variables as input. Widgets also produce side-effects and populate output variables based on user interactions.

Display Objects

Step 1: Set section layout

  1. Select the Section below the text input widget
  2. Click Set layout and select Columns
  3. In the configuration panel on the right, toggle-off the Section Header
  4. Set Row height to Flex

Step 2: Add object list widget

  1. Click the new section on the left
  2. Click Add widget
  3. Click on the Object Set input dropdown
  4. Click New object set variable

Step 3: Setup object list input

  1. Rename the new object set variable to "Relevant Chunks"
  2. Select your Chunk object as the Starting object set
  3. Click on Filter... On a property
  4. Select the Embedding property
  5. Set the User Question variable as the Query
  6. Set the K value to "10"

The string variable passed to "Query" gets embedded with the same algorithm that you used for processing the text chunks. This embedding step represents it as a coordinate in such a way that text chunks with nearby embeddings are of a similar content. Using the Ontology, you can quickly retrieve the semantically most similar Object Types.

Display Object Relations

  1. Select the new Section on the right
  2. Click Add widget
  3. Search for and insert a Vertex Graph widget
  4. Select the newly created Vertex Graph Widget
  5. In the widget configuration drawer, under Input, select Static and press Select
  6. Search for and select your Knowledge Graph Template as the backing resource for the graph
  7. Select the Relevant Chunks object set variable as the template input

Display AIP Response

Step 1: Set section layout

  1. Select the last empty Section at the bottom of the app
  2. Toggle-off the Section Header in the configuration panel on the right
  3. Set Row height to Auto (max)

Step 2: Add Markdown widget

  1. Click Add widget
  2. Search for and insert a Markdown widget
  3. Change the Input data to be based on a Variable
  4. Click on the input variable dropdown
  5. Select New string variable
  6. Select Function

Step 3: Setup your function call variable

  1. Rename the new object set variable to "AIP Response"
  2. Click on the Function dropdown and pick your Logic Function
    • This will be your Ontology Augmented Generation function
  3. Set the User Question variable as your Function input

You will see an error at the bottom of the screen, this is expected. Once you input a user question this will disappear

Step 4: Save your workshop app

  1. Click Save and publish in the top right corner
  2. Click View in the top right corner
    • You've now connected all the components we've worked on throughout this course! 

Step 4: Save your workshop app

  1. Click Save and publish in the top right corner
  2. Click View in the top right corner
    • You've now connected all the components we've worked on throughout this course! 

Conclusion

Well done! You have built an interactive app from scratch using Foundry and AIP. It allows you to ask a question about the topic focus of your team, Tuberculosis. Your AIP Logic function then finds all the relevant information from your knowledge base and compiles it into an answer rooted in trusted data. This subset of your Knowledge Graph is also displayed to you and other users in your new Workshop app to further inspect.

Your task is complete - you no longer need to sort through endless pages to discover the answers to your questions and discover the most important concepts in the research literature. Try out the capabilities of your new tool using some of the questions below for inspiration.

    • What are the biggest challenges in treating and preventing Tuberculosis?
    • What is the global impact of Tuberculosis?
    • Why is multidrug-resistant Tuberculosis a concern?

 

Note that this brief final section of the training material does no justice to the Workshop application in Foundry. Workshop allows you to tie your resources built with other Foundry applications together and expose them as a coherent workflow. On top of it, it allows you to curate and expose opportunities for users to write back their decisions to your data asset, truly making your work operational.

Looking to continue learning?

Explore the AI Engineer Training Track for more courses and resources related to this course.