### ----------------------------------------------------
### -- LLM::Prompts
### -- Licenses: Artistic-2.0
### -- Authors: Anton Antonov
### -- File: t/03-prompt-expand.rakutest
### ----------------------------------------------------
use v6.d;
use Test;

use LLM::Prompts;


## 1
is
        llm-prompt-expand('This is a simple prompt'),
        'This is a simple prompt';

## 2
my $spec2 = q:to/END/;

 @Yoda
END

is
        llm-prompt-expand($spec2).chomp,
        llm-prompt('Yoda').chomp;

## 3
my $spec3 = q:to/END/;
!Translated|German
END

is
        llm-prompt-expand($spec3).chomp,
        llm-prompt('Translated')('German').chomp;

## 4
is
        llm-prompt-expand('@Yoda The summer is gone.'),
        llm-prompt('Yoda') ~ "\n The summer is gone.";

## 5
is
        llm-prompt-expand('@CodeWriterX|HTML Random table with 5 rows and 4 columns.'),
        llm-prompt('CodeWriterX')('HTML') ~ "\n Random table with 5 rows and 4 columns.";

## 6
my $spec5 = 'The summer is gone, school is coming soon.';
is
        llm-prompt-expand("$spec5 #HaikuStyled"),
        $spec5 ~ ' ' ~ llm-prompt('HaikuStyled');

## 7
is
        llm-prompt-expand("$spec5 #HaikuStyled #Translated"),
        $spec5 ~ ' ' ~ llm-prompt('HaikuStyled') ~ "\n " ~ llm-prompt('Translated').();

## 8
is
        llm-prompt-expand("$spec5 #HaikuStyled #Translated|German"),
        $spec5 ~ ' ' ~ llm-prompt('HaikuStyled') ~ "\n " ~ llm-prompt('Translated')('German');

## 9
is
        llm-prompt-expand("Generate a scary story. #ShortLineIt|50"),
        'Generate a scary story. ' ~ llm-prompt('ShortLineIt')(50);

## 10
is
        llm-prompt-expand("Generate a scary story. #ShortLineIt|50|text"),
        'Generate a scary story. ' ~ llm-prompt('ShortLineIt')(50, 'text');

## 11
is
        llm-prompt-expand("&Translated|Russian $spec5"),
        llm-prompt('Translated')('Russian') ~ "\n " ~ $spec5;

## 12
is
        llm-prompt-expand("!Translated|'High German' $spec5"),
        llm-prompt('Translated')('High German') ~ "\n " ~ $spec5;

## 13
my $spec8 = 'The cat chased the mouse.';
is
        llm-prompt-expand("!FormalRephrase $spec8"),
        llm-prompt('FormalRephrase')($spec8);

## 14
is
        llm-prompt-expand("!FormalRephrase>$spec8"),
        llm-prompt('FormalRephrase')($spec8);

## 15
my @messages12 = <some1 some2>;
is
        llm-prompt-expand("\n\n!FormalRephrase^\n\n", messages => @messages12),
        llm-prompt('FormalRephrase')('some2');

## 16
is
        llm-prompt-expand("&FormalRephrase^^", messages => @messages12, sep => "\n;;\n"),
        llm-prompt('FormalRephrase')(@messages12.join("\n;;\n"));

## 17
is
        llm-prompt-expand("\n\n!ShortLineIt>  40"),
        llm-prompt('ShortLineIt')('  40');

## 18
is
        llm-prompt-expand("\n\n!ShortLineIt|40 some long text"),
        llm-prompt('ShortLineIt')(40, 'some long text');


## 19
my @messages19 = <tomorrow future>;
is
        llm-prompt-expand("\n\n!Translate|German^\n\n", messages => @messages19),
        llm-prompt('Translate')('German', 'future');

done-testing;


