distill method

Future<String> distill({
  1. required String input,
  2. required String header,
  3. String prompt = """ Your job is to distill all of the information in the content provided into a clean concise representation of the information without any loss of meaning. * Strip out formatting, special characters, and other non-essential information. I.e. strip out json keys and just represent the information in written way. * If the content has a lot of diacritics (OCR errors), do your best to make sense of them or correct them, if unsure, keep them as they are * Only output the response, this is not a chat, do not include any extra commentary or formatting. """,
})

Implementation

Future<String> distill({
  required String input,
  required String header,
  String prompt = """
Your job is to distill all of the information in the content provided into a clean concise representation of the information without any loss of meaning.
* Strip out formatting, special characters, and other non-essential information. I.e. strip out json keys and just represent the information in written way.
* If the content has a lot of diacritics (OCR errors), do your best to make sense of them or correct them, if unsure, keep them as they are
* Only output the response, this is not a chat, do not include any extra commentary or formatting.
        """,
}) async {
  Agent agent = Agent(
    user: organization,
    llm: llm,
    chatProvider: MemoryChatProvider(
      messages: [
        Message.system(prompt.trim()),
        Message.user("$header\n\n${input.trim()}".trim()),
      ],
    ),
  );

  AgentMessage r = await agent();
  return r.content.toString();
}