Class ChatReads

java.lang.Object
com.axelor.ai.chat.ChatReads

public final class ChatReads extends Object
What entered a chat, and whether a model may receive it.

A value the assistant was handed stays in the chat: the next turn sends the history again, perhaps to a model the user switched to, and so do the utility calls — a title, a summary. A chat therefore keeps the fields whose values entered it, and a model it goes to must be allowed to receive every one of them. Kept as fields, so the question is asked afresh each time, of the permissions and restrictions as they are then.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A model call refused for what the chat holds; the client offers a new chat for it.
    static final record 
    What a check of the chat's data against a request's model depends on: the fields that entered it, which are only ever added, so their count moves with them; the agents' permissions and the restrictions in force; and the model, with its provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    clears(String chatId, Access access)
    Whether the access's destination may receive everything that entered the chat.
    static String
    A refused consultation's output, for the calling model: the turn goes on without the consulted agent, so it says what happened and what to do, not what the user should.
    static String
    Why a consultation was refused, for the usage log: in the reader's language, as a turn's is.
    static long
    count(String chatId)
    How many fields entered the chat.
    of(String chatId)
    The fields whose values entered the chat.
    static void
    record(String chatId, Access access)
    Keeps the fields the access handed over in the chat.
    static String
    The refusal for a turn whose model may not receive what the chat holds.
    static void
    Refuses a model call whose model may not receive what the chat holds, logging it: checked before every call of a turn, not only its first, since a consulted agent on another model may have read data during the turn that the caller's model may not receive.
    stamp(ChatRequest request)
    The request's stamp: one count, the rules' own stamp, and the model's destination.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • record

      public static void record(String chatId, Access access)
      Keeps the fields the access handed over in the chat. Rows of their own, inserted only: the chat row is never written, whose concurrent writers already race. It is locked, though: two recorders of one chat would each find a field missing and both insert it, and the unique constraint would fail the second — a tool call whose writes had already committed among them.
      Parameters:
      chatId - the chat's id, or null for a call outside any chat, which keeps nothing
    • stamp

      public static ChatReads.Stamp stamp(ChatRequest request)
      The request's stamp: one count, the rules' own stamp, and the model's destination.
    • count

      public static long count(String chatId)
      How many fields entered the chat.
    • of

      public static List<Access.Read> of(String chatId)
      The fields whose values entered the chat.
    • clears

      public static boolean clears(String chatId, Access access)
      Whether the access's destination may receive everything that entered the chat. A model that no longer exists holds nothing back.
    • require

      public static void require(ChatRequest request)
      Refuses a model call whose model may not receive what the chat holds, logging it: checked before every call of a turn, not only its first, since a consulted agent on another model may have read data during the turn that the caller's model may not receive.
    • consultRefusal

      public static String consultRefusal()
      A refused consultation's output, for the calling model: the turn goes on without the consulted agent, so it says what happened and what to do, not what the user should. In the language the instructions are written in, as it stays in a transcript every member reads.
    • consultRefused

      public static String consultRefused()
      Why a consultation was refused, for the usage log: in the reader's language, as a turn's is.
    • refusal

      public static String refusal()
      The refusal for a turn whose model may not receive what the chat holds.