autogen icon indicating copy to clipboard operation
autogen copied to clipboard

[Feature Request]: Handle Tool Calls and Responses in Context Handling

Open gagb opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe.

Current implementation of TransformChatHistory does not handle tool calls and responses.

Describe the solution you'd like

No response

Additional context

No response

gagb avatar Feb 24 '24 00:02 gagb

@dkirsche would be fun to add this feature! I'll submit a PR soon for review unless you'd like to take a stab!

gagb avatar Feb 24 '24 00:02 gagb

@WaelKarkoub you maybe interested in this issue as well. Can #1923 address this?

gagb avatar Mar 09 '24 00:03 gagb

@gagb I'm not fully familiar with how tool calls and responses are treated, but the PR should handle that case as well (I hope I'm not overconfident :) ). You have to implement the logic as a MessageTransform to handle the logic (which I don't have an example implemented). Something that comes to mind is maybe you want to drop all tool responses:

class DropToolResponses:
    def apply_transform(self, messages: List[Dict]) -> List[Dict]:
        return [message for message in messages if "tool_responses" not in message]

Same thing with truncating tool responses, just need to have MessageTransform for that use case

WaelKarkoub avatar Mar 09 '24 00:03 WaelKarkoub

Strongly approve that :) It would be way easier to use AutoGen with that feature.

clemlesne avatar Mar 22 '24 13:03 clemlesne

@clemlesne you maybe interested in PR #1923

gagb avatar Mar 25 '24 07:03 gagb

Just so I have a better understanding, the idea is to include tool calls and responses in the token count when we are truncating?

WaelKarkoub avatar Apr 05 '24 06:04 WaelKarkoub