-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Deeka Wong <[email protected]>
- Loading branch information
1 parent
e3d2156
commit d84763f
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of friendsofhyperf/components. | ||
* | ||
* @link https://github.com/friendsofhyperf/components | ||
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
|
||
namespace FriendsOfHyperf\OpenAi\Facade; | ||
|
||
use Hyperf\Context\ApplicationContext; | ||
use OpenAI\Contracts\ClientContract; | ||
|
||
/** | ||
* @method static \OpenAI\Resources\Assistants assistants() | ||
* @method static \OpenAI\Resources\Audio audio() | ||
* @method static \OpenAI\Resources\Batches batches() | ||
* @method static \OpenAI\Resources\Chat chat() | ||
* @method static \OpenAI\Resources\Completions completions() | ||
* @method static \OpenAI\Resources\Embeddings embeddings() | ||
* @method static \OpenAI\Resources\Edits edits() | ||
* @method static \OpenAI\Resources\Files files() | ||
* @method static \OpenAI\Resources\FineTunes fineTunes() | ||
* @method static \OpenAI\Resources\Images images() | ||
* @method static \OpenAI\Resources\Models models() | ||
* @method static \OpenAI\Resources\Moderations moderations() | ||
* @method static \OpenAI\Resources\Threads threads() | ||
* @method static \OpenAI\Resources\VectorStores vectorStores() | ||
*/ | ||
class OpenAI | ||
{ | ||
public static function __callStatic($name, $arguments) | ||
{ | ||
$instance = ApplicationContext::getContainer()->get(ClientContract::class); | ||
|
||
return $instance->{$name}(...$arguments); | ||
} | ||
} |