Class AiDataEnvelope

java.lang.Object
com.kingsrook.qqq.backend.core.actions.ai.output.AiDataEnvelope

public class AiDataEnvelope extends Object
Wraps tool output (JSON text) in the data envelope the assistant's system prompt declares as untrusted data: {...} Any opening or closing qqq_data tag inside the data (e.g., injected into a record's text by a user) is neutralized by replacing its "<" with the JSON escape for that character - which keeps the JSON valid and equal in value, but means the text can no longer close (or open) an envelope.
  • Field Details

  • Constructor Details

    • AiDataEnvelope

      public AiDataEnvelope()
  • Method Details

    • wrap

      public static String wrap(String source, String table, String json)
      Wrap JSON data from a tool (source) - about a table (which may be null).
    • neutralize

      public static String neutralize(String json)
      Neutralize any qqq_data tags in JSON text.