Skip to content

Scriptable Extensions Categories

Apiro provides a versatile system for extending functionality through various types of plugins and extensions. This documentation covers the different classes of plugins/extensions available in Apiro.


Built-Ins

Built-in plugins are provided as part of the Apiro platform and are implicitly recognized during the system boot process. They are written in Java. A complete list of available built-ins can be found in the official documentation.


Custom Java Extensions

Custom Java extensions are user-defined implementations written in Java. These extensions utilize the same interfaces as the built-ins and must be made accessible to Apiro, both in terms of code and configuration.

  • Code Accessibility:

    • Generate a custom Apiro combined JAR file using our Maven starter app (see documentation).

    • Utilize the ExecutionDomains feature in Apiro, which employs custom classloader facilities and an integrated Maven runtime to access external Maven repositories.

  • Configuration:

    • Add an XML config element to an Apiro ConfigurationSource.

See the documentation on how to generate a custom JAR file and use ExecutionDomains.


Gen Scriptables

Gen Scriptables are script-based plugins defined by the user. They are encoded into string properties of configuration elements and must be supplied in a specific payload format, such as #GRV{ ---script here--- }. The default scripting engine is Groovy, but alternatives can be provided.

Advantages:

  • Flexibility: Can execute any script, returning any type of result.

Disadvantages:

  • Lack of Type Safety: Errors may be encountered at runtime rather than compile-time.

  • Runtime Errors: Apiro performs test scenario runs at config load time to minimize errors, with plans for increased sophistication in future updates.

Gen Scriptables leverage the Java JSR 232 platform scripting API for execution.


Partial Classes

Partial Classes provide a tighter scripting option by utilizing Groovy's ability to be compiled statically. This method involves inserting your script into the method of a pre-designed class template, which is then compiled much like Java.

Advantages:

  • Stronger Type Safety: More errors are caught at compile-time.

  • IDE Integration: Class templates can be generated from the GUI and used inside an IDE for full code completion and type/syntax checking.

Requirements:

  • Use the Apiro Maven Bootstrap Starter (not the Docker Compose alternative). Refer to the documentation for running Apiro locally.

  • Make use of the Apiro "Script Surface Extensions" feature to add custom methods directly into the template.


AI Facilitators

Generative AI has transformed computing, and Apiro integrates seamlessly with various AI models. Apiro can access:

  • OPENAI - ChatGPT models

  • GOOGLE_VERTEX_GEMINI

  • GOOGLE_VERTEX

  • LOCAL (custom-developed or locally deployed models)

  • ANTHROPIC - Claude models

  • OLLAMA

  • HUGGING FACE

  • GROQ - Various models such as LLAMA3

AI Facilitators Use Case Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<LANGCHAIN_AI>

    <spec>

        Validate this dataPoint is a valid VISA credit card number. It may have whitespace so strip that out 
        before checking. Also be sure to validate the final checksum digit. 
      Provide the result in a single field JSON message like: { "valid" : true }

    </spec>

</LANGCHAIN_AI>

Considerations:

  • AI API calls are made on every execution, which may incur costs and affect performance.

  • Best used for DataTransformations on a DataSource rather than DataPoint validators.


Apiro KAI - AI Code Generators

Apiro KAI can use AI models to generate code, compile it, and store it for future use, avoiding repeated AI API calls during execution. This reduces cost and improves performance.

KAI Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<APIRO_KAI_GEN_AI>

    <spec>

        We need to validate that this dataPoint is a valid VISA credit card number. It may have whitespace 
        so strip that out before checking. Also be sure to validate the final checksum digit. Provide the 
        result in a single double field JSON message like: 

        { "ctype": "VISA", "valid" : true, "clean":"12345678912" }, 

        where ctype is the card type 
        (one of AMEX, DINERS, VISA, or OTHER - leave null if it cannot be determined), 

        valid is true or false depending on whether the card is valid, and clean is 
        the raw card number with all non-numeric digits such as whitespace or dashes removed.

    </spec>

</APIRO_KAI_GEN_AI>

Features:

  • AI-driven iterative code generation and compilation.

  • Option to include runtime behavior checks and adjust based on feedback.

  • Integration with HTTP REST services and LLM models during execution.

Extraordinary Capabilities:

  • KAI bridges the gap from simple text specifications to executable code.

  • Enables non-developers to generate working, optimized code from natural language instructions.

The Apiro KAI tool transforms pipeline development, making advanced coding accessible to everyone, regardless of programming proficiency.


For more details and examples, refer to the Apiro documentation.