Skip to content

rag#7

Merged
david20571015 merged 5 commits intomainfrom
rag
Mar 9, 2025
Merged

rag#7
david20571015 merged 5 commits intomainfrom
rag

Conversation

@david20571015
Copy link
Contributor

  • feat: update proto files
  • refactor(rag): combine services to a rag workflow
  • doc(config): update execute instructions
  • feat(client): add example client implementation for searching with gRPC

Copilot AI review requested due to automatic review settings March 9, 2025 20:20
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.

Hello @david20571015, 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

This pull request introduces a Retrieval-Augmented Generation (RAG) workflow to the llm_backend. It refactors the existing search and summarize services into a single RAG service, updates the proto files, and provides an example client implementation for searching with gRPC. The configuration is updated to reflect the new RAG service and the example configuration file is removed.

Highlights

  • Feature: Updates proto files to support the new RAG service.
  • Refactor: Combines the search and summarize services into a single RAG workflow.
  • Documentation: Updates the execute instructions in the README to reflect the new service and adds a client example.
  • Client: Adds an example client implementation for searching with gRPC.

Changelog

Click here to see the changelog
  • .gitignore
    • Removes configs/* and !configs/example.toml from the ignore list.
  • README.md
    • Removes the reference to configs/example.toml in the usage instructions.
    • Updates the command to run the server to python3 scripts/serve.py --config configs/config.toml.
    • Adds information on how to run the example client: python3 scripts/client.py.
  • configs/config.toml
    • Adds a new configuration file with settings for the server, retrieve service, and summarize service.
    • Specifies the embedding model, prompt templates, and other parameters for the RAG workflow.
  • configs/example.toml
    • Removes the example configuration file.
  • llm_backend/init.py
    • Removes the import and setup of SearchService and SummarizeService.
    • Adds the import and setup of RagService.
    • Updates the setup_rag_service function to use grpc.aio.Server.
    • Removes ServiceConfig class.
  • llm_backend/rag/init.py
    • Creates a new rag package with modules for config and service.
    • Defines the add_RagServiceServicer_to_server, RagConfig, and RagService symbols.
  • llm_backend/rag/config.py
    • Creates a new config module for the RAG service.
    • Defines configuration classes for Qdrant, Retrieve, ChatGpt, Summarize, and Rag services.
    • Includes default values for embedding model, OpenAI model, similarity top k, and prompt templates.
    • Introduces ContentFormat enum and contains_placeholder validator.
  • llm_backend/rag/content_formatters.py
    • Introduces content formatters for plain and numbered content.
  • llm_backend/rag/service.py
    • Creates a new service module for the RAG service.
    • Defines the RagService class that implements the RAG workflow using RagWorkflow.
  • llm_backend/rag/workflow.py
    • Creates a new workflow module for the RAG service.
    • Defines the RagWorkflow class that orchestrates the retrieval and summarization steps.
    • Uses llama-index for vector store indexing, retrieval, and response synthesis.
  • llm_backend/search/init.py
    • Removes the search package.
  • llm_backend/search/config.py
    • Removes the search package.
  • llm_backend/search/service.py
    • Removes the search package.
  • llm_backend/summarize/init.py
    • Removes the summarize package.
  • llm_backend/summarize/service.py
    • Removes the summarize package.
  • llm_backend/utils.py
    • Removes the contains_placeholder utility function (moved to llm_backend/rag/config.py).
  • protos
    • Updates the protos subproject to commit 6244aa1a7c26262f3aa8ecd1a598f1aedb48fe92.
  • pyproject.toml
    • Removes serve script.
    • Adds llama-index-core as a dependency.
    • Updates dependency versions.
  • scripts/client.py
    • Creates a new client.py script with an example implementation for searching with gRPC.
  • scripts/serve.py
    • Updates the serve.py script to use grpc.aio.server and set up the RagService.
    • Removes the setup of SearchService and SummarizeService.
    • Changes the default config path to configs/config.toml.
    • Implements asynchronous server startup and graceful shutdown.
  • uv.lock
    • Updates the uv.lock file to reflect the new dependencies and versions.
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.


Did you know?

The llama is a domesticated South American camelid, widely used as a meat and pack animal by Andean cultures since the Pre-Columbian era.

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

The pull request refactors the codebase to combine the search and summarize services into a single RAG (Retrieval-Augmented Generation) workflow. This involves updating proto files, modifying configurations, and providing an example client implementation. The changes appear well-structured and aim to streamline the RAG process.

Summary of Findings

  • Configuration Management: The configuration files have been updated to reflect the new RAG workflow. It's important to ensure that all configuration options are well-documented and that default values are sensible.
  • Error Handling: The code includes error handling for file not found exceptions. It's crucial to ensure that all potential error scenarios are handled gracefully and that appropriate logging is in place.
  • Dependency Updates: The dependencies have been updated, including llama-index-core. It's important to verify that these updates are compatible with the rest of the codebase and that any breaking changes are addressed.

Merge Readiness

The pull request introduces significant changes by combining the search and summarize services into a RAG workflow. While the changes appear well-structured, it's crucial to ensure that all configuration options are well-documented, error scenarios are handled gracefully, and dependency updates are compatible. I am unable to directly approve this pull request, and recommend that these points be addressed before merging. It is also recommended that others review and approve this code before merging.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@david20571015 david20571015 requested a review from Copilot March 9, 2025 20:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@david20571015 david20571015 merged commit 9c703bd into main Mar 9, 2025
1 check passed
@david20571015 david20571015 deleted the rag branch March 9, 2025 20:28
@david20571015 david20571015 restored the rag branch March 10, 2025 05:38
david20571015 added a commit that referenced this pull request Mar 10, 2025
This reverts commit 9c703bd.
@david20571015 david20571015 mentioned this pull request Mar 10, 2025
david20571015 added a commit that referenced this pull request Mar 10, 2025
This reverts commit 9c703bd.
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.

2 participants