use v6.d;

# use lib <. lib>;

use LLM::Functions;
use Text::SubParsers;

use Test;

plan *;

## 1
ok llm-example-function(<finger hand> => <hand arm>, llm-evaluator => 'ChatPaLM')('foot');

## 2
isa-ok llm-example-function('<| A->3, 4->K1 |>' => '{ A:3, 4:K1 }')('<| 23->3, G->33, T -> R5|>', e => 'ChatPaLM'), Str;

## 3
is-deeply
        llm-example-function(
                '<| A->3, 4->K1 |>' => '{ "A":3, "4":"K1" }',
                form => sub-parser('JSON', :!drop), e => 'PaLM')('<| 23->3, G->33, T -> R5|>'),
        ${"23" => 3, :G(33), :T("R5")};

## 4
my $evlr4 = LLM::Functions::EvaluatorChatPaLM.new(conf => llm-configuration('ChatPaLM'));
is-deeply
        llm-example-function(
                '<| A->3, 4->K1 |>' => '{ "A":3, "4":"K1" }',
                form => sub-parser('JSON', :!drop), e => $evlr4)('<| 23->3, G->33, T -> R5|>'),
        ${"23" => 3, :G(33), :T("R5")};


## 5
isa-ok
        llm-example-function(
                { "crocodile" => "grasshopper", "fox" => "cardinal" },
                hint => 'You are a predictor of animal colors. Use as few words as possible.', e => 'ChatPaLM')('raccoon'),
        Str;

## 6
like llm-example-function(((1 .. 4) Z=> 11 «*« (1 .. 4)), e => 'ChatPaLM')(8).trim, / 8 8+ / ;

## 7
is llm-example-function(((1 .. 4) Z=> 11 «*« (1 .. 4)), e => $evlr4, form => { $_.trim.Int })(8), 88;

done-testing;
