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.
      abstract void onStats(float tps) 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

         abstract void onStats(float tps)

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

        Parameters:
        tps - Tokens/second for generated tokens.