From bbaec2b8daca36efebfcccb9c9f8d453e6c785a6 Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Mon, 11 Nov 2024 22:03:44 -0500 Subject: [PATCH] fix: adding info to Agent and related components (#4495) * info added * Update openai.py update to Open AI model info * info changed * Update tool_calling.py made info of LLM much simpler * info updated to be simpler * Update agent.py --- src/backend/base/langflow/base/agents/agent.py | 10 ++++------ .../base/langflow/components/agents/agent.py | 3 ++- .../langchain_utilities/tool_calling.py | 16 ++++++++++++++-- .../base/langflow/components/models/openai.py | 7 ++++++- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/backend/base/langflow/base/agents/agent.py b/src/backend/base/langflow/base/agents/agent.py index 63eacc3fd..0c4b2b3da 100644 --- a/src/backend/base/langflow/base/agents/agent.py +++ b/src/backend/base/langflow/base/agents/agent.py @@ -44,18 +44,15 @@ class LCAgentComponent(Component): display_name="Handle Parse Errors", value=True, advanced=True, + info="Should the Agent fix errors when reading user input for better processing?", ), - BoolInput( - name="verbose", - display_name="Verbose", - value=True, - advanced=True, - ), + BoolInput(name="verbose", display_name="Verbose", value=True, advanced=True), IntInput( name="max_iterations", display_name="Max Iterations", value=15, advanced=True, + info="The maximum number of attempts the agent can make to complete its task before it stops.", ), MultilineInput( name="agent_description", @@ -187,6 +184,7 @@ class LCToolsAgentComponent(LCAgentComponent): input_types=["Tool", "BaseTool", "StructuredTool"], is_list=True, required=True, + info="These are the tools that the agent can use to help with tasks.", ), *LCAgentComponent._base_inputs, ] diff --git a/src/backend/base/langflow/components/agents/agent.py b/src/backend/base/langflow/components/agents/agent.py index c7f9500f7..83a657679 100644 --- a/src/backend/base/langflow/components/agents/agent.py +++ b/src/backend/base/langflow/components/agents/agent.py @@ -28,6 +28,7 @@ class AgentComponent(ToolCallingAgentComponent): DropdownInput( name="agent_llm", display_name="Model Provider", + info="The provider of the language model that the agent will use to generate responses.", options=[*sorted(MODEL_PROVIDERS_DICT.keys()), "Custom"], value="OpenAI", real_time_refresh=True, @@ -37,7 +38,7 @@ class AgentComponent(ToolCallingAgentComponent): MultilineInput( name="system_prompt", display_name="Agent Instructions", - info="Initial instructions and context provided to guide the agent's behavior.", + info="System Prompt: Initial instructions and context provided to guide the agent's behavior.", value="You are a helpful assistant that can use tools to answer questions and perform tasks.", advanced=False, ), diff --git a/src/backend/base/langflow/components/langchain_utilities/tool_calling.py b/src/backend/base/langflow/components/langchain_utilities/tool_calling.py index 92b169a9e..f2c16e66a 100644 --- a/src/backend/base/langflow/components/langchain_utilities/tool_calling.py +++ b/src/backend/base/langflow/components/langchain_utilities/tool_calling.py @@ -15,14 +15,26 @@ class ToolCallingAgentComponent(LCToolsAgentComponent): inputs = [ *LCToolsAgentComponent._base_inputs, - HandleInput(name="llm", display_name="Language Model", input_types=["LanguageModel"], required=True), + HandleInput( + name="llm", + display_name="Language Model", + input_types=["LanguageModel"], + required=True, + info="Language model that the agent utilizes to perform tasks effectively.", + ), MessageTextInput( name="system_prompt", display_name="System Prompt", info="Initial instructions and context provided to guide the agent's behavior.", value="You are a helpful assistant that can use tools to answer questions and perform tasks.", ), - DataInput(name="chat_history", display_name="Chat Memory", is_list=True, advanced=True), + DataInput( + name="chat_history", + display_name="Chat Memory", + is_list=True, + advanced=True, + info="This input stores the chat history, allowing the agent to remember previous conversations.", + ), ] def get_chat_history_data(self) -> list[Data] | None: diff --git a/src/backend/base/langflow/components/models/openai.py b/src/backend/base/langflow/components/models/openai.py index f4a8be80f..63d999a4b 100644 --- a/src/backend/base/langflow/components/models/openai.py +++ b/src/backend/base/langflow/components/models/openai.py @@ -27,7 +27,12 @@ class OpenAIModelComponent(LCModelComponent): info="The maximum number of tokens to generate. Set to 0 for unlimited tokens.", range_spec=RangeSpec(min=0, max=128000), ), - DictInput(name="model_kwargs", display_name="Model Kwargs", advanced=True), + DictInput( + name="model_kwargs", + display_name="Model Kwargs", + advanced=True, + info="Additional keyword arguments to pass to the model.", + ), BoolInput( name="json_mode", display_name="JSON Mode",