* @author Maximum Software Inc * @license GPL-3.0-only * @link https://agenistrator.com/ * * SPDX-FileCopyrightText: 2025-2026 Alex Ruban * SPDX-FileCopyrightText: 2025-2026 Maximum Software Inc * SPDX-License-Identifier: GPL-3.0-only */ namespace Agenistrator; // Direct access prevention if ( ! defined( 'ABSPATH' ) ) { exit; } /** * LLM_Chat_Anthropic class. */ class LLM_Chat_Anthropic extends LLM_Chat_OpenAI { /** * Create a new context object specific to Anthropic * * @param string $system_message Optional custom system message * @return Context_Anthropic Anthropic-specific context object * @since 1.0.0 */ public function create_context( $system_message = null ) { return new Context_Anthropic( $system_message ); } /** * Validate that the context is the correct type for this provider * * @param Context $context Context object to validate * @throws \Exception If context is not the correct type * @since 1.0.0 */ protected function validate_context( $context ) { if ( ! ( $context instanceof Context_Anthropic ) ) { // phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Exception messages are not HTML output throw new \Exception( String_Utils::replace_tags( __( 'Invalid context type: expected {expected}, got {actual}', 'agenistrator' ), array( 'expected' => 'Context_Anthropic', 'actual' => get_class( $context ), ) ) ); // phpcs:enable WordPress.Security.EscapeOutput.ExceptionNotEscaped } } }