Skip to content

Conversation

@KeremTurgutlu
Copy link
Contributor

@KeremTurgutlu KeremTurgutlu commented Oct 18, 2025

This PR makes sure cache control is removed from all the messages in mk_msgs, which fixes issues such as #34 when AI makes multiple tool calls > 5.

With this fix AI can make 9 tool calls without any issues.

Fixes: #34

@jph00
Copy link
Contributor

jph00 commented Oct 18, 2025

Thanks @KeremTurgutlu . Does caching still work correctly following this change?

@jph00 jph00 merged commit eadd4c9 into main Oct 18, 2025
elif isinstance(content, list): c = [_mk_content(o) for o in content]
else: c = content
msg = {"role": role, "content": c}
return _add_cache_control(msg, ttl=ttl) if cache else msg
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm adding this back, since otherwise it's a breaking change to the public API, which AFAICT we don't need to do here. Lemme know if I'm missing something however.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I've only removed it since mk_msg was only used inside mk_msgs and the fact that we use caching by adding cache control to the last 2 messages. So I thought we don't need to add cache control to every message if we are going to remove them anyway, but didn't think of potentially different public API usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toolloop: A maximum of 4 blocks with cache_control may be provided. Found 5.

2 participants