diff --git a/README.md b/README.md index d044073..716bf1d 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ For compatibility with other code, these environment variables are honoured: LANG: some handling of en_GB and en_US translating between then, fr_FR is a work in progress OPENADDR_HOME: directory of data from http://results.openaddresses.io/ REDIS_SERVER: ip:port pair of where to cache geo-coding data + OPENAI_KEY: experimental: uses key from openai.com to enhance text ## Reference diff --git a/gedcom b/gedcom index f0569be..f3c4a1e 100755 --- a/gedcom +++ b/gedcom @@ -350,6 +350,11 @@ if($opts{'v'}) { if($opts{'w'} || $opts{'B'} || $opts{'M'}) { push @modules, 'Mozilla::CA'; } + +if($ENV{'OPENAI_KEY'}) { + push @modules, 'OpenAIGPT4'; +} + if($opts{'w'} && $opts{'c'}) { # If you have a locally written module to look up entries, # list them in gedcom.config, @@ -905,6 +910,11 @@ if($opts{'w'}) { die if(!defined($wills)); } +my $gpt; +if(my $key = $ENV{'OPENAI_KEY'}) { + $gpt = OpenAIGPT4->new($key); +} + my $meteo; if($opts{'d'} && (!$opts{'r'}) && (!$opts{'O'})) { @@ -7854,7 +7864,11 @@ sub print_person $bio->append(conjunction(map { $_->as_string() } @phrases)); } } - print $bio->rtrim()->as_string(); + if($gpt) { + die 'TODO: ', $gpt->generate_text('Make this more readable ' . $bio->as_string(), 'gpt-3.5-turbo-1106'); + } else { + print $bio->rtrim()->as_string(); + } if($opts{'w'} && (my $dbpedia = dbpedia({ person => $person, birth_dt => $birth_dt, yob => $yob, yod => $yod, birth_country => $birth_country }))) { # FIXME: add citation if($opts{'B'}) {