| Server IP : 121.121.20.254 / Your IP : 216.73.217.18 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/AIWEBSTATION/wp-content/plugins/ai-engine/classes/data/ |
Upload File : |
<?php
/**
* Value object representing a function call request from an AI model
*/
class Meow_MWAI_Data_FunctionCall {
public string $id;
public string $name;
public string $arguments;
public function __construct( string $id, string $name, string $arguments ) {
$this->id = $id;
$this->name = $name;
$this->arguments = $arguments;
}
/**
* Create from OpenAI tool call format
*/
public static function from_tool_call( array $toolCall ): self {
return new self(
$toolCall['id'],
$toolCall['function']['name'],
$toolCall['function']['arguments']
);
}
/**
* Create from Anthropic tool use format
*/
public static function from_tool_use( array $toolUse ): self {
return new self(
$toolUse['id'],
$toolUse['name'],
json_encode( $toolUse['input'] )
);
}
/**
* Get arguments as JSON string
*/
public function get_arguments_json(): string {
return $this->arguments;
}
/**
* Get arguments as array
*/
public function get_arguments_array(): array {
return json_decode( $this->arguments, true ) ?? [];
}
}