use v6.d;

# use lib <. lib>;

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

use Test;

plan *;

## 1
ok llm-configuration('openai');

## 2
my $prompt2 = "Make a recipe for the given phrase.";
ok ($prompt2 ==> llm-function(llm-evaluator => llm-configuration('openai') ))("greek salad");

## 3
ok ($prompt2 ==> llm-function(llm-evaluator => 'openai'))("greek salad");

## 4
my $prompt3 = 'Write a tragical-comical short story with no more than 40 words.';
ok ($prompt3 ==> llm-function(llm-evaluator => 'openai'))();

## 5
my $res = llm-synthesize(['Give the GDP of the top 10 countries in 2020. Give the results as a JSON dictionary.'], e=>'chatgpt', form => sub-parser('JSON'):drop);
is
        $res ~~ Map:D || $res ~~ (Array:D | List:D) && $res.all ~~ (Pair:D | Numeric:D),
        True,
        'expected result from JSON dictionary reequest';

done-testing;
