Skip to content

Feat/search sirchmunk#882

Open
suluyana wants to merge 9 commits intomodelscope:mainfrom
suluyana:feat/search_sirchmunk
Open

Feat/search sirchmunk#882
suluyana wants to merge 9 commits intomodelscope:mainfrom
suluyana:feat/search_sirchmunk

Conversation

@suluyana
Copy link
Collaborator

image

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 significantly enhances the agent's capabilities by integrating intelligent knowledge search powered by Sirchmunk. This new feature allows the agent to automatically search local codebases and documentation for relevant information, effectively transforming it into a Retrieval-Augmented Generation (RAG) system tailored for code. The integration prioritizes ease of use, offering automatic LLM configuration inheritance and direct command-line interface support, making it straightforward for users to leverage their local knowledge bases to improve query responses.

Highlights

  • Knowledge Search Integration: Integrated SirchmunkSearch, enabling the agent to perform intelligent knowledge retrieval from local codebases and documentation.
  • Flexible Configuration: Introduced a new knowledge_search configuration section with automatic inheritance of LLM parameters from the main llm module, simplifying setup.
  • CLI Support: Added a --knowledge_search_paths argument to the ms-agent run command, allowing users to quickly enable and configure knowledge search directly from the command line.
  • Enhanced Message Structure: Extended the Message class with searching_detail and search_result fields to provide detailed logs and raw search outcomes for frontend display and subsequent LLM processing.
  • Comprehensive Documentation: Updated both English and Chinese documentation to include detailed guides on configuring and using the new knowledge search feature, along with an example configuration file.
  • Bug Fix: Corrected the base URL configuration for the DashScope LLM to ensure it uses its dedicated dashscope_base_url instead of modelscope_base_url.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/en/Components/Config.md
    • Updated documentation by adding details about the knowledge_search_paths parameter and a quick start guide for knowledge search.
  • docs/zh/Components/config.md
    • Updated Chinese configuration documentation by adding details about knowledge_search_paths and a quick start guide, and adjusted formatting.
    • Corrected minor formatting inconsistencies in various sections (e.g., spacing around backticks).
  • examples/knowledge_search/agent.yaml.example
    • Added a new example YAML configuration file for Sirchmunk Knowledge Search, demonstrating its setup and available parameters.
  • ms_agent/agent/llm_agent.py
    • Imported SirchmunkSearch for knowledge retrieval.
    • Added a knowledge_search attribute to the LLMAgent class (note: type hint SirschmunkSearch contains a typo and should be SirchmunkSearch).
    • Implemented prepare_knowledge_search to initialize the SirchmunkSearch component based on configuration.
    • Modified do_rag method to incorporate knowledge search results into user messages, populating searching_detail and search_result fields.
  • ms_agent/cli/run.py
    • Imported OmegaConf for dynamic configuration management.
    • Added a load_env_file method to load environment variables from a .env file.
    • Introduced --knowledge_search_paths argument to enable and configure SirchmunkSearch via the command line.
    • Updated _execute_with_config to handle dynamic creation or update of the knowledge_search configuration based on the new CLI argument.
    • Modified default config loading to use a built-in agent.yaml if no config is specified and no local agent.yaml is found.
  • ms_agent/knowledge_search/README.md
    • Added a new README file detailing the Sirchmunk Knowledge Search integration, including its features, installation, configuration, usage examples, environment variables, testing, and troubleshooting.
  • ms_agent/knowledge_search/init.py
    • Added the __init__.py file to define the knowledge_search module and expose the SirchmunkSearch class.
  • ms_agent/knowledge_search/sirchmunk_search.py
    • Added the SirchmunkSearch class, which wraps sirchmunk.search.AgenticSearch to integrate with ms_agent.
    • Implemented configuration validation, LLM parameter inheritance from the main llm module, search execution, and result parsing into a standard format.
    • Provided methods for adding documents (with a warning for direct addition), retrieving results, querying for synthesized answers, and accessing search logs and details.
  • ms_agent/llm/dashscope_llm.py
    • Corrected the base_url parameter in DashScope LLM initialization from config.llm.modelscope_base_url to config.llm.dashscope_base_url.
  • ms_agent/llm/utils.py
    • Extended the Message class by adding searching_detail (for search logs and metadata) and search_result (for raw search outcomes) fields to support knowledge search.
  • ms_agent/rag/utils.py
    • Added a comment clarifying that SirchmunkSearch is integrated directly within LLMAgent and not through the rag_mapping utility.
  • tests/knowledge_search/init.py
    • Added the __init__.py file for the knowledge_search tests module.
  • tests/knowledge_search/test_sirschmunk.py
    • Added unit tests for the SirchmunkSearch integration with LLMAgent.
    • Included setup for creating temporary test files and configuration for the agent.
    • Verified that LLMAgent initializes correctly with knowledge search and that user messages are populated with searching_detail and search_result after a query.
Activity
  • The pull request was opened by suluyana.
  • An image was included in the pull request description, likely showcasing the new knowledge search feature in action.
  • New files were added to introduce the SirchmunkSearch integration, including its core logic, documentation, and example configurations.
  • Existing core agent and CLI files were modified to incorporate and enable the new knowledge search functionality.
  • Unit tests were added to ensure the proper functioning and integration of the knowledge search feature within the LLMAgent framework.
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
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 introduces a new knowledge search feature powered by Sirchmunk. The changes include the core SirchmunkSearch integration within LLMAgent, updates to the CLI to support enabling this feature via command-line arguments, and comprehensive documentation in both English and Chinese, along with a new example configuration file. The implementation also adds new fields to the Message class to carry search results and details. Overall, this is a significant feature addition. I've found a couple of areas for improvement, one related to redundant logic in the agent and a minor documentation issue.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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