Skip to content

Conversation

@tsmithsz
Copy link
Contributor

@tsmithsz tsmithsz commented Apr 18, 2025

Problem

  • We currently include codeReferences as part of the history field in the request which can sometimes cause validation issues
  • fsWrite tool tends to favor doing line-by-line replaces which causes an increase in latency.

Solution

  • Do not include references in request history
  • Updated the tool spec to add an important guideline around the fsWrite tool usage - restricting strReplace command to only simple single-line replacements, while recommending the create command for multi-line edits.:

* IMPORTANT: For the fsWritetool, only use thestrReplacecommand for simple, isolated single-line replacements. If you are editing multiple lines, always prefer thecreate command and replace the entire file content instead.

Testing

Fields included in request history:

history: [
      {
        userInputMessage: {
          content: 'What is aws cloudwatch in 5 sentences?',
          userIntent: undefined,
          origin: 'IDE',
          userInputMessageContext: { toolResults: undefined }
        }
      },
      {
        assistantResponseMessage: {
          messageId: 'fa3ecd66-9271-4f9b-9ee2-13b80bd65df9',
          content: 'AWS CloudWatch is a monitoring and observability service that provides real-time monitoring of AWS resources and applications running on AWS infrastructure. It collects and tracks metrics, monitors log files, sets alarms, and automatically reacts to changes in your AWS resources. CloudWatch enables you to gain system-wide visibility into resource utilization, application performance, and operational health. With CloudWatch, you can detect anomalous behavior in your environments, set alarms, visualize logs and metrics side by side, take automated actions, troubleshoot issues, and discover insights to keep your applications running smoothly.',
          toolUses: []
        }
      }
    ]

Latency test results

Build with strReplace Build without strReplace
renaming a single function 16s 17s
translate comments (multi-line replace +19 -20) 98s 20s

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tsmithsz tsmithsz requested review from a team as code owners April 18, 2025 18:18
@github-actions
Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from 78b4fd5 to 3d21b94 Compare April 18, 2025 18:31
@tsmithsz tsmithsz changed the title fix(amazonq): Remove irrelevant fields from chat history fix(amazonq): Do not include references in request history Apr 18, 2025
@zixlin7 zixlin7 merged commit 6f0dc14 into aws:feature/agentic-chat Apr 18, 2025
21 of 22 checks passed
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