Interface LangChain4jManaged
- All Known Subinterfaces:
AgenticScope
- All Known Implementing Classes:
AgentModelResponse, CurrentPlanningContext, DefaultAgenticScope
public interface LangChain4jManaged
A marker interface for components that are managed by LangChain4j framework.
Implementing this interface indicates that the component is internally managed by LangChain4j, and doesn't require to be instatiated or passed around by the user or LLM.
- Since:
- 1.8.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ThreadLocal<Map<Class<? extends LangChain4jManaged>, LangChain4jManaged>> -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic Map<Class<? extends LangChain4jManaged>, LangChain4jManaged> current()static <T extends LangChain4jManaged>
Tstatic voidstatic voidrestore(@Nullable Map<Class<? extends LangChain4jManaged>, LangChain4jManaged> previous) Binds to the current thread the managed components it had before they were replaced, or none if it had none.static voidsetCurrent(Map<Class<? extends LangChain4jManaged>, LangChain4jManaged> current)
-
Field Details
-
CURRENT
-
-
Method Details
-
setCurrent
-
current
-
current
-
removeCurrent
static void removeCurrent() -
restore
static void restore(@Nullable Map<Class<? extends LangChain4jManaged>, LangChain4jManaged> previous) Binds to the current thread the managed components it had before they were replaced, or none if it had none. A component replacing them with its own for the time of a call can itself be called from inside another AI service call, for instance by one of its tools: so it reads the ones of its caller first, withcurrent(), and puts them back with this method when it is done, instead of leaving the thread without any.- Parameters:
previous- the components returned bycurrent()before the replacement, ornullif it returned none, in which case the thread is left without any
-