Interface AiChatMessageFactory<T extends AiChatMessage>

Type Parameters:
T - the message type
All Superinterfaces:
Function<AiChatMessageContext,T>, Serializable
All Known Implementing Classes:
DefaultAiChatMessageFactory
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AiChatMessageFactory<T extends AiChatMessage> extends Function<AiChatMessageContext,T>, Serializable
Creates message instances of the application's type for AiChat. AiChat mints the user echo and the assistant response through this factory. In Jmix this is expected to be backed by Metadata.create.

A named Function rather than a bare one: everything it is given arrives in an AiChatMessageContext, so a value added later reaches every factory without changing this interface, and the type keeps a home for the persistence obligation below.

  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a message for the given context.

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Method Details

    • apply

      T apply(AiChatMessageContext context)
      Creates a message for the given context. The factory owns persistence: for an entity source it saves each attachment's bytes to file storage and sets the resulting FileRefs on the created message.
      Specified by:
      apply in interface Function<AiChatMessageContext,T extends AiChatMessage>
      Parameters:
      context - what is known about the message to create
      Returns:
      the created message