Official Content
  • This documentation is valid for:

This article introduces a sample application showcasing the capabilities of GeneXus Next in building intelligent, agentic applications.

Developed using the first December 2024 build of GeneXus Next, the sample application heavily leverages AI-assisted development, demonstrating cutting-edge features for modern application design.

It's simply about using AI for Products and Categories CRUD and Search. 

Key Features

  • Agent object 
    • Text Expansion: Automatically generate a product description based on its name.
    • Context-Based Categorization: Assign a category to a product using its description and a predefined context of valid categories.
  • Embedding data type
    • Enables semantic search within a product catalog, using vector-based similarity.

How to Build the Sample

  1. Download the Sample File
    Download the sample application: GeneXus Next Agents Sample
  2. Create a Knowledge Base
    Select a target environment:
    • Local: Java or .NET with PostgreSQL.
    • Prototyping Cloud: .NET with PostgreSQL.
  3. Import and Initialize
    • Import the downloaded XPZ file into your Knowledge Base.
    • Run the following objects:
      • Init
      • Home

If you prefer not to build the application yourself, you can try it out directly here: https://next101.genexus.ai/Id5bb169495a7907222f8bd9925703fa61/home

Try it out

  1. Semantic Product Search
    • Use natural language to search for products, even with terms that aren’t explicitly in the database.
    • The system prioritizes products that best match your intent.
  2. Product CRUD Operations
    • When adding a new product:
      • The Product Description is generated by an AI Agent based on the entered Product Name.
      • The Category is automatically assigned based on the Product Description.

What's behind this

GeneXus Next automates the entire lifecycle of the application, generating all layers, including:

  • UI layer
  • Business logic layer
  • AI agents access layer
  • Data access layer

Globant Enterprise AI acts as a runtime platform for AI Agents, and behind the scenes it does the following:

  • Allows the system to connect securely to the LLMs,
  • Handles versioning of the agents,
  • Controls and logs all LLM requests,
  • Allows the management of the underlying LLM access costs, etc.

Key Components

  1. AI Agents
    Defined in GeneXus and deployed via Globant Enterprise AI for:
    • Text expansion.
    • Contextual categorization.
  2. Database
    • Powered by PostgreSQL with pgvector for vector support.
    • Supports semantic search through vector embeddings.

AI Application Features in Detail

1. Semantic Product Search

When a user searches for a product:

  • Text to Vector Transformation:
    The input string is converted into a vector using a Large Language Model (LLM) via Globant Enterprise AI.

  • Vector-Based Search:
    The vector is compared against the ProductEmbedding column in PostgreSQL using cosine distance. This is facilitated by the pgvector extension.

#Rules
   order(ProductEmbedding.Distance(&ProductEmbedding));
#End

#Events
 Event Start
   &SearchText = "I'm looking for something that is powered by electricity"
 EndEvent

 Event Refresh
  &ProductEmbedding = ProductEmbedding.GenerateEmbedding(&SearchText,&Messages)
EndEvent
#End

2. Vector Definition in the data model and population using declarative programming

The ProductEmbedding field has been defined as an attribute of Embedding type in the Product transaction and stores vectors representing each record.

ProductEmbedding
[
   DataType = 'Embedding'
]

Related Product Transaction rules:

ProductEmbedding = ProductEmbedding.GenerateEmbedding(format("Product: %1, Description: %2, Price: %3, Category: %4", ProductName, ProductDescription, ProductPrice.ToString(), CategoryName) ) on aftervalidate;

3. Default Product Description generation

When validating the Product Name, an AI Agent generates a default description via Globant Enterprise AI.

The agent's definition in GeneXus is as follows:

Agent ProductDescriber
{
     Expand the product name "{{&ProductName}}" into a detailed product description of maximum 200 characters.
    Return just the string with the suggested description.

    #Rules
         parm(in:&ProductName, out: &ProductDescription);
    #End
}

Related Product Transaction rules: 

   call(ProductDescriber,ProductName, &ProductDescriberCallResult, &ProductDescription) if insert;
   default(ProductDescription, &ProductDescription);

4. Default Category generation

Similar to the description, the category is also generated by an AI Agent, which considers the product description and available categories.

Agent CategoryMatcher
{
      Determine the best matching category for the product description: "{{&ProductDescription}}" using the provided categories: $context.
      Return just the value of the Id of the category.

    #Rules
          parm(in:&ProductDescription, out: &MatchedCategory);
          context(GetCategoryCollection());
    #End
}

Related Product Transaction rules:

   call(CategoryMatcher,&ProductDescription,&CategoryMatcherCallResult, &CategoryMatch ) if insert;
   default(CategoryId, &CategoryMatch.ToNumeric());

 

Conclusion

GeneXus Next significantly expands the scope of business modeling by:

  1. Supporting AI Agents that unlock new, previously unthinkable scenarios.
  2. Enabling semantic searches with embeddings and vector databases.

In summary, GeneXus automates the end-to-end creation of a complete AI-powered application.

Last update: March 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant