AI-Chat
view release on metacpan or search on metacpan
lib/AI/Chat.pm view on Meta::CPAN
use AI::Chat;
my $chat = AI::Chat->new(
key => 'your-api-key',
api => 'OpenAI',
model => 'gpt-4o-mini',
);
my $reply = $chat->prompt("What is the meaning of life?");
print $reply;
=head1 DESCRIPTION
This module provides a simple interface for interacting with AI Chat APIs,
currently supporting OpenAI.
The AI chat agent can be given a I<role> and then passed I<prompts>. It will
reply to the prompts in natural language. Being AI, the responses are
non-deterministic, that is, the same prompt will result in diferent responses
on different occasions.
t/00-load.t view on Meta::CPAN
#!perl
use 5.006;
use strict;
use warnings;
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'AI::Chat' ) || print "Bail out!\n";
}
diag( "Testing AI::Chat $AI::Chat::VERSION, Perl $], $^X" );
( run in 1.271 second using v1.01-cache-2.11-cpan-de7293f3b23 )