WP_AI_Client_Ability_Function_Resolver::has_ability_calls( WordPressAiClientMessagesDTOMessage $message ): bool

In this article

Checks if a message contains any ability function calls.

Parameters

$messageWordPressAiClientMessagesDTOMessagerequired
The message to check.

Return

bool True if the message contains ability calls, false otherwise.

Source

public function has_ability_calls( Message $message ): bool {
	foreach ( $message->getParts() as $part ) {
		if ( $part->getType()->isFunctionCall() ) {
			$function_call = $part->getFunctionCall();
			if ( $function_call instanceof FunctionCall && $this->is_ability_call( $function_call ) ) {
				return true;
			}
		}
	}

	return false;
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.