Tuesday, March 14, 2023

Re: NEW: devel/p5-OpenAI-API

I missed the update, thanks!

A single line added to the Makefile seems useful of 'make test' is to succeed:

TEST_DEPENDS= devel/p5-Test-RequiresInternet

Otherwise, still works with https://github.com/toddfries/coai so ..

New version p5-OpenAI-API,4.tgz attached.

Thanks,

Penned by Mikolaj Kucharski on 20230312 5:09.32, we have:
| Hi,
|
| I took p5-OpenAI-API,2.tgz from Stuart and update OpenAI::API to 0.25
| which I saw in CPAN.
|
| Port changes:
| - version bumped to 0.25
| - new dependencies added
| - plist updated
| - checksums regenerated via makesum
|
| New version p5-OpenAI-API,3.tgz attached.
|
| I did simple test via:
|
|
| ---8<---
| #!/usr/bin/perl
|
| use warnings;
| use strict;
| use OpenAI::API;
|
| use Data::Dumper;
| $Data::Dumper::Terse = 1;
| $Data::Dumper::Indent = 1;
| $Data::Dumper::Sortkeys = 1;
|
| open(my $fh, '<', 'key.conf') or die $!;
| my $key = <$fh>;
| close($fh) or die $!;
|
| chomp $key;
|
| my $ai = OpenAI::API->new(api_key => $key);
| print Dumper($ai->models());
|
| print Dumper($ai->chat(model => 'gpt-3.5-turbo',
| messages => [ { 'role' => 'user', 'content' => 'What is OpenBSD?' }, ]));
| --->8---
|
|
| and I got some data back. Didn't had time to look into it more, but I guess
| it works?
|
|
|
| On Mon, Feb 27, 2023 at 12:01:00PM +0000, Stuart Henderson wrote:
| > On 2023/02/25 17:36, Todd T. Fries wrote:
| > > Penned by Stuart Henderson on 20230221 9:37.50, we have:
| > > | On 2023/02/20 15:14, Todd T. Fries wrote:
| > > | > This is not used by anything, yet.
| > > | >
| > > | > Comment:
| > > | > A Perl module for accessing the OpenAI API
| > > |
| > > | s/A //
| > > |
| > > | > Feedback? If OK, please commit, I don't have commit access since
| > > | > I fell off the radar.
| > > |
| > > | There's no attachment.
| > >
| > > Getting back into the swing is hard. Or probably I just goofed. Here ya go, with the above
| > > suggestion!
| > > --
| > > Todd T. Fries . http://todd.fries.net/pgp.txt . @unix2mars . github:toddfries
| >
| > Tweaked version (tar attached) is OK with me if someone would like to
| > commit. (I've only built and run "make test", I have no interest in
| > signing up for an api key). I'll comment on the changes inline:
| >
| > : diff --git devel/p5-OpenAI-API/Makefile devel/p5-OpenAI-API/Makefile
| > : index 9d33fb2..9025886 100644
| > : --- devel/p5-OpenAI-API/Makefile
| > : +++ devel/p5-OpenAI-API/Makefile
| > : @@ -1,24 +1,16 @@
| > : -# : Makefile,v 1.2 2005/12/01 22:37:28 steven Exp $
| > : -
| >
| > the main part of the ports tree is not using RCS IDs any more (only
| > for infrastructure)
| >
| > : COMMENT= Perl module for accessing the OpenAI API
| > :
| > : MODULES= cpan
| > : -VER= 0.07
| > : -DISTNAME= OpenAI-API-${VER}
| > : -PKGNAME= p5-${DISTNAME}
| > : -CATEGORIES= devel perl5
| > : +DISTNAME= OpenAI-API-0.07
| > : +CATEGORIES= devel
| >
| > simplify, the p5- prefix and 'perl' CATEGORIES are added automatically
| > by MODULES=cpan.
| >
| > : CPAN_AUTHOR= NFERRAZ
| > :
| > : MAINTAINER= Todd T. Fries <todd@fries.net>
| > :
| > : # Artistic
| > : -PERMIT_PACKAGE= Yes
| > : -PERMIT_DISTFILES= Yes
| > : +PERMIT_PACKAGE= Yes
| >
| > PERMIT_DISTFILES is defaulted to Yes if PERMIT_PACKAGE is set.
| >
| > : -RUN_DEPENDS+= ${BUILD_DEPENDS}
| > : -BUILD_DEPENDS+= www/p5-libwww \
| > : +RUN_DEPENDS= www/p5-libwww \
| > : converters/p5-JSON-MaybeXS
| >
| > although in this case it makes no difference, often there are some
| > 'hidden' build dependencies (for example, Module::Build for a perl port
| > using CONFIGURE_STYLE=modbuild, or autoconf etc for some other ports),
| > so avoid setting it this way round.
| >
| > if you need this, do it the other way round instead,
| > BUILD_DEPENDS=${RUN_DEPENDS}, this is less likely to pollute the run deps.
| > but in this port the build dep isn't doing much; just avoids a warning
| > at build time. if it were a port with a more complex set of dependencies
| > I might argue to keep listing them as BUILD_DEPENDS to make it easier
| > to check updates, but in this case it's a short list and easy to check
| > by hand.
| >
| > :
| > : -CONFIGURE_STYLE= perl
| > : -
| >
| > already set by MODULES=cpan
| >
| > : .include <bsd.port.mk>
| > : diff --git devel/p5-OpenAI-API/pkg/DESCR devel/p5-OpenAI-API/pkg/DESCR
| > : index 004d87e..413129c 100644
| > : --- devel/p5-OpenAI-API/pkg/DESCR
| > : +++ devel/p5-OpenAI-API/pkg/DESCR
| > : @@ -1 +1,7 @@
| > : -Perl module for accessing the OpenAI API
| > : +OpenAI::API is a Perl module that provides an interface to the OpenAI
| > : +API, which allows you to generate text, translate languages, summarize
| > : +text, and perform other tasks using the language models developed by
| > : +OpenAI.
| > : +
| > : +To use the OpenAI::API module, you will need an API key, which you can
| > : +obtain by signing up for an account on the OpenAI website.
| >
| > if possible DESCR should have a bit more in than just a copy of COMMENT.
| >
|
| --
| Regards,
| Mikolaj



--
Todd T. Fries todd@fries.net twitter:@unix2mars github:toddfries pgp:3F42004A

No comments:

Post a Comment