modules
3 years ago
admin.php
3 years ago
ai.php
3 years ago
answer.php
3 years ago
core.php
3 years ago
init.php
3 years ago
openai.php
3 years ago
query.php
3 years ago
queryimage.php
3 years ago
querytext.php
3 years ago
rest.php
3 years ago
ui.php
3 years ago
query.php
38 lines
| 1 | <?php |
| 2 | |
| 3 | class Meow_MWAI_Query { |
| 4 | public $prompt = ''; |
| 5 | public $apiKey = null; |
| 6 | public $maxResults = 1; |
| 7 | |
| 8 | public function __construct( $prompt = '' ) { |
| 9 | $this->prompt = $prompt; |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Given a prompt, the model will return one or more predicted completions. |
| 14 | * It can also return the probabilities of alternative tokens at each position. |
| 15 | * @param string $prompt The prompt to generate completions. |
| 16 | */ |
| 17 | public function setPrompt( $prompt ) { |
| 18 | $this->prompt = $prompt; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * The API key to use. |
| 23 | * @param string $apiKey The API key. |
| 24 | */ |
| 25 | public function setApiKey( $apiKey ) { |
| 26 | $this->apiKey = $apiKey; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * How many completions to generate for each prompt. |
| 31 | * Because this parameter generates many completions, it can quickly consume your token quota. |
| 32 | * Use carefully and ensure that you have reasonable settings for max_tokens and stop. |
| 33 | * @param float $maxResults Number of completions. |
| 34 | */ |
| 35 | public function setMaxResults( $maxResults ) { |
| 36 | $this->maxResults = $maxResults; |
| 37 | } |
| 38 | } |