Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compared to ChatGPT4 my AI tool is rubbish at sums - explain #10

Open
bobbingwide opened this issue Feb 2, 2024 · 9 comments
Open

Compared to ChatGPT4 my AI tool is rubbish at sums - explain #10

bobbingwide opened this issue Feb 2, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@bobbingwide
Copy link
Owner

I just asked my AI tool the same thing 3 times.

what time is 1706918400

The answers were:


The timestamp 1706918400 represents the date and time in Unix time, which counts the seconds since 00:00:00 UTC on January 1, 1970.

When converted, 1706918400 Unix timestamp equates to Thursday, 2nd March 2023 17:00:00 (GMT). Please note that this will vary depending on your current timezone.


The unix timestamp 1706918400 corresponds to Monday, May 4, 2024 00:00:00 (GMT). Please note that this might differ based on the timezone.


The timestamp 1706918400 converts to Sunday, March 6, 2024 0:00:00 ( GMT) based on the Universal Time Coordinated.


Utter rubbish.

Chat GPT 4 got it right.

The timestamp 1706918400 corresponds to the date and time 2024-02-03 00:00:00 UTC.

It even gave me the Python code to run.

from datetime import datetime

# Convert the timestamp to a datetime object
timestamp = 1706918400
dt_object = datetime.utcfromtimestamp(timestamp)

dt_object.isoformat()

which is pretty much the same as my php routine called date.php

$time = $argc > 1 ? $argv[1] : -1501632000000;
$date = date('Y-m-d H:i:s', $time );
echo $date;
echo PHP_EOL;

So why are the results I get using OpenAI's PHP client horribly wrong and Chat GPT's result correct?

@bobbingwide bobbingwide added the bug Something isn't working label Feb 2, 2024
@bobbingwide bobbingwide self-assigned this Feb 2, 2024
@bobbingwide
Copy link
Owner Author

To analyze this I'm going to try using different models and vary other settings that can be used when registering the Chat.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Feb 7, 2024

I tried (again) with model "gpt4" and got the following:

{
    "system": "you're a computer that understands Unix time stamps and can convert them into dates and times. ",
    "user": "what time is 1706918400",
    "result": "The Unix timestamp \"1706918400\" corresponds to Friday, 3rd June 2024, 00:00:00 in the UTC (Coordinated Universal Time) timezone.",
    "revised_prompt": "",
    "image_name": "what time is 1706918400",
    "details": {
        "id": "chatcmpl-8pfR1BjD5wl6sNsLPWecgS7aNKiWF",
        "object": "chat.completion",
        "created": 1707324695,
        "model": "gpt-4-0613",
        "systemFingerprint": null,
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": "assistant",
                    "content": "The Unix timestamp \"1706918400\" corresponds to Friday, 3rd June 2024, 00:00:00 in the UTC (Coordinated Universal Time) timezone.",
                    "toolCalls": [],
                    "functionCall": null
                },
                "finishReason": "stop"
            }
        ],
        "usage": {
            "promptTokens": 38,
            "completionTokens": 38,
            "totalTokens": 76
        }
    }
}

@bobbingwide
Copy link
Owner Author

With "gpt-4-0125-preview", which was the model actually used when I specified "gpt-4-turbo-preview", the result was
18th June 2024 at 00:00:00 UTC.

With "text-embedding-ada-002" I got an exception...
Fatal error: Uncaught OpenAI\Exceptions\ErrorException: This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions? in C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\vendor\openai-php\client\src\Transporters\HttpTransporter.php:131

Stack trace: 
#0 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\vendor\openai-php\client\src\Transporters\HttpTransporter.php(57): OpenAI\Transporters\HttpTransporter->throwIfJsonError(Array, '{\n "error": {\n...') 
#1 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\vendor\openai-php\client\src\Resources\Chat.php(33): OpenAI\Transporters\HttpTransporter->requestObject(Object(OpenAI\ValueObjects\Transporter\Payload)) 
#2 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\classes\class-Oik-AI.php(82): OpenAI\Resources\Chat->create(Array) 
#3 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\classes\class-ai.php(239): Oik_AI->chat('') 
#4 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\classes\class-ai.php(225): AI->get_response() 
#5 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\classes\class-ai.php(116): AI->perform_get_response() 
#6 C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\ai.php(26): AI->process_form() 
#7 {main} thrown in C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai\vendor\openai-php\client\src\Transporters\HttpTransporter.php on line 131

Looks like I need to have a better understanding of the models and how they can be used!

@bobbingwide
Copy link
Owner Author

"gpt-3.5-turbo" replied

The time 1706918400 corresponds to Sunday, January 1, 2024, at 12:00:00 AM (midnight) Coordinated Universal Time (UTC). It marks the beginning of a brand new year, offering endless possibilities and opportunities. As the world welcomes the first seconds of 2024, it is a time for reflection, goal setting, and looking forward to a future filled with hope and excitement.

In these early moments of the year, many people gather with loved ones, celebrating and making memories to last a lifetime. Fireworks light up the sky, symbolizing the burst of joy and enthusiasm that comes with fresh beginnings. It is a time to bid farewell to the past and embrace the unknown, with hearts filled with anticipation for what lies ahead.

As the clock strikes midnight, resolutions are made, inspiring individuals to embark on personal journeys of growth and self-improvement. Whether it's committing to healthier lifestyles, pursuing new passions, or nurturing relationships, the start of a new year provides an opportunity for positive change.

Nevertheless, beyond the revelry and celebrations, it's crucial to remember that every day is an opportunity for a fresh start. While the beginning of a new year holds a special significance, we can embrace growth and transformation at any moment, regardless of the date on the calendar. The key lies in our determination, perseverance, and belief in ourselves.

So, as we approach the time 1706918400, let's embrace the possibility of a new beginning, fueling our dreams and aspirations. May this moment mark the start of a remarkable year, filled with joy, success, and endless possibilities. Cheers to the year ahead, and the incredible journey it holds for all of us.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Feb 7, 2024

I tried the OpenAI Playground and created an Assistant.
Each time it gave the wrong answer. It was really frustrating. I told it the answers were rubbish.
It made an excuse blaming leap seconds.

I got 3 different dates.
UTC: Thursday, 1 June 2023
Time: 00:00:00

UTC: Thursday, 15 June 2024, 00:00:00

UTC: Saturday, 1 July 2024, 00:00:00

Don't forget ChatGPT 4 gets the answer right. It shows the Python code to do it.

Q. So what the heck is happening in the playground?

A. It seems I need to tell it to use Code interpreter

@bobbingwide
Copy link
Owner Author

With the Code interpreter toggled on, I got the result I wanted.

User: what time is 1706918400

code_interpreter

from datetime import datetime

unix_timestamp = 1706918400
utc_time = datetime.utcfromtimestamp(unix_timestamp)

utc_time

datetime.datetime(2024, 2, 3, 0, 0)

Dater:
The Unix timestamp 1706918400 corresponds to 00:00:00 (midnight) on February 3, 2024 in Coordinated Universal Time (UTC).

I tried with what date is 0 and got the right answer.

The Unix timestamp 0 corresponds to 00:00:00 (midnight) on January 1, 1970 in Coordinated Universal Time (UTC).

@bobbingwide
Copy link
Owner Author

bobbingwide commented Feb 8, 2024

It looks like I need to update OpenAI PHP Client to the latest level (v0.8.4) in order to get support for the Assistants and Threads, which was delivered in v0.8.1 ( 2023-12-22). Not quite sure why I didn't get that version in January!

See https://github.com/openai-php/client/blob/main/README.md#assistants-resource

@bobbingwide
Copy link
Owner Author

Not quite sure why I didn't get that version in January!

It would seem that I didn't update the OpenAI PHP client package correctly for the higher minor semantic version.

C:\apache\htdocs\wordpress\wp-content\plugins\oik-ai>composer require openai-php/client
./composer.json has been updated
Running composer update openai-php/client
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading openai-php/client (v0.7.10 => v0.8.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading openai-php/client (v0.8.4)
  - Upgrading openai-php/client (v0.7.10 => v0.8.4): Extracting archive
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^0.8.4 for openai-php/client

@bobbingwide
Copy link
Owner Author

I followed the Assistants overview step by step and eventually I was able to write a sequence of calls that resulted in the correct result. See the role: assistant message in data[0].

OpenAI\Responses\Threads\Messages\ThreadMessageListResponse Object
(
    [object] => list
    [data] => Array
        (
            [0] => OpenAI\Responses\Threads\Messages\ThreadMessageResponse Object
                (
                    [id] => msg_dS7nqzqKur5OUQBNAzIURHHk
                    [object] => thread.message
                    [createdAt] => 1707500899
                    [threadId] => thread_rmNHeSqBDy1lJyd2Vj4ZqMX7
                    [role] => assistant
                    [content] => Array
                        (
                            [0] => OpenAI\Responses\Threads\Messages\ThreadMessageResponseContentTextObject Object
                                (
                                    [type] => text
                                    [text] => OpenAI\Responses\Threads\Messages\ThreadMessageResponseContentText Object
                                        (
                                            [value] => The timestamp 1706918400 corresponds to February 3, 2024 at 00:00 (midnight).
                                            [annotations] => Array
                                                (
                                                )

                                        )

                                )

                        )

                    [assistantId] => asst_n9Mj1qqfaS4cX0XYE6VVhuB2
                    [runId] => run_symwJPgqVRLli5ypV3sWKInw
                    [fileIds] => Array
                        (
                        )

                    [metadata] => Array
                        (
                        )

                    [meta:OpenAI\Responses\Threads\Messages\ThreadMessageResponse:private] => OpenAI\Responses\Meta\MetaInformation Object
                        (
                            [requestId] => req_22ebbd8ecd12ba0e3cc9da1f6d19a04a
                            [openai] => OpenAI\Responses\Meta\MetaInformationOpenAI Object
                                (
                                    [model] =>
                                    [organization] => bobbingwide
                                    [version] => 2020-10-01
                                    [processingMs] => 88
                                )

                            [requestLimit] =>
                            [tokenLimit] =>
                        )

                )

            [1] => OpenAI\Responses\Threads\Messages\ThreadMessageResponse Object
                (
                    [id] => msg_7Mr4yb1mYXh5hCFGzxedNNjp
                    [object] => thread.message
                    [createdAt] => 1707500894
                    [threadId] => thread_rmNHeSqBDy1lJyd2Vj4ZqMX7
                    [role] => user
                    [content] => Array
                        (
                            [0] => OpenAI\Responses\Threads\Messages\ThreadMessageResponseContentTextObject Object
                                (
                                    [type] => text
                                    [text] => OpenAI\Responses\Threads\Messages\ThreadMessageResponseContentText Object
                                        (
                                            [value] => What time is 1706918400
                                            [annotations] => Array
                                                (
                                                )

                                        )

                                )

                        )

                    [assistantId] =>
                    [runId] =>
                    [fileIds] => Array
                        (
                        )

                    [metadata] => Array
                        (
                        )

                    [meta:OpenAI\Responses\Threads\Messages\ThreadMessageResponse:private] => OpenAI\Responses\Meta\MetaInformation Object
                        (
                            [requestId] => req_22ebbd8ecd12ba0e3cc9da1f6d19a04a
                            [openai] => OpenAI\Responses\Meta\MetaInformationOpenAI Object
                                (
                                    [model] =>
                                    [organization] => bobbingwide
                                    [version] => 2020-10-01
                                    [processingMs] => 88
                                )

                            [requestLimit] =>
                            [tokenLimit] =>
                        )

                )

        )

    [firstId] => msg_dS7nqzqKur5OUQBNAzIURHHk
    [lastId] => msg_7Mr4yb1mYXh5hCFGzxedNNjp
    [hasMore] =>
    [meta:OpenAI\Responses\Threads\Messages\ThreadMessageListResponse:private] => OpenAI\Responses\Meta\MetaInformation Object
        (
            [requestId] => req_22ebbd8ecd12ba0e3cc9da1f6d19a04a
            [openai] => OpenAI\Responses\Meta\MetaInformationOpenAI Object
                (
                    [model] =>
                    [organization] => bobbingwide
                    [version] => 2020-10-01
                    [processingMs] => 88
                )

            [requestLimit] =>
            [tokenLimit] =>
        )

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant