Skip to content

enhance: add a maximum consecutive tools calls restriction #924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

thedadams
Copy link
Contributor

@thedadams thedadams commented Jan 2, 2025

This is a safety net for instances when the LLM goes awry. There is an undocumented environment variable to change the maximum number of consecutive tool calls from the default of 10.

Issue: obot-platform/obot#940

This is a safety net for instances when the LLM goes awry. There is an
undocumented environment variable to change the maximum number of
consecutive tool calls from the default of 10.

Signed-off-by: Donnie Adams <[email protected]>
@thedadams thedadams force-pushed the max-consecutive-tool-calls branch from 955bc9c to 2dedf54 Compare January 2, 2025 22:04
// Limit the number of consecutive tool calls and responses.
// We don't want the LLM to call tools unrestricted or get stuck in an error loop.
var messagesSinceLastUserMessage int
for _, msg := range slices.Backward(state.Completion.Messages) {
Copy link
Member

Choose a reason for hiding this comment

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

Using the new iterator functions, nice! 🎉

@thedadams thedadams merged commit a89c442 into gptscript-ai:main Jan 3, 2025
10 checks passed
@thedadams thedadams deleted the max-consecutive-tool-calls branch January 3, 2025 10:51
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.

3 participants