php-llm-agent/lib/actions/simple_echo.action.php

30 lines
553 B
PHP

<?php
/**
* SIMPLE ACTION: Echo
* -------------------------
* Demonstrates how to register and implement a simple echo action.
*
* Call format:
* @echo HelloWorld
*
* Expected output:
* "HelloWorld"
*/
// 1. Register the action with expected argument types
registerAction(
(new Action())
->setFunctionName("echo_text")
->setArgumentsTypes(["input"]) // one argument
);
/**
* 2. Implement the function
*
* @param string $input
* @return string
*/
function echo_text(string $input): string {
return $input;
}