Skip to content

feat(tools): Add think tool with option to disable it. #1346

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 5 commits into from
May 5, 2025
Merged

Conversation

saisrinivas26
Copy link
Contributor

@saisrinivas26 saisrinivas26 commented Apr 24, 2025

Issue #, if available:

Description of changes:

Testing

With tool enabled - q settings chat.enableThinking true

Screenshot 2025-05-01 at 9 33 34 PM

with tool disabled - q settings chat.enableThinking false

Screenshot 2025-05-01 at 4 05 34 PM
Trusted tools can be run without confirmation

* Default settings

> use think tool

I don't have a "think tool" available in my current toolset. The tools I can use include:

• fs_write: For creating and editing files
• use_aws: For making AWS CLI API calls
• execute_bash: For executing bash commands
• fs_read: For reading files and directories
• report_issue: For reporting issues with the chat

Is there something specific you'd like me to help you with using these available tools? I can help with file operations, AWS CLI commands, bash execution, or other tasks related to the Amazon Q CLI project you're working on.

Add Think Tool with Configurable Enablement

Description

This PR introduces a new "Think" tool that enhances Amazon Q's reasoning capabilities during chat interactions. The Think tool provides a dedicated space for the model to process information, navigate
complex decision trees, and improve response quality in multi-step scenarios.

Key Features

• Added a new think.rs module implementing the Think tool functionality
• Integrated the tool into the existing tools framework
• Made the feature configurable via settings (q settings enable_thinking [true|false])
• Added conditional tool registration based on the feature flag
• Implemented blue-colored visual feedback when the model shares its reasoning process

Implementation Details

• The Think tool allows the model to explicitly reason through complex problems during response generation
• When enabled, the tool displays the model's thought process in blue text
• The feature is enabled by default but can be disabled via settings
• Empty thoughts are accepted but ignored to maintain robustness
• The tool is completely excluded from the available tools list when disabled

Technical Changes

• Added new file: crates/q_cli/src/cli/chat/tools/think.rs (86 lines)
• Modified tool registration in load_tools() to conditionally include the Think tool
• Updated tool index JSON to include the Think tool definition
• Added tool handling in the Tool enum and related functions
• Implemented validation, invocation, and description methods for the tool

Usage

Users can control this feature with:
q settings enable_thinking true # Enable the thinking feature (default)
q settings enable_thinking false # Disable the thinking feature

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@saisrinivas26 saisrinivas26 self-assigned this Apr 24, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.75%. Comparing base (704738f) to head (ec12930).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1346   +/-   ##
=======================================
  Coverage   16.75%   16.75%           
=======================================
  Files         213      213           
  Lines       20704    20704           
  Branches      871      871           
=======================================
  Hits         3468     3468           
  Misses      17236    17236           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@saisrinivas26 saisrinivas26 marked this pull request as ready for review April 24, 2025 21:17
@saisrinivas26 saisrinivas26 requested review from a team and chaynabors April 24, 2025 21:17
@brandonskiser
Copy link
Contributor

Just a couple minor changes - and sorry can you rebase main and push again? q_cli::cli::chat was moved to a new crate q_chat

@saisrinivas26
Copy link
Contributor Author

Just a couple minor changes - and sorry can you rebase main and push again? q_cli::cli::chat was moved to a new crate q_chat

Sure.

@brandonskiser brandonskiser merged commit 8099446 into main May 5, 2025
21 checks passed
@brandonskiser brandonskiser deleted the thinktool branch May 5, 2025 16:49
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.

4 participants