Zenera Logo

You can define dynamic data corpuses for your Agentic Interface.

Dynamic data corpuses allow you to retrieve semi-structured data (JSON) from different data sources, process it using transforms and utilize the retrieved data to answer user queries in natural language. Dynamic data corpuses can be connected with various external systems, such as corporate platforms, databases, API services and other specialized data sources, to provide users with accurate, timely and contextually relevant information.

Corpus parameters

To define a dynamic corpus, use the corpus() function:

corpus({
    title: `Infrastructure requests`,
    description: `Corpus to answer user queries about infrastructure objects`,
    input: project.objects,
    query: transforms.vms_queries,
    output: project.cleanObjects,
    transforms: transforms.vms_answer,
    priority: 1
});
NameTypeRequired/OptionalDescription
titlestringOptionalCorpus title.
descriptionstringOptionalCorpus description.
inputfunctionOptionalFunction used to populate the Input field of the query transform.
queryfunctionRequiredTransforms function used to process user queries and generate code to retrieve necessary data.
outputfunctionOptionalFunction used to process obtained data, before it is passed to the transforms function.
transformsfunctionOptionalTransforms function used to process and format data obtained with the query transform.
priorityintegerOptionalPriority level assigned to the corpus. Corpuses with higher priority are considered more relevant when user requests are processed.

How the dynamic corpus works

The implementation of a dynamic corpus can vary depending on the specific business use case and scenario. Typically, the data flows through the following stages:

  1. The user makes a request to the dynamic corpus.
  2. Alan AI retrieves JSON data from an external system and applies the query function to it to handle the user's request and generate the code needed to retrieve the relevant information.
  3. [Optional] Alan AI may perform additional processing on the data using the output function.
  4. The data is passed to the transforms function. Alan AI applies the transforms function instructions to process and format the output for the user.
  5. The response data is presented to the user.

Example of use

Assume you have a JSON object that lists virtual machines (VMs) in a cloud environment. You want to use this data as a dynamic source so users can ask questions about the VMs, and the Agentic Interface can provide a formatted response in natural language.

To do this, perform the following steps:

  1. Retrieve VM data: add a function that retrieves the VM data from the data source.
  2. Add a query transform: instruct the Agentic Interface on how to generate code that will get the necessary data to answer user queries.
  3. Add a data formatting transform: instruct the Agentic Interface on how to format the output of the corpus data.
  4. Add a dynamic corpus: define a dynamic corpus.
  5. [Advanced] Clean up the input data: process the input data before it is passed to the formatting transform.

Note:

Each function used in transforms must have an explanation formatted as a JSDoc comment preceding the function code.