Deprecate loop attribute to fix conflict with Kernel.loop (fixes #11)#34
Merged
Deprecate loop attribute to fix conflict with Kernel.loop (fixes #11)#34
Conversation
This commit addresses issue #11 by deprecating the `loop` parameter that was conflicting with Ruby's `Kernel.loop` method. The system now automatically continues conversations after tool calls until the AI provides a text response. Key changes: - Chat completions automatically continue after tool execution - Added `max_tool_calls` parameter to prevent infinite loops (default: 25) - Deprecated `loop` parameter with warning message - Tool functions now just return their results - Renamed `stop_looping\!` to `stop_tool_calls_and_respond\!` Breaking changes: - `loop` parameter is deprecated (shows warning but still works) - Tool-based completions return strings instead of arrays - Functions no longer need to manually continue conversations This solution eliminates the need for the loop parameter entirely while providing better automatic behavior that users expect. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
loopparameter inChatCompletionto avoid conflicts with Ruby'sKernel.loopmax_tool_callsparameter to prevent infinite tool invocation loopsDetails
This PR addresses issue #11 by implementing a better solution than simply renaming the attribute. Instead of requiring users to specify
loop: true, the system now automatically continues conversations after tool calls until the AI provides a text response.Key Changes:
Automatic Continuation: Chat completions now automatically continue after tool calls, making the API more intuitive.
Deprecation Warning: The
loopparameter still works but shows a deprecation warning to ease migration.Tool Call Limiting: Added
max_tool_callsparameter (default: 25) to prevent infinite loops.Simplified API: Tool functions now just return their results - no need to manually handle continuation.
Breaking Changes:
loopparameter is deprecated (functional with warning)stop_looping\!renamed tostop_tool_calls_and_respond\!Migration Guide:
Test plan
max_tool_callsparameterloopparameter🤖 Generated with Claude Code