Dynamic functions, HTML and structured JSON output

Overview

This tutorial shows step by step how to add a dynamic ability that renders its JSON using a HTML template and generates an image as well. These steps can be applied to any structured JSON output rendering data in an easier to read way.

Step 1: Create multi-shot example and HTML template

Structured rendering of HTML templates depends on the LLM Explorer application, and it must be installed to follow this tutorial.

  1. Navigate to LLM Explorer -> Chat using the main menu
  1. Enter a System Message that matches the task
  2. Supply one or more examples of the prompt and matching JSON you want the model to respond with
  3. Press the Disk icon in the upper right-hand corner of the screen, give the example set a name and press Save
  4. Press the HTML Template button to edit the template for the JSON
  1. Input the HTML template using Handlebars formatting
  2. Use the Preview tab until the results look how you want
  3. Press the Save button

Step 2: Create Dynamic Ability

The first step is to create the dynamic ability in the AI Routing area. The last two steps are only necessary if configuring a new dynamic ability security group.

  1. Navigate to AI Routing with the main menu
  2. Click the Add Ability button to the upper right of the Dynamic Abilities list.
  1. Enter an example prompt that you would want to trigger the dynamic ability in this example we enter “Generate an NPC with name Mad Max“
  2. Click the Create button
  3. Navigate to newly created dynamic ability
  1. Change Ability Type to Formatted Response
  2. Give the dynamic AI Ability a name
  3. Assign the AI ability a tag, this is needed to make the AI ability assignable to an AI agent
  4. Select the formatted response npc_generator we created in the last step
  5. Press the Save button
  1. Navigate to User Accounts -> User Groups
  2. Edit user group you want to have access to the dynamic ability
  3. Scroll down to the Custom Agent Abilities
  4. Grant access to the Dynamic – *TAG* for custom agents
  1. Navigate to AI Agents -> Your Agent -> AI Abilities
  2. Find the new Dynamic – *TAG* AI ability.
  3. Grant access to the AI ability for the agent
  4. Press the Save button

Step 3: Enjoy!

You can now use the structured output dynamic ability in the chat UI. You can also associate an emoji shortcut with the new AI ability.

0

Modules to install

These modules will be installed automatically when your Assistant Cortex instance is provisioned.

Nothing selected yet — browse the marketplace and hit Install on anything you want preloaded.