openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.56k stars 466 forks source link

[Bug]: GPT-3 Model Being Used Despite Specifying GPT-4 in Client Request #347

Closed pjparkjd closed 3 months ago

pjparkjd commented 4 months ago

Environment:

Issue Description: When attempting to use the GPT-4 model through the openai-php/client, the response appears to be coming from the GPT-3 model instead of GPT-4. This conclusion is based on the response to queries about the model's identity and the lack of GPT-4 specific features, such as web browsing capabilities.

Steps to Reproduce:

  1. Call the get_response function with a $user_message parameter set to 'What version of GPT is this?' and the $model parameter set to 'gpt-4'.
  2. Observe the response indicating the model is GPT-3 and the absence of GPT-4 features.

Expected Behavior: The response should correctly identify the model as GPT-4 and exhibit GPT-4 specific features, assuming the model parameter is correctly set to 'gpt-4'.

Actual Behavior: The response indicates "This is GPT-3, developed by OpenAI." Additionally, the model does not support GPT-4 specific features, like accessing websites.

Code Snippet:

public function get_response( $user_message, $model = 'gpt-4') {

    $completion = $this->client->chat()->create([
        'model' => 'gpt-4', // hard coded for testing
        'messages' =>[
            ['role' => 'user', 'content' => $user_message ],
        ],
    ]);

    // Extract response
    $response = $completion->choices[0]->message->content;
    return $response;
}

Additional Context: The discrepancy between the specified and the utilized model affects the application's functionality, as GPT-4 features are crucial for the intended use-case.

Is this a known issue, or is there a potential misconfiguration on my end? Any guidance or updates to resolve this discrepancy would be greatly appreciated.

pjparkjd commented 3 months ago

I've been living in a nightmare.

Direct internet access, implied by browsing capabilities, is not inherently available in GPT-4. Developers achieve a semblance of this functionality by integrating external tools and APIs through customized solutions, such as function calling with GPT-4's ability to produce structured outputs for specific external queries. This indirect method allows applications to interact with the internet or other data sources without native browsing capability within the AI model itself.