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
67 lines
| 1 | <?php |
| 2 | |
| 3 | class Meow_MWAI_Query { |
| 4 | public $env = ''; |
| 5 | public $prompt = ''; |
| 6 | public $model = ''; |
| 7 | public $mode = ''; |
| 8 | public $apiKey = null; |
| 9 | public $session = null; |
| 10 | public $maxResults = 1; |
| 11 | |
| 12 | public function __construct( $prompt = '' ) { |
| 13 | $this->prompt = $prompt; |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * The environment, like "chatbot", "imagesbot", "chatbot-007", "textwriter", etc... |
| 18 | * Used for statistics, mainly. |
| 19 | * @param string $env The environment. |
| 20 | */ |
| 21 | public function setEnv( $env ) { |
| 22 | $this->env = $env; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * ID of the model to use. |
| 27 | * @param string $model ID of the model to use. |
| 28 | */ |
| 29 | public function setModel( $model ) { |
| 30 | $this->model = $model; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Given a prompt, the model will return one or more predicted completions. |
| 35 | * It can also return the probabilities of alternative tokens at each position. |
| 36 | * @param string $prompt The prompt to generate completions. |
| 37 | */ |
| 38 | public function setPrompt( $prompt ) { |
| 39 | $this->prompt = $prompt; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * The API key to use. |
| 44 | * @param string $apiKey The API key. |
| 45 | */ |
| 46 | public function setApiKey( $apiKey ) { |
| 47 | $this->apiKey = $apiKey; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * The session ID to use. |
| 52 | * @param string $session The session ID. |
| 53 | */ |
| 54 | public function setSession( $session ) { |
| 55 | $this->session = $session; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * How many completions to generate for each prompt. |
| 60 | * Because this parameter generates many completions, it can quickly consume your token quota. |
| 61 | * Use carefully and ensure that you have reasonable settings for max_tokens and stop. |
| 62 | * @param float $maxResults Number of completions. |
| 63 | */ |
| 64 | public function setMaxResults( $maxResults ) { |
| 65 | $this->maxResults = $maxResults; |
| 66 | } |
| 67 | } |