anthropic.php
1 year ago
chatml.php
1 year ago
core.php
1 year ago
factory.php
1 year ago
google.php
1 year ago
huggingface.php
1 year ago
openai.php
1 year ago
openrouter.php
1 year ago
perplexity.php
1 year ago
replicate.php
1 year ago
openai.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | class Meow_MWAI_Engines_OpenAI extends Meow_MWAI_Engines_ChatML |
| 4 | { |
| 5 | // Static |
| 6 | private static $creating = false; |
| 7 | |
| 8 | public static function create( $core, $env ) { |
| 9 | self::$creating = true; |
| 10 | if ( class_exists( 'MeowPro_MWAI_OpenAI' ) ) { |
| 11 | $instance = new MeowPro_MWAI_OpenAI( $core, $env ); |
| 12 | } |
| 13 | else { |
| 14 | $instance = new self( $core, $env ); |
| 15 | } |
| 16 | self::$creating = false; |
| 17 | return $instance; |
| 18 | } |
| 19 | |
| 20 | public function __construct( $core, $env ) |
| 21 | { |
| 22 | $isOwnClass = get_class( $this ) === 'Meow_MWAI_Engines_OpenAI'; |
| 23 | if ( $isOwnClass && !self::$creating ) { |
| 24 | throw new \Exception( "Please use the create() method to instantiate the Meow_MWAI_Engines_OpenAI class." ); |
| 25 | } |
| 26 | parent::__construct( $core, $env ); |
| 27 | $this->set_environment(); |
| 28 | } |
| 29 | } |
| 30 |