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 => 'openai');
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.kv -> $k, $t {
    say "## ", $k + 1;
    say "{'`' x 3}\n$t\n{'`' x 3}\n\n";
    say &testNarrator($t);
    say "\n\n"
}

LLM::Functions v0.5.10

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+>Hash::Merge:ver<2.0.0+>:api<2+>JSON::Fast:ver<0.20+>Text::SubParsers:ver<0.1.1+>WWW::Gemini:ver<0.0.25+>WWW::LLaMA:ver<0.1.3+>WWW::MistralAI:ver<0.1.3+>WWW::OpenAI:ver<0.3.18+>WWW::Ollama:ver<0.0.7+>WWW::OpenRouter:ver<0.0.1+>

Provides

  • LLM::Function
  • LLM::Functions
  • LLM::Functions::Chat
  • LLM::Functions::Configuration
  • LLM::Functions::Evaluator
  • LLM::Functions::EvaluatorChat
  • LLM::Functions::EvaluatorChatGemini
  • LLM::Functions::EvaluatorChatPaLM
  • LLM::Functions::Tooled
  • LLM::Functions::TooledChatGPT
  • LLM::Functions::TooledGemini
  • LLM::Tooling

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

Built with Podlite — the markup and publishing tools behind this site.