Execute an AI-Prompt


Syntax

aiPromptTemplate(string $haip_prompt_id, ?array $vars, ?array $params): mixed


Parameter

@param string $$haip_prompt_id The AI-Prompt-ID.

@param array|null $vars Variables (key-value) that are propagated into the AI-Prompt, as "genieVars[...]".

@param array|ull $params Overriding engine-parameters.


Return

Returns the direct result of prompt. Either a string or an array (In case the answer was a JSON-String).


Examples

Writing in your twig source code:

String Answer:

{# Prepare some example data-variables:  #}
{% set myVars = {
    "x" = 1,
    "topic" = "Hamburg",
    }
 %}
{# Execute the stored Prompt-Template #}
{% set answer = hublify.aiPromptTemplate('<your tpl-id>', myVars ) %}