Change truncation to remove end rather than middle by aymeric-roucher · Pull Request #1665 · huggingface/smolagents (original) (raw)

Conversation

@aymeric-roucher

In VisitWebpagTool, we use method _truncate_content to truncate content over N characters. Issue is, we remove from the middle: which leaves the beginning and end. The end of page generally consists of useless footer : so it's better to remove the end and keep some of the middle instead.

albertvillanova

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

except Exception as e:
raise ValueError(
f"Key {tool_name_key=} not found in the generated tool call. Got keys: {list(tool_call_dictionary.keys())} instead"
f"Tool call needs to have a key '{tool_name_key}'. Got keys: {list(tool_call_dictionary.keys())} instead"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this has nothing to do with the purpose of this PR... 😲

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

2 participants

@aymeric-roucher @albertvillanova