403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.164
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/konzalta/public_html/wp-content/plugins/ai-engine/classes/data/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/konzalta/public_html/wp-content/plugins/ai-engine/classes/data/function-result.php
<?php

/**
* Value object representing the result of a function execution
*/
class Meow_MWAI_Data_FunctionResult {
  public string $id;
  public bool $success;
  public $content;
  public ?string $error;

  private function __construct( string $id, bool $success, $content, ?string $error = null ) {
    $this->id = $id;
    $this->success = $success;
    $this->content = $content;
    $this->error = $error;
  }

  /**
  * Create a successful result
  */
  public static function success( string $id, $content ): self {
    return new self( $id, true, $content );
  }

  /**
  * Create a failed result
  */
  public static function failure( string $id, string $error ): self {
    return new self( $id, false, null, $error );
  }

  /**
  * Get content as string
  */
  public function get_content_string(): string {
    if ( $this->error ) {
      return 'Error: ' . $this->error;
    }
    return is_string( $this->content ) ? $this->content : json_encode( $this->content );
  }

  /**
  * Format for OpenAI Responses API
  */
  public function to_responses_api_format(): array {
    return [
      'type' => 'function_call_output',
      'call_id' => $this->id,
      'output' => $this->get_content_string()
    ];
  }

  /**
  * Format for Anthropic API
  */
  public function to_anthropic_format(): array {
    return [
      'type' => 'tool_result',
      'tool_use_id' => $this->id,
      'content' => [
        [
          'type' => 'text',
          'text' => $this->get_content_string()
        ]
      ]
    ];
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit