Refactor JsonAgentComponent to use create_json_agent function
This commit is contained in:
parent
6290837d15
commit
f322c77c5c
1 changed files with 3 additions and 5 deletions
|
|
@ -1,12 +1,10 @@
|
|||
|
||||
from langflow import CustomComponent
|
||||
from langchain.agents import AgentExecutor
|
||||
from typing import Callable
|
||||
from langchain.agents import AgentExecutor,create_json_agent
|
||||
from langflow.field_typing import (
|
||||
BaseLanguageModel,
|
||||
)
|
||||
from langchain_community.agent_toolkits.base import BaseToolkit
|
||||
|
||||
class JsonAgentComponent(CustomComponent):
|
||||
display_name = "JsonAgent"
|
||||
description = "Construct a json agent from an LLM and tools."
|
||||
|
|
@ -21,5 +19,5 @@ class JsonAgentComponent(CustomComponent):
|
|||
self,
|
||||
llm: BaseLanguageModel,
|
||||
toolkit: BaseToolkit,
|
||||
) -> Callable:
|
||||
return AgentExecutor(llm=llm, toolkit=toolkit)
|
||||
) -> AgentExecutor:
|
||||
return create_json_agent(llm=llm, toolkit=toolkit[0])
|
||||
Loading…
Add table
Add a link
Reference in a new issue