Package 

Interface LlmCallback


  • 
    public interface LlmCallback
    
                        

    Callback interface for Llama model. Users can implement this interface to receive the generated tokens and statistics.

    Warning: These APIs are experimental and subject to change without notice

    • Method Summary

      Modifier and Type Method Description
      abstract void onResult(String result) Called when a new result is available from JNI.
      void onStats(String stats) Called when the statistics for the generate() is available.
      • Methods inherited from class java.lang.Object

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

      • onResult

         abstract void onResult(String result)

        Called when a new result is available from JNI. Users will keep getting onResult() invocationsuntil generate() finishes.

        Parameters:
        result - Last generated token
      • onStats

         void onStats(String stats)

        Called when the statistics for the generate() is available.

        The result will be a JSON string. See extension/llm/stats.h for the field definitions.

        Parameters:
        stats - JSON string containing the statistics for the generate()