Update JsonAgent and ZeroShotAgent components
This commit is contained in:
parent
fa4a01caed
commit
d43d9d3760
2 changed files with 6 additions and 6 deletions
|
|
@ -3,7 +3,7 @@ from langchain.agents import AgentExecutor, create_json_agent
|
|||
from langflow.field_typing import (
|
||||
BaseLanguageModel,
|
||||
)
|
||||
from langchain_community.agent_toolkits.base import BaseToolkit
|
||||
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
||||
|
||||
|
||||
class JsonAgentComponent(CustomComponent):
|
||||
|
|
@ -19,6 +19,6 @@ class JsonAgentComponent(CustomComponent):
|
|||
def build(
|
||||
self,
|
||||
llm: BaseLanguageModel,
|
||||
toolkit: BaseToolkit,
|
||||
toolkit: JsonToolkit,
|
||||
) -> AgentExecutor:
|
||||
return create_json_agent(llm=llm, toolkit=toolkit)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from typing import List
|
||||
from typing import List, Optional
|
||||
|
||||
from langchain.agents import ZeroShotAgent
|
||||
from langchain.agents.mrkl.base import ZeroShotAgent
|
||||
from langchain_core.tools import BaseTool
|
||||
from langflow import CustomComponent
|
||||
from langflow.components.chains.LLMChain import LLMChain
|
||||
|
|
@ -21,8 +21,8 @@ class ZeroShotAgentComponent(CustomComponent):
|
|||
def build(
|
||||
self,
|
||||
llm: LLMChain,
|
||||
tools: List[BaseTool],
|
||||
tools: Optional[List[BaseTool]] = None,
|
||||
prefix: str = "Answer the following questions as best you can. You have access to the following tools:",
|
||||
suffix: str = "Begin!\n\nQuestion: {input}\nThought:{agent_scratchpad}",
|
||||
) -> ZeroShotAgent:
|
||||
return ZeroShotAgent(llm_chain=llm, tools=tools, prefix=prefix, suffix=suffix)
|
||||
return ZeroShotAgent(llm_chain=llm, allowed_tools=tools, prefix=prefix, suffix=suffix)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue