fix: tool name change (#8302)
* tool name changes * tool name changes * revert URL * reset structured output * [autofix.ci] apply automated fixes * fix test make_api_request name * change tool name test --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
da3542e901
commit
80c6897c93
20 changed files with 43 additions and 28 deletions
|
|
@ -12,7 +12,9 @@ from langflow.base.models.model_utils import get_model_name
|
|||
from langflow.components.helpers import CurrentDateComponent
|
||||
from langflow.components.helpers.memory import MemoryComponent
|
||||
from langflow.components.langchain_utilities.tool_calling import ToolCallingAgentComponent
|
||||
from langflow.custom.custom_component.component import _get_component_toolkit
|
||||
from langflow.custom.utils import update_component_build_config
|
||||
from langflow.field_typing import Tool
|
||||
from langflow.io import BoolInput, DropdownInput, MultilineInput, Output
|
||||
from langflow.logging import logger
|
||||
from langflow.schema.dotdict import dotdict
|
||||
|
|
@ -268,3 +270,16 @@ class AgentComponent(ToolCallingAgentComponent):
|
|||
component_class, build_config, field_value, "model_name"
|
||||
)
|
||||
return dotdict({k: v.to_dict() if hasattr(v, "to_dict") else v for k, v in build_config.items()})
|
||||
|
||||
async def _get_tools(self) -> list[Tool]:
|
||||
component_toolkit = _get_component_toolkit()
|
||||
tools_names = self._build_tools_names()
|
||||
agent_description = self.get_tool_description()
|
||||
# TODO: Agent Description Depreciated Feature to be removed
|
||||
description = f"{agent_description}{tools_names}"
|
||||
tools = component_toolkit(component=self).get_tools(
|
||||
tool_name="Call_Agent", tool_description=description, callbacks=self.get_langchain_callbacks()
|
||||
)
|
||||
if hasattr(self, "tools_metadata"):
|
||||
tools = component_toolkit(component=self, metadata=self.tools_metadata).update_tools_metadata(tools=tools)
|
||||
return tools
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class APIRequestComponent(Component):
|
|||
]
|
||||
|
||||
outputs = [
|
||||
Output(display_name="API Response", name="data", method="make_api_requests"),
|
||||
Output(display_name="API Response", name="data", method="make_api_request"),
|
||||
]
|
||||
|
||||
def _parse_json_value(self, value: Any) -> Any:
|
||||
|
|
@ -403,7 +403,7 @@ class APIRequestComponent(Component):
|
|||
return {item["key"]: item["value"] for item in headers if self._is_valid_key_value_item(item)}
|
||||
return {}
|
||||
|
||||
async def make_api_requests(self) -> Data:
|
||||
async def make_api_request(self) -> Data:
|
||||
"""Make HTTP request with optimized parameter handling."""
|
||||
method = self.method
|
||||
url = self.url_input.strip() if isinstance(self.url_input, str) else ""
|
||||
|
|
|
|||
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
File diff suppressed because one or more lines are too long
|
|
@ -238,7 +238,7 @@ class TestAPIRequestComponent(ComponentTestBaseWithoutClient):
|
|||
assert "param1=value1" in result
|
||||
assert "param2=value2" in result
|
||||
|
||||
async def test_make_api_requests(self, component):
|
||||
async def test_make_api_request(self, component):
|
||||
# Test making API requests
|
||||
url = "https://example.com/api/test"
|
||||
response_data = {"key": "value"}
|
||||
|
|
@ -246,7 +246,7 @@ class TestAPIRequestComponent(ComponentTestBaseWithoutClient):
|
|||
with respx.mock:
|
||||
respx.get(url).mock(return_value=Response(200, json=response_data))
|
||||
|
||||
result = await component.make_api_requests()
|
||||
result = await component.make_api_request()
|
||||
|
||||
assert isinstance(result, Data)
|
||||
assert result.data["source"] == url
|
||||
|
|
@ -256,7 +256,7 @@ class TestAPIRequestComponent(ComponentTestBaseWithoutClient):
|
|||
# Test invalid URL handling
|
||||
component.url_input = "not_a_valid_url"
|
||||
with pytest.raises(ValueError, match="Invalid URL provided"):
|
||||
await component.make_api_requests()
|
||||
await component.make_api_request()
|
||||
|
||||
async def test_update_build_config(self, component):
|
||||
# Test build config updates
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ async def test_component_to_toolkit():
|
|||
assert len(tools) == 1
|
||||
tool = tools[0]
|
||||
|
||||
assert tool.name == "Agent"
|
||||
assert tool.name == "Call_Agent"
|
||||
|
||||
assert tool.description == DEFAULT_TOOLS_DESCRIPTION, tool.description
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue