in reply to Re^3: Artificial Intelligence with Perl in 2023
in thread Artificial Intelligence with Perl in 2023

Yes. $chat->success() is true in the following. But $reply is undef.

It's probably because I haven't properly set up my openai account. I got the api key but I probably need to give it my credit card or something.

The following

my $chat = AI::Chat->new(%h); $chat->success() or die sprintf "error 1: %s\n", $chat->error(); print "$chat\n"; my $reply = $chat->prompt($prompt, $TEMP); $chat->success() or die sprintf "error 2: %s\n", $chat->error(); defined $reply or die sprintf "error 3: %s\n", $chat->error();
prints:
AI::Chat=HASH(0xa0042da30) error 3:

Replies are listed 'Best First'.
Re^5: Artificial Intelligence with Perl in 2023
by Bod (Parson) on Mar 03, 2024 at 21:16 UTC

    I've just uploaded version 0.2 to CPAN

    This new version has a new debug parameter. When this is true, the prompt method returns the full error if there is one instead of under.

      Yep, debug=>1 told me "You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.".

      It looks like it did give me the $18 when I first created a chatGPT account over a year ago, but I think that had an expiration date if not used.

        It looks like it did give me the $18 when I first created a chatGPT account over a year ago, but I think that had an expiration date if not used

        Yes, my $18 credit expired before I got the opportunity to use very much of it at all!

        It looks like it did give me the $18 when I first created a chatGPT account...

        OpenAI has changed its pricing method for small-scale users.

        Instead of lodging a payment card with them and them charging it, you now buy credits and it uses those instead. The minimum purchase is $5 and they last for 1 year. This seems better for anyone experimenting as the cost is limited.

        It looks like it did give me the $18 when I first created a chatGPT account

        OpenAI's GPT-4o-mini model is significantly cheaper than previous models - they also claim it does a better job which seems to be correct in the use cases we put it to. However, being non-deterministic, it's quite difficult to objectively test...

        I have an AI language partner that has conversations with me in Turkish and corrects any major mistakes I make. We also have a summary of the needs of a dog coming into our care for my partner's business Pawsies. In both of these cases, GPT-4o-mini produces better results.

        Today I've released an updated version of AI::Chat to CPAN that uses GPT-4o-mini by default instead of GPT-3.5-Turbo-0125.

        Whether or not it's better, it's definitely cheaper. Within On Radar, our customers are doing more things that result in an API call, but our costs are decreasing.

Re^5: Artificial Intelligence with Perl in 2023
by Bod (Parson) on Mar 03, 2024 at 20:45 UTC
    I got the api key but I probably need to give it my credit card or something

    When I set up our API key, I got $18 credit. I'm not sure if you still do as it was quite a while since I got the key.

    The API calls are not costly. Most requests to the chat API come in at under $0.01.