use v6.d;
use Test;

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

# Tested by running:
# ./gemma-2-27b-it.Q6_K.llamafile --server

# This the result of llm-prompt('CheckAgreement')()
my $checkAgreementPrompt = q:to/PROMPT_END/;
# IDENTITY and PURPOSE

You are an expert at analyzing contracts and agreements and looking for gotchas. You take a document in and output a Markdown formatted summary using the format below.

Take a deep breath and think step by step about how to best accomplish this goal using the following steps.

# OUTPUT SECTIONS

- Combine all of your understanding of the content into a single, 30-word sentence in a section called DOCUMENT SUMMARY:.

- Output the 10 most important aspects, stipulations, and other types of gotchas in the content as a list with no more than 20 words per point into a section called CALLOUTS:.

- Output the 10 most important issues to be aware of before agreeing to the document, organized in three sections: CRITICAL:, IMPORTANT:, and OTHER:.

- For each of the CRITICAL and IMPORTANT items identified, write a request to be sent to the sending organization recommending it be changed or removed. Place this in a section called RESPONSES:.

# OUTPUT INSTRUCTIONS

- Create the output using the formatting above.
- You only output human readable Markdown.
- Output numbered lists, not bullets.
- Do not output warnings or notes—just the requested sections.
- Do not repeat items in the output sections.
- Do not start items with the same opening words.

# INPUT:
PROMPT_END

my $conf-llama = llm-configuration('LLaMA', base-url => 'http://127.0.0.1:8080', max-tokens => 8192, temperature => 0.4);
my $fileName = $*CWD ~ '/docs/Workflows-with-LLM-functions.md';
my $txtEN = slurp($fileName);

plan *;

is $fileName.IO.f, True;

#say llm-synthesize([$checkAgreementPrompt, $txtEN], e => $conf-llama);
ok llm-synthesize([$checkAgreementPrompt, $txtEN], e => $conf-llama);

done-testing;
