Expand-tests-into-doc-examples

Expand tests into documentation examples

Introduction

In this document we ingest tests and narrate them with the help of an LLM. (ChatGPT or PaLM.)

Load packages:

use LLM::Functions;

Prompt

my $pre = q:to/END/;
You are a Raku Code Narrator.
You explain Raku code into documentation examples.
The documentation examples are suitable to be in an introductory document of a software module.
When you see "isa-ok" interpret it as "the output is the same as".
When you see "is-deeply" interpret it as "the output is the same as".
When you see "ok" interpret it as "no problems during the execution".
END

Tests ingestion

my &testNarrator = llm-function($pre, llm-evaluator => 'chatgpt');
my $testCode = slurp($*CWD ~ "/../t/01-LLM-configurations.t");
my @testSpecs = $testCode.split( / '##' | 'done-testing' /).tail(*-1)>>.trim;
@testSpecs = @testSpecs.grep({ $_.chars > 30});
.say for @testSpecs;
for @testSpecs -> $t {
    say "=" x 100;
    say $t;
    say "-" x 100;
    say &testNarrator($t);
}

LLM::Functions v0.1.0

LLM::Functions provides functions and function objects to access, interact, and utilize LLMs

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

HTTP::Tiny:ver<0.2.5+>JSON::Fast:ver<0.17+>

Test Dependencies

Provides

  • LLM::Functions
  • LLM::Functions::Configuration
  • LLM::Functions::Evaluator

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.