Package com.hw.langchain.agents.agent
Class BaseSingleActionAgent
java.lang.Object
com.hw.langchain.agents.agent.BaseSingleActionAgent
- Direct Known Subclasses:
Agent
Base Agent class.
- Author:
- HamaWhite
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BaseSingleActionAgent
fromLLMAndTools
(BaseLanguageModel llm, List<BaseTool> tools, Map<String, Object> kwargs) Return the input keys.abstract AgentResult
plan
(List<org.apache.commons.lang3.tuple.Pair<AgentAction, String>> intermediateSteps, Map<String, Object> kwargs) Given input, decided what to do.returnStoppedResponse
(String earlyStoppingMethod, List<org.apache.commons.lang3.tuple.Pair<AgentAction, String>> intermediateSteps, Map<String, ?> kwargs) Return response when agent has been stopped due to max iterations.
-
Constructor Details
-
BaseSingleActionAgent
public BaseSingleActionAgent()
-
-
Method Details
-
inputKeys
Return the input keys. -
returnValues
-
plan
public abstract AgentResult plan(List<org.apache.commons.lang3.tuple.Pair<AgentAction, String>> intermediateSteps, Map<String, Object> kwargs) Given input, decided what to do.- Parameters:
intermediateSteps
- Steps the LLM has taken to date, along with observationskwargs
- User inputs.- Returns:
- Action specifying what tool to use.
-
fromLLMAndTools
public static BaseSingleActionAgent fromLLMAndTools(BaseLanguageModel llm, List<BaseTool> tools, Map<String, Object> kwargs) -
returnStoppedResponse
public AgentFinish returnStoppedResponse(String earlyStoppingMethod, List<org.apache.commons.lang3.tuple.Pair<AgentAction, String>> intermediateSteps, Map<String, ?> kwargs) Return response when agent has been stopped due to max iterations. -
toolRunLoggingKwargs
-