Unable to Identify GPT Model Version with OpenAI Chat API

62 views Asked by At
import os
from openai import OpenAI

os.environ["OPENAI_API_KEY"] = "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {
            "role": "user",
            "content": "are you chat gpt-4 or something else?"
        }
    ],
    max_tokens=300,
)

print(response.choices[0])

I am using the OpenAI Chat API with Python and trying to identify the GPT model version being used in the response. Despite specifying the model as "gpt-4," the response always indicates the use of a GPT-3 model. I have tried different model versions, but the result remains consistent. Can anyone provide guidance on how to correctly specify the GPT model version and receive a response from the intended model?

Response i am getting

Choice(finish_reason='length', index=0, logprobs=None, message=ChatCompletionMessage(content='I am AI developed by OpenAI, specifically I', role='assistant', function_call=None, tool_calls=None))

0

There are 0 answers