This guide demonstrates how to access AIP Logic, introduces the AIP Logic interface, and describes how to set up a basic Logic function by composing LLM blocks and examining the LLM’s chain of thought (CoT) in the Debugger.
AIP Logic can be accessed from the platform’s workspace navigation bar or by using the quick search shortcuts CMD + J
(macOS) or CTRL + J
(Windows). Alternatively, you can create a new Logic function from your Files by selecting +New and then selecting AIP Logic, as shown below.
After opening AIP Logic, you can create a new Logic file. Note that Logic files must be saved in a project folder, not in your home folder.
There are three main components of AIP Logic’s interface, numbered left-to-right in the notional screenshot below:
In a typical AIP Logic workflow, you might begin by configuring the input (A), blocks (B), and outputs (C) on the left panel (1), then using the Run panel (3) to generate a sample output. After running your Logic, you will be able to see the LLM’s chain-of-thought (CoT) prompting in the Debugger (2) and the steps the LLM took to produce the output. You can also visualize your final output in the Debugger in combination with the Run panel. The Run panel enables you to see the most recent Logic runs and create unit tests. On the right-hand sidebar, you can find more functionality, such as integration of Logic with the Automate application.
When you first begin using AIP, you will see the Run panel on the right and three types of boards on the left: inputs, for optionally choosing an object and its properties, blocks for defining your Logic instructions, and outputs that represent the desired Logic function results. The output from one block can be fed into subsequent blocks.
The screenshot below shows the configuration area for inputs, blocks, and outputs with the Run panel collapsed.
AIP Logic takes a variety of inputs: these can be either primitives or object types in the Ontology. In the Inputs block (labeled as "A" in the application interface guide), you can specify the input name, type (whether the input is a primitive or an object), and the primitive type or object type. Supported primitives include array, boolean, date, double, float, integer, long, short, string, and timestamp.
An AIP Logic function is composed of blocks (labeled as "B" in the application interface guide), which represent ways that an LLM can interact with your data. You can choose between four types of AIP Logic blocks: create variable, get object property, use LLM, and transform block. The output of a block can be used in subsequent blocks. The three types of blocks are further detailed in individual sections below.
The Create variable block creates a variable that can be used in future blocks. The variable can be of the following types: array, boolean, date, double, integer, long, string, or timestamp.
The Get object property block returns properties from an object. When an input object is selected, you can choose a property from the object.
The Use LLM block is the heart of AIP Logic and enables you to leverage LLMs to define a Logic block. Logic blocks are composed of a prompt, tools, and an output.
The Transform block allows you to use expressions within AIP Logic.
This is a great way to perform transformations on your data with AIP Logic such as convert a string to a date, parse JSON, perform mathematical expressions, and more.
The Apply Action block allows you to deterministically call actions without having to go via an LLM block. This block gives you precise control over how parameters are filled out and speeds up the execution. In this example, we can call an action that attributes a priority status to a given incident.
Calling an AIP Logic function from an Action is required for edits to be written back to the Ontology. The Ontology will not be edited unless the Logic function is executed from an Action, even if the function contains an Apply Action block.
You can use functions deterministically in AIP Logic. The Execute block is useful in loading specific data to pass to an LLM block as well as in complementing the Transforms block when desired expressions are not available. In this example, the Execute block is used to leverage the output from a semantic search function to help return the resolution text from similar incidents.
Prompts are instructions for an LLM, written in natural language. We recommend starting with the most important information (such as an overview of the task the LLM should complete), followed by the data the LLM will need and guidance on when to use the tools. When composing a prompt, keep in mind that an LLM only has access to what you specifically provide.
In the following notional prompt, we use the LLM to search for information from previous email conversations to provide a response to a customer seeking a solution. The notional prompt begins with the overview of the task:
You are my complaint helper agent. Find other emails that describe similar events to those described in the input email. Look only at the email body. Determine the best solution based on what has worked in the past. Return your one solution recommendation, do not list findings from every email.
Then, the prompt specifies the data to query (in this case, the complaints emails, represented as complaint
objects). After entering the prompt, you can provide the LLM access to your inputs by typing “/“ and selecting one or more variables available in your analysis; in the screenshot below, we choose properties of the email object.
Tools are the mechanism by which AIP Logic enables the LLM to read or write to the Ontology and power real-world operations. AIP Logic leverages three categories of Ontology-driven tools - data, logic, and action - to effectively query data, execute logical operations, and safely take actions.
The available tools include:
The Apply actions tool enables the LLM to use Actions to edit the Ontology. You can describe when the LLM should use the Action provided. For more details on how to apply changes to the Ontology, review Make Ontology edits using Logic functions below.
The Call function tool allows you to select functions that the LLM can call. Functions can be code-defined in repositories, or can be existing Logic functions.
The Query objects tool specifies object types that the LLM can access. You can add as many object types as needed and specify which properties the LLM can access in order to make the query more token-efficient.
The Calculator tool enables you to perform accurate mathematical calculations with an LLM.
You can define an intermediary output for every Logic block. The last block in your Logic path is the output of Logic function, labeled as "C" in the application interface guide.
Block output: Intermediary outputs that are passed between blocks. The output of your block can either be a primitive or an object for use in subsequent blocks.
Logic function output: The output of the Logic function that you want to return. This can be either a Value (primitive or object) or all the Ontology edits that your function has made.
Once you have composed your Logic function, you can test the Logic function by selecting Run on the right side of the view. When the Logic has been run, Debugger will open to display the LLM’s chain-of-thought (CoT).
The debugger allows you to expand and collapse block cards, clear tool calls, and easily review generated prompts, making it easier to interpret the chain of thought.
From the Run panel, you can run and evaluate your Logic, as well as review recent runs. The right-hand sidebar lets you set unit tests, run automations, and view run history.
At the bottom of the Run panel, you can also select any of your recent runs to view their output and debug log.
Select the unit tests icon () to save a version of your input for performance evaluation purposes.
Logic functions can be used the same way you would use a regular function on objects (FoO) in the platform.
When running the function in Logic, you will see all the proposed Ontology edits in your scenario in the Debugger. These edits will not actually be executed. If you wish to apply your edits to the Ontology, either:
For a Logic function to be able to edit the Ontology, you must:
When you are done iterating on your Logic function, find and select the Publish option located next to save to publish the Logic function.
Next, create a new action backed by the Logic function you have just published.
If you have access to AIP Logic, we recommend that you begin experimenting with LLM blocks to interact with your Ontology and build out a use case of your own. You may find it helpful to review the documentation on Functions in the platform.