mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-18 11:04:35 +00:00
fix: ComponentTool description should not be truncated (#8870)
* fix: description should not be truncated * chore: add release note
This commit is contained in:
parent
0409e5da8f
commit
cd7c68372b
@ -152,9 +152,7 @@ class ComponentTool(Tool):
|
||||
]
|
||||
).lstrip("_")
|
||||
|
||||
# Generate a description for the tool if not provided and truncate to 512 characters
|
||||
# as most LLMs have a limit for the description length
|
||||
description = (description or component.__doc__ or name)[:512]
|
||||
description = description or component.__doc__ or name
|
||||
|
||||
# Create the Tool instance with the component invoker as the function to be called and the schema
|
||||
super().__init__(name, description, tool_schema, component_invoker)
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
ComponentTool does not truncate 'description' anymore.
|
||||
@ -142,6 +142,12 @@ class TestToolComponent:
|
||||
assert "reply" in result
|
||||
assert result["reply"] == "Hello, world!"
|
||||
|
||||
def test_from_component_long_description(self):
|
||||
component = SimpleComponent()
|
||||
tool = ComponentTool(component=component, description="".join(["A"] * 1024))
|
||||
|
||||
assert len(tool.description) == 1024
|
||||
|
||||
def test_from_component_with_dataclass(self):
|
||||
component = UserGreeter()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user