fix: changed parameter name of agent component (#4992)

* Changed Add tool Current Date to only Current Date

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Lucas Oliveira 2024-12-05 17:03:08 -03:00 • committed by GitHub
commit dd6375978b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 909 additions and 331 deletions

View file

@ -1,11 +1,16 @@
from langchain_core.tools import StructuredTool from langchain_core.tools import StructuredTool
from langflow.base.agents.agent import LCToolsAgentComponent from langflow.base.agents.agent import LCToolsAgentComponent
from langflow.base.models.model_input_constants import ALL_PROVIDER_FIELDS, MODEL_PROVIDERS_DICT from langflow.base.models.model_input_constants import (
ALL_PROVIDER_FIELDS,
MODEL_PROVIDERS_DICT,
)
from langflow.base.models.model_utils import get_model_name from langflow.base.models.model_utils import get_model_name
from langflow.components.helpers import CurrentDateComponent from langflow.components.helpers import CurrentDateComponent
from langflow.components.helpers.memory import MemoryComponent from langflow.components.helpers.memory import MemoryComponent
from langflow.components.langchain_utilities.tool_calling import ToolCallingAgentComponent from langflow.components.langchain_utilities.tool_calling import (
ToolCallingAgentComponent,
)
from langflow.io import BoolInput, DropdownInput, MultilineInput, Output from langflow.io import BoolInput, DropdownInput, MultilineInput, Output
from langflow.schema.dotdict import dotdict from langflow.schema.dotdict import dotdict
from langflow.schema.message import Message from langflow.schema.message import Message
@ -47,7 +52,7 @@ class AgentComponent(ToolCallingAgentComponent):
*memory_inputs, *memory_inputs,
BoolInput( BoolInput(
name="add_current_date_tool", name="add_current_date_tool",
display_name="Add tool Current Date", display_name="Current Date",
advanced=True, advanced=True,
info="If true, will add a tool to the agent that returns the current date.", info="If true, will add a tool to the agent that returns the current date.",
value=True, value=True,
@ -103,7 +108,10 @@ class AgentComponent(ToolCallingAgentComponent):
display_name = component_class.display_name display_name = component_class.display_name
inputs = provider_info.get("inputs") inputs = provider_info.get("inputs")
prefix = provider_info.get("prefix", "") prefix = provider_info.get("prefix", "")
return self._build_llm_model(component_class, inputs, prefix), display_name return (
self._build_llm_model(component_class, inputs, prefix),
display_name,
)
except Exception as e: except Exception as e:
msg = f"Error building {self.agent_llm} language model" msg = f"Error building {self.agent_llm} language model"
raise ValueError(msg) from e raise ValueError(msg) from e

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long