Package 

Interface AILocalModel


  • 
    public interface AILocalModel
    
                        

    A language model on the device, for answering when your AI agent can't: the person is offline, or the agent reached its usage limit.

    AIOnDeviceModel is Gemini Nano through ML Kit. Implement this interface to use another model.

    • Method Summary

      Modifier and Type Method Description
      abstract Boolean isAvailable() Whether the model can answer now.
      abstract Flow<String> reply(String instructions, List<AIConversationTurn> turns) Streams the answer to the last of turns, the person's question.
      • Methods inherited from class java.lang.Object

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

      • reply

         abstract Flow<String> reply(String instructions, List<AIConversationTurn> turns)

        Streams the answer to the last of turns, the person's question.

        Parameters:
        instructions - How the model should answer: who it is, what it can't do.
        turns - The conversation so far, oldest first, ending with the person's question.