Class ContextLocals

java.lang.Object
io.quarkiverse.langchain4j.runtime.ContextLocals

public final class ContextLocals extends Object
  • Method Details

    • get

      public static <T> T get(String key)
      Gets the value from the context local associated with the given key. If there is no associated value or there is no duplicated context, it returns null
      Parameters:
      key - the key, must not be null
    • put

      public static <T> void put(String key, T value)
      Stores the given key/value in the context local. This method overwrite the existing value if any. If there is no duplicated context, the method does nothing
      Type Parameters:
      T - the expected type of the associated value
      Parameters:
      key - the key, must not be null
      value - the value, must not be null
    • remove

      public static boolean remove(String key)
      Removes the value associated with the given key from the context locals. If there is no associated value or there is no duplicated context, it returns false
      Parameters:
      key - the key, must not be null
      Returns:
      true if there were a value associated with the given key. false otherwise.
    • duplicatedContextActive

      public static boolean duplicatedContextActive()