You can’t request it. You have to build it.
Something like this:
public function solrai_getChatCompletion($messages, $apiOpenAI) {
// By the time we get here, $this->model should represent // the model that will be used for this query. // Get provider info for $this->model $this->provider = $this->modelListArray[$this->model]['provider']; $this->maxTokens = $this->modelListArray[$this->model]['max_tokens']; $this->apiEndpoint = $this->modelListArray[$this->model]['endpoint']; $this->apiKey = $this->modelListArray[$this->model]['api_key']; $this->apiSecret = $this->modelListArray[$this->model]['secret_key']; if ($this->provider === 'mistral') { return $this->solrai_getChatCompletionMistral($messages); } if ($this->provider === 'openai') { return $this->solrai_getChatCompletionOpenAI($messages, $apiOpenAI); } if ($this->provider === 'aws') { return $this->solrai_getChatCompletionAWS($messages); } if ($this->provider === 'google') { return $this->solrai_getChatCompletionGoogle($messages); }
I have methods that will create the correct $message format based upon the model. This is pretty cool because I’m able to slot in new models rather quickly (especially if they are from the same provider) rather than re-writing existing code to accommodate new/updated models.