wppaste
WordPress

FunctionCall

Since
0.1.0
Source
wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:20
Represents a function call request from an AI model.

Description

This DTO encapsulates information about a function that the AI model wants to invoke, including the function name and its arguments.

Compatibility

WordPress
since 0.1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in 2 of the 5 tracked releases, added in 0.1.0.

Properties · 3

$idstring|nullprivate
$namestring|nullprivate
$argsmixedprivate

Methods · 7

Source code

class FunctionCall extends AbstractDataTransferObject{    public const KEY_ID = 'id';    public const KEY_NAME = 'name';    public const KEY_ARGS = 'args';    /**     * @var string|null Unique identifier for this function call.     */    private ?string $id;    /**     * @var string|null The name of the function to call.     */    private ?string $name;    /**     * @var mixed The arguments to pass to the function.     */    private $args;    /**     * Constructor.     *     * @since 0.1.0     *     * @param string|null $id Unique identifier for this function call.     * @param string|null $name The name of the function to call.     * @param mixed $args The arguments to pass to the function.     * @throws InvalidArgumentException If neither id nor name is provided.     */    public function __construct(?string $id = null, ?string $name = null, $args = null)    {        if ($id === null && $name === null) {            throw new InvalidArgumentException('At least one of id or name must be provided.');        }        $this->id = $id;        $this->name = $name;        $this->args = $args;    }    /**     * Gets the function call ID.     *     * @since 0.1.0     *     * @return string|null The function call ID.     */    public function getId(): ?string    {        return $this->id;    }    /**     * Gets the function name.     *     * @since 0.1.0     *     * @return string|null The function name.     */    public function getName(): ?string    {        return $this->name;    }    /**     * Gets the function arguments.     *     * @since 0.1.0     *     * @return mixed The function arguments.     */    public function getArgs()    {        return $this->args;    }    /**     * {@inheritDoc}     *     * @since 0.1.0     */    public static function getJsonSchema(): array    {        return ['type' => 'object', 'properties' => [self::KEY_ID => ['type' => 'string', 'description' => 'Unique identifier for this function call.'], self::KEY_NAME => ['type' => 'string', 'description' => 'The name of the function to call.'], self::KEY_ARGS => ['type' => ['string', 'number', 'boolean', 'object', 'array', 'null'], 'description' => 'The arguments to pass to the function.']], 'anyOf' => [['required' => [self::KEY_ID]], ['required' => [self::KEY_NAME]]]];    }    /**     * {@inheritDoc}

Changelog

Introduced in 0.1.0. Unchanged from 7.0.4 through 7.1.0.

  1. 7.0.4
  2. 7.1.0

Signature, return type and hooks compared across 2 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.