Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/prompt provider and type reno #174

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

emrgnt-cmplxty
Copy link
Contributor

@emrgnt-cmplxty emrgnt-cmplxty commented Mar 14, 2024

Ellipsis 🚀 This PR description was created by Ellipsis for commit 33ce427.

Summary:

This PR involves a major refactoring of the project, including the introduction of a new PromptProvider abstraction, updates to the RAGPipeline and its implementations, changes to the LLMProvider interface, removal of the RAGCompletion class, introduction of RAGPipelineOutput, and updates to BasicRAGPipeline and SyntheticRAGPipeline to use PromptProvider.

Key points:

  • Major refactoring of the project, including removal of several components.
  • Introduction of a new PromptProvider abstraction in r2r/core/providers/prompt.py.
  • Updates to RAGPipeline in r2r/core/pipelines/rag.py to use the new PromptProvider.
  • Removal of RAGCompletion class and introduction of RAGPipelineOutput in r2r/core/abstractions/output.py.
  • Updates to LLMProvider interface in r2r/core/providers/llm.py.
  • Updates to BasicRAGPipeline and SyntheticRAGPipeline to use PromptProvider.
  • Introduction of BasicPromptProvider in r2r/pipelines/basic/prompt_provider.py.

Generated with ❤️ by ellipsis.dev

Copy link

vercel bot commented Mar 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
r2r-cloud ❌ Failed (Inspect) Mar 14, 2024 5:17pm
r2r-cloud-docs ❌ Failed (Inspect) Mar 14, 2024 5:17pm
r2r-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2024 5:17pm

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

  • Reviewed the entire pull request up to 0ada9c9
  • Looked at 7622 lines of code in 122 files
  • Took 7 minutes and 9 seconds to review
More info
  • Skipped 49 files when reviewing.
  • Skipped posting 2 additional comments because they didn't meet confidence threshold of 50%.
1. r2r/core/abstractions/output.py:1:
  • Assessed confidence : 0%
  • Comment:
    The new class RAGPipelineOutput seems to be well implemented. It encapsulates the output of the RAG pipeline, which includes the search results, context, and completion. This makes the code more modular and easier to understand. Good job!
  • Reasoning:
    The PR removes a lot of code related to the chat application. It seems like the chat application is being deprecated and replaced by a cloud platform. This is not explicitly mentioned in the PR description, but it can be inferred from the changes made. The PR also adds a new class RAGPipelineOutput and modifies the RAGPipeline class to use this new class. The changes seem logical and there are no obvious bugs or issues. However, without more context or understanding of the overall codebase, it's hard to be certain.
2. README.md:95:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    The PR description is empty. Please provide a clear description of the changes made. This is important for reviewers and for future reference.
  • Reasoning:
    The code removed from the chat application seems to be a complete removal of the chat functionality. This is a major change and should be clearly stated in the PR description. However, the PR description is empty, which is not a good practice. It's important to provide a clear description of the changes made for reviewers and future reference.

Workflow ID: wflow_MyfknvRtRIHv2ktH


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

  • Performed an incremental review on 542c74d
  • Looked at 141 lines of code in 4 files
  • Took 3 minutes and 35 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 4 additional comments because they didn't meet confidence threshold of 50%.
1. r2r/llms/openai/base.py:85:
  • Assessed confidence : 80%
  • Grade: 0%
  • Comment:
    The return type of the method '_get_completion' has been changed. Please ensure that this change is properly handled in the methods 'get_completion' and 'get_completion_stream' which are calling '_get_completion'.
  • Reasoning:
    In the file 'r2r/llms/openai/base.py', the return type of the method '_get_completion' has been changed from 'ChatCompletion' to 'Union[ChatCompletion, ChatCompletionChunk]'. This change might affect the methods 'get_completion' and 'get_completion_stream' which are calling '_get_completion' and expecting a specific type of return value. We need to ensure that the change in return type is handled properly in these methods.
2. r2r/main/app.py:183:
  • Assessed confidence : 60%
  • Grade: 0%
  • Comment:
    The method 'rag_completion' has been updated to handle the case where 'rag_completion.completion' is None. Please ensure that this case is handled appropriately in the rest of the codebase.
  • Reasoning:
    In the file 'r2r/main/app.py', the method 'rag_completion' has been updated to handle the case where 'rag_completion.completion' is None. This is a good practice as it prevents potential 'NoneType' errors. However, it's important to ensure that the 'rag_pipeline.run' method is expected to return a value that could have 'completion' as None and that this case is handled appropriately in the rest of the codebase.
3. r2r/main/utils.py:161:
  • Assessed confidence : 60%
  • Grade: 0%
  • Comment:
    The method 'process_event' has been updated to raise a ValueError when 'id', 'text', or 'metadata' is missing in the result. Please ensure that the code calling 'process_event' is prepared to handle this exception.
  • Reasoning:
    In the file 'r2r/main/utils.py', the method 'process_event' has been updated to raise a ValueError when 'id', 'text', or 'metadata' is missing in the result. This is a good practice as it prevents potential 'NoneType' errors. However, it's important to ensure that the code calling 'process_event' is prepared to handle this exception.
4. r2r/pipelines/basic/prompt_provider.py:24:
  • Assessed confidence : 60%
  • Grade: 0%
  • Comment:
    The 'BasicPromptProvider' class has been introduced which overrides the 'get_system_prompt' and 'get_task_prompt' methods. Please ensure that the code using 'BasicPromptProvider' is using these methods correctly and that the prompts are formatted as expected.
  • Reasoning:
    In the file 'r2r/pipelines/basic/prompt_provider.py', the 'BasicPromptProvider' class has been introduced. This class extends 'DefaultPromptProvider' and overrides the 'get_system_prompt' and 'get_task_prompt' methods. This is a good practice as it allows for customization of the prompts. However, it's important to ensure that the code using 'BasicPromptProvider' is using these methods correctly and that the prompts are formatted as expected.

Workflow ID: wflow_MFSVXBKi1rl6LGbF


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

  • Performed an incremental review on 59751c2
  • Looked at 45 lines of code in 2 files
  • Took 2 minutes and 39 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 1 additional comments because they didn't meet confidence threshold of 50%.
1. r2r/main/app.py:213:
  • Assessed confidence : 66%
  • Grade: 0%
  • Comment:
    The change from 'AsyncGenerator' to 'Generator' in the return type of '_stream_rag_completion' function might cause issues if the function is expected to be asynchronous. Please ensure that this change is intentional and does not affect the performance of the application.
    ) -> AsyncGenerator[str, None]:
  • Reasoning:
    The change in 'r2r/main/app.py' from 'AsyncGenerator' to 'Generator' in the return type of '_stream_rag_completion' function might cause issues if the function is expected to be asynchronous. This change might affect the performance of the application if the function is expected to handle large data streams.

Workflow ID: wflow_6xBsTtBWsQsKCSbf


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

  • Performed an incremental review on 4043343
  • Looked at 45 lines of code in 2 files
  • Took 3 minutes and 29 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 2 additional comments because they didn't meet confidence threshold of 50%.
1. r2r/main/models.py:1:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    The import of 'dataclass' is not used in this file. Please remove it to keep the code clean and efficient.
  • Reasoning:
    The import of 'dataclass' in 'r2r/main/models.py' is not used anywhere in the file. This is a violation of the best practice to avoid unused imports as they can cause confusion and unnecessary overhead.
2. r2r/main/app.py:213:
  • Assessed confidence : 66%
  • Grade: 0%
  • Comment:
    The function '_stream_rag_completion' was changed from an AsyncGenerator to a Generator. Please ensure this change doesn't impact the performance or functionality of the application, especially if this function is designed to handle large data streams.
  • Reasoning:
    In the file 'r2r/main/app.py', the function '_stream_rag_completion' was changed from an AsyncGenerator to a Generator. This change could potentially impact the performance of the application if the function was originally designed to be asynchronous for handling large data streams or for improving performance.

Workflow ID: wflow_K2giLDhqZn4bZ51v


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

  • Performed an incremental review on 33ce427
  • Looked at 966 lines of code in 18 files
  • Took 7 minutes and 17 seconds to review
More info
  • Skipped 1 files when reviewing.
  • Skipped posting 9 additional comments because they didn't meet confidence threshold of 50%.
1. r2r/llms/openai/base.py:56:
  • Assessed confidence : 0%
  • Comment:
    The refactoring of the get_completion and get_completion_stream methods is correct and handles the stream parameter of the generation_config correctly.
  • Reasoning:
    The r2r/llms/openai/base.py file has been refactored to remove the get_instruct_completion method and replace the get_chat_completion method with get_completion and get_completion_stream methods. This change is consistent with the changes in the LLMProvider interface in r2r/core/providers/llm.py. The new methods are correctly implemented and handle the stream parameter of the generation_config correctly. No issues found in this file.
2. r2r/main/app.py:171:
  • Assessed confidence : 0%
  • Comment:
    The updates to the rag_completion and _stream_rag_completion methods correctly handle the changes in the RAGPipeline interface and the RAGPipelineOutput class.
  • Reasoning:
    The r2r/main/app.py file has been updated to handle the changes in the RAGPipeline interface and the RAGPipelineOutput class. The rag_completion method now correctly handles the case where the stream parameter of the generation_config is False and the completion attribute of the RAGPipelineOutput is None. The _stream_rag_completion method also correctly checks that the stream parameter of the generation_config is True before streaming completions. No issues found in this file.
3. r2r/main/models.py:1:
  • Assessed confidence : 0%
  • Comment:
    No changes have been made in this file.
  • Reasoning:
    The r2r/main/models.py file has not been modified in this PR. There are no changes to review in this file.
4. r2r/main/utils.py:157:
  • Assessed confidence : 0%
  • Comment:
    The updates to the process_event and process_logs methods correctly handle the changes in the RAGPipeline interface and the RAGPipelineOutput class.
  • Reasoning:
    The r2r/main/utils.py file has been updated to handle the changes in the RAGPipeline interface and the RAGPipelineOutput class. The process_event method now correctly handles the case where the stream parameter of the generation_config is False and the completion attribute of the RAGPipelineOutput is None. The process_logs method also correctly checks that the stream parameter of the generation_config is True before streaming completions. No issues found in this file.
5. r2r/pipelines/__init__.py:4:
  • Assessed confidence : 0%
  • Comment:
    The inclusion of BasicPromptProvider in the list of imports is correct.
  • Reasoning:
    The r2r/pipelines/__init__.py file has been updated to include the BasicPromptProvider in the list of imports. This is consistent with the introduction of the PromptProvider abstraction in this PR. No issues found in this file.
6. r2r/pipelines/basic/embedding.py:57:
  • Assessed confidence : 0%
  • Comment:
    The updates to the ingress and run methods correctly handle the changes in the EmbeddingPipeline interface.
  • Reasoning:
    The r2r/pipelines/basic/embedding.py file has been updated to handle the changes in the EmbeddingPipeline interface. The ingress method now correctly returns a dictionary instead of a string. The run method now correctly checks that the document parameter is a BasicDocument instance and not a list. No issues found in this file.
7. r2r/pipelines/basic/prompt_provider.py:6:
  • Assessed confidence : 0%
  • Comment:
    The implementation of the BasicPromptProvider class is correct.
  • Reasoning:
    The r2r/pipelines/basic/prompt_provider.py file has been added in this PR. It introduces the BasicPromptProvider class, which extends the DefaultPromptProvider class from the r2r.core package. The BasicPromptProvider class provides default system and task prompts and methods to get these prompts. The implementation of this class is correct and consistent with the introduction of the PromptProvider abstraction in this PR. No issues found in this file.
8. r2r/pipelines/basic/rag.py:31:
  • Assessed confidence : 0%
  • Comment:
    The updates to the BasicRAGPipeline class correctly handle the changes in the RAGPipeline interface.
  • Reasoning:
    The r2r/pipelines/basic/rag.py file has been updated to handle the changes in the RAGPipeline interface. The BasicRAGPipeline class now correctly uses a PromptProvider instance instead of system and task prompts. The __init__ method now correctly initializes the prompt_provider attribute. The transform_query, search, rerank_results, and _format_results methods have not been modified in this PR. No issues found in this file.
9. r2r/pipelines/web_search/rag.py:31:
  • Assessed confidence : 0%
  • Comment:
    The updates to the WebSearchRAGPipeline class correctly handle the changes in the RAGPipeline interface.
  • Reasoning:
    The r2r/pipelines/web_search/rag.py file has been updated to handle the changes in the RAGPipeline interface. The WebSearchRAGPipeline class now correctly uses a PromptProvider instance instead of system and task prompts. The __init__ method now correctly initializes the prompt_provider attribute. The transform_query, search, construct_context, and rerank_results methods have not been modified in this PR. No issues found in this file.

Workflow ID: wflow_JX8f1I2EpeiVLIUl


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

@emrgnt-cmplxty emrgnt-cmplxty deleted the feature/prompt-provider-and-type-reno branch March 14, 2024 21:22
emrgnt-cmplxty added a commit that referenced this pull request Mar 15, 2024
* feat: introduce Config class and update E2EPipelineFactory to use it (#172)

* add changes

* decouple config

* Feature/blast web and chat (#173)

* add changes

* decouple config

* blast web and chat

* Feature/prompt provider and type reno (#174)

* modify

* mostly complete.

* tweak types

* Feature/add app field to config (#175)

* modify

* mostly complete.

* tweak types

* fix config name issue, add app field

* tweak imports and all that

* Feature/add redis config option (#176)

* modify

* mostly complete.

* tweak types

* add redis config option

* erase cruft

* Feature/add redis config option (#177)

* modify

* mostly complete.

* tweak types

* add redis config option

* erase cruft

* update package deps (#178)
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.

None yet

1 participant