How can I configure API to get same result as ChatGPT Web?

I get a different result from the API than I get from the ChatGPT Site.
I hope I can change the configuration of the site so I get the same result.

I want to get a structured (JSON) representation of a ISTBQ test case.

Given this question:

Given the following ISTQB testcase, can you write a script in meta-data in json structure?

Test Condition: Username should not be empty

Description:
The user navigates to “https://example.com/account/create”.
The user enters the required fields, but leaves the field “Username” empty.
Next, the user presses the “Submit” button.
The system should alert that the username field may not be empty.

Input Values:

Username: empty
Password: “testpassword”
Email: “testemail”
Expected Output: The system should alert that the username field may not be empty.

Pre-Conditions:

Post-Conditions:

The new user account is not created.

The web ( ChatGPT Feb 13 Version) returns this (which is what I want):

{
    "feature": "User Registration",
    "scenario": "Registration with empty username",
    "testSteps": [
        {
            "description": "The user navigates to 'https://example.com/account/create'",
            "action": "navigateTo",
            "target": "https://example.com/account/create"
        },
        {
            "description": "The user enters the required fields, but leaves the field 'Username' empty",
            "action": "enterText",
            "target": {
                "field": "Username",
                "value": ""
            }
        },
        {
            "description": "The user enters the password",
            "action": "enterText",
            "target": {
                "field": "Password",
                "value": "testpassword"
            }
        },
        {
            "description": "The user enters the email",
            "action": "enterText",
            "target": {
                "field": "Email",
                "value": "testemail"
            }
        },
        {
            "description": "The user presses the 'Submit' button",
            "action": "click",
            "target": "Submit"
        },
        {
            "description": "The system should alert that the username field may not be empty",
            "action": "verifyTextPresent",
            "target": "The username field may not be empty"
        },
        {
            "description": "The new user account is not created",
            "action": "verifyElementNotPresent",
            "target": "User account details"
        }
    ]
}

But if I use the API with this configuration:

     return openai.createChatCompletion(
            {
                "model": "gpt-3.5-turbo",
                "messages": [{role: "user", content: istqbTestCase}],
                "temperature": 0,
                "top_p": 1,
                "max_tokens": 1200
            }
        ).then(response=>{ ... })

I get this response:

{
    "testcase": {
        "id": "TC001",
        "title": "Verify error message when username field is left empty",
        "description": "Verify that the system displays an error message when the username field is left empty during account creation",
        "testSteps": [
            {
                "stepNumber": 1,
                "description": "Navigate to https://example.com/account/create",
                "expectedResult": "The account creation page should be displayed"
            },
            {
                "stepNumber": 2,
                "description": "Enter testpassword in the Password field",
                "expectedResult": "The Password field should be populated with testpassword"
            },
            {
                "stepNumber": 3,
                "description": "Enter testemail in the Email field",
                "expectedResult": "The Email field should be populated with testemail"
            },
            {
                "stepNumber": 4,
                "description": "Leave the Username field empty",
                "expectedResult": "The Username field should be empty"
            },
            {
                "stepNumber": 5,
                "description": "Click on the Submit button",
                "expectedResult": "An error message should be displayed indicating that the username field may not be empty"
            }
        ],
        "inputData": {
            "username": "",
            "password": "testpassword",
            "email": "testemail"
        },
        "expectedOutput": "The system should display an error message indicating that the username field may not be empty",
        "preConditions": "The user is on the account creation page",
        "postConditions": "The new user account is not created"
    }
}

Can I get the same response as from the website? What should I change in the configuration?

Thanks a lot!

1 Like

Welcome to the community @mvermand

ChatGPT is known to have been instructed with the following system message:
"You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible. Knowledge cutoff: {knowledge_cutoff} Current date: {current_date}"

Consider reading docs.