Veezoo

description_sql

Definition

Similar to name_sql, description_sql specifies how descriptions for entities are generated. You can use it to provide a detailed and structured description of an entity, either as a simple one-liner or a more advanced markdown-based format.

Examples

Example 1: Simple One-Liner

This example shows a basic description_sql for a Product, using just the name and category fields:

kb {
    class Product {
        name.en: "Product"
        from_table: product
        // e.g. P1234
        sql: "${product.id}"
        // e.g. [P1234] Apple iPhone 13
        name_sql.en: "'[' || ${product.id} || '] ' || ${product.name}"        
        // Simple one-liner description
        description_sql.en: "${product.name} || ' is in the ' || ${product.category} || ' category.'"
        ...
    }
}

The entities will look like this:

kb.Product {
    entity P1234_Apple_iPhone_13 {         
        name.en: "[P1234] Apple iPhone 13"

        description.en: "Apple iPhone 13 is in the Electronics category."

        id: "P1234"
    }
...
}

Example 2: Advanced Markdown Description

This example generates a more detailed description using multiple attributes like category, subcategory, and stock_level, formatted as markdown for better readability:

kb {
    class Product {
        name.en: "Product"
        from_table: product
        // e.g. P1234
        sql: "${product.id}"
        // e.g. [P1234] Apple iPhone 13
        name_sql.en: "'[' || ${product.id} || '] ' || ${product.name}"        
        // Advanced markdown description
        description_sql.en:
            """
            '**Product**: ' || ${product.name} || '
            
            **Category**: ' || ${product.category} || '
            
            **Subcategory**: ' || ${product.subcategory} || '
            
            **Stock Level**: ' || ${product.stock_level} || ' units in stock'
            """
        ...
    }
}

The entities will look like this:

kb.Product {
    entity P1234_Apple_iPhone_13 {         
        name.en: "[P1234] Apple iPhone 13"

        description.en:
            """
            **Product**: Apple iPhone 13  
            
            **Category**: Electronics  
            
            **Subcategory**: Smartphones  
            
            **Stock Level**: 24 units in stock
            """

        id: "P1234"
    }
...
}

In the second example, markdown formatting is used to make the description more structured and visually appealing, providing clear information on key product attributes.