Class AsyncResponse<T>

java.lang.Object
dev.langchain4j.agentic.internal.AsyncResponse<T>
All Implemented Interfaces:
DelayedResponse<T>

public class AsyncResponse<T> extends Object implements DelayedResponse<T>
  • Constructor Details

    • AsyncResponse

      public AsyncResponse(Supplier<T> responseSupplier)
  • Method Details

    • onComplete

      public void onComplete(Consumer<AsyncResponse<T>> onComplete)
      Passes this response to onComplete when it completes, successfully or not, on the thread completing it, or immediately on the calling thread when it already completed.
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface DelayedResponse<T>
    • isFailed

      public boolean isFailed()
    • reportFailureOnce

      public boolean reportFailureOnce()
      Returns true only the first time it is called on a response that failed, so that a failure is reported once, also when the response stays in a scope where several root calls end.
    • blockingGet

      public T blockingGet()
      Specified by:
      blockingGet in interface DelayedResponse<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object