Skip to content

Add comprehensive chat history test for Bedrock integration#121

Merged
xerial merged 3 commits intomainfrom
feature/bedrock-chat-history-test
Jun 5, 2025
Merged

Add comprehensive chat history test for Bedrock integration#121
xerial merged 3 commits intomainfrom
feature/bedrock-chat-history-test

Conversation

@xerial
Copy link
Copy Markdown
Member

@xerial xerial commented Jun 5, 2025

Summary

  • Add integration test demonstrating chat history support in Bedrock
  • Test three different approaches to maintaining conversation context
  • Validate existing chat history functionality in BedrockChat implementation

Test plan

  • Test continueChat() method for automatic history maintenance
  • Test explicit ChatRequest with message sequences
  • Test session-based conversations across multiple interactions
  • Run integration tests with AWS credentials to verify functionality

🤖 Generated with Claude Code

- Demonstrates three ways to use chat history with Bedrock:
  1. Using continueChat() method for automatic history maintenance
  2. Explicit ChatRequest with message sequences for full control
  3. Session-based conversations across multiple interactions
- Tests memory retention across conversation turns
- Validates existing chat history support in BedrockChat implementation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Hello @xerial, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello! Gemini here, providing a summary of this pull request. The main goal of this PR, as indicated by the title and description, is to add a comprehensive integration test for the Bedrock chat integration to specifically verify its chat history capabilities. The test aims to cover different ways conversation context is handled, including automatic history maintenance via continueChat, explicit message sequences using ChatRequest, and session-based interactions.

Highlights

  • New Integration Test: This pull request introduces a new integration test case within BedrockIntegrationTest.scala specifically designed to validate chat history functionality.
  • Chat History Validation: The new test covers three distinct scenarios for managing conversation history: using the continueChat method, providing an explicit sequence of ChatMessage objects in a ChatRequest, and testing session-based history across multiple calls.
  • Bedrock Chat Implementation: The test serves to validate the existing chat history support within the BedrockChat implementation.

Changelog

  • ai-integration-test/src/test/scala/wvlet/ai/agent/bedrock/BedrockIntegrationTest.scala
    • Added a new test case test("bedrock agent with chat history") to verify chat history handling.
    • Demonstrated testing chat history using session.continueChat.
    • Demonstrated testing chat history by constructing an explicit ChatRequest with a message sequence.
    • Included debug logging for the responses from the chat interactions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A test for chat history,
Ensures the bot remembers thee.
With context clear,
No bugs appear,
A conversational victory.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a valuable integration test for the Bedrock chat history functionality. It covers three different ways chat history can be managed: using continueChat with a previous response, and using chatStream with an explicit message sequence. This is a good step towards ensuring the correctness of the Bedrock integration.

Summary of Findings

  • Missing Assertions in Integration Test: The integration test for chat history currently relies on printing debug output to verify results. To make the test robust and automatically verifiable, assertions should be added to check if the model's responses correctly reflect the provided chat history.
  • Use of debug for validation: The test uses debug statements to show the responses. While useful for manual inspection, using assertions is the standard way to validate expected outcomes in automated tests.

Merge Readiness

The pull request introduces a necessary integration test for chat history. However, the test currently lacks assertions to programmatically verify the correctness of the history handling. This is a high-severity issue for a test, as it doesn't truly validate the functionality. I recommend addressing the missing assertions before merging. I am unable to approve the pull request; please have other reviewers approve this code before merging.

xerial and others added 2 commits June 4, 2025 21:36
- Add programmatic verification instead of relying only on debug output
- Assert that responses contain expected content based on chat history
- Verify name retention in continueChat scenario (Alice)
- Verify color reference in explicit history scenario (blue)
- Add structural assertions for response format validation

Addresses code review feedback to make test robust and automatically verifiable.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Import ChatMessage.AIMessage explicitly to resolve type errors
- Replace unsupported shouldBe a[Type] with isInstanceOf[Type] shouldBe true
- Use shouldContain instead of should include for string assertions
- Ensure all assertions follow proper AirSpec syntax patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the doc Improvements or additions to documentation label Jun 5, 2025
@xerial xerial added the internal Non-user facing changes label Jun 5, 2025
@xerial xerial merged commit 489f2ad into main Jun 5, 2025
10 checks passed
@xerial xerial deleted the feature/bedrock-chat-history-test branch June 5, 2025 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Improvements or additions to documentation internal Non-user facing changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant