Skip to content

Conversation

@xseruer
Copy link
Contributor

@xseruer xseruer commented Feb 9, 2026

AgentScope-Java Version

1.0.9-SNAPSHOT

Description

Place the knowledge message before the user input message.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@xseruer xseruer requested a review from a team February 9, 2026 09:19
@gemini-code-assist
Copy link

Summary of Changes

Hello @xseruer, 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!

This pull request enhances the AgentScope-Java framework by improving how RAG-retrieved knowledge is integrated into agent conversations and by introducing robust event streaming capabilities for agent pipelines. These changes aim to provide more precise control over message ordering and enable real-time observation of agent execution flows.

Highlights

  • RAG Message Ordering: The GenericRAGHook now correctly places retrieved knowledge messages before the user's input messages, ensuring the RAG context is prioritized in the conversation flow.
  • FanoutPipeline Streaming API: A new set of streaming methods has been introduced in FanoutPipeline, allowing agents within the pipeline to stream execution events. This new API supports both concurrent and sequential event processing, offering greater flexibility.
  • GenerateOptions Merging Refinement: The DashScopeChatModel now utilizes a dedicated GenerateOptions.mergeOptions utility for combining generation options, which provides a clearer and more robust mechanism for handling default and custom settings.
  • Comprehensive Streaming Tests: Extensive unit tests have been added for the new FanoutPipeline streaming functionality, covering various scenarios including concurrent and sequential execution, custom options, and builder-pattern usage.
Changelog
  • agentscope-core/src/main/java/io/agentscope/core/model/DashScopeChatModel.java
    • Refactored option merging logic to use GenerateOptions.mergeOptions for clearer precedence when combining default and custom generation options.
  • agentscope-core/src/main/java/io/agentscope/core/pipeline/FanoutPipeline.java
    • Added a new streaming API with stream methods supporting default, custom options, and structured output.
    • Implemented private streamConcurrent and streamSequential methods to handle event streaming based on pipeline configuration.
  • agentscope-core/src/main/java/io/agentscope/core/rag/GenericRAGHook.java
    • Modified message construction to place the enhancedMessage (knowledge context) before the inputMessages in the list, aligning with the intent to prioritize knowledge.
  • agentscope-core/src/test/java/io/agentscope/core/pipeline/FanoutPipelineTest.java
    • Introduced a new suite of tests to validate the concurrent and sequential streaming capabilities of the FanoutPipeline.
    • Added tests for custom StreamOptions and pipelines created using the builder pattern.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

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

@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 introduces a streaming API to FanoutPipeline for both concurrent and sequential execution, complete with thorough unit tests. It also includes a beneficial refactoring in DashScopeChatModel to better merge generation options. The core change in GenericRAGHook correctly places the retrieved knowledge message before the user input, achieving the main goal of the PR. The overall implementation is solid. I have one suggestion to improve the precision of a new test case.

Comment on lines +361 to +366
AtomicInteger eventCount = new AtomicInteger(0);
pipeline.stream(input).doOnNext(event -> eventCount.incrementAndGet()).blockLast(TIMEOUT);

assertTrue(
eventCount.get() >= 3,
"Should have at least 3 AGENT_RESULT events (one per agent)");

Choose a reason for hiding this comment

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

medium

The current test implementation counts all events, but the assertion message specifically refers to AGENT_RESULT events. This is a bit misleading, and the assertion is not as precise as it could be.

To make the test stronger and clearer, it would be better to filter for AGENT_RESULT events and assert their count directly. This ensures the test is verifying exactly what the description claims.

        long agentResultCount =
                pipeline.stream(input)
                        .filter(event -> event.getType() == EventType.AGENT_RESULT)
                        .count()
                        .block(TIMEOUT);

        assertEquals(3, agentResultCount, "Should have exactly 3 AGENT_RESULT events (one per agent)");

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.

1 participant