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

Pipeline: Use capabilities instead of hardcoded LLMs #95

Merged
merged 8 commits into from
Apr 25, 2024

Conversation

kaancayli
Copy link
Contributor

@kaancayli kaancayli commented Apr 7, 2024

Motivation

In the future, we want Pyris to use a capability based system. This PR enables the use of the existing capability system in existing pipelines. Other than that, MessageDTO and IrisMessage models are replaced by PyrisMessage class.

Summary by CodeRabbit

  • New Features
    • Introduced PyrisMessage model and IrisMessageRole enumeration for enhanced message handling.
    • Updated message conversion functionality, including role mapping and content checking.
  • Enhancements
    • Improved chat functionality in tutor chat pipeline with new message types and better exception handling.
    • Enhanced message format conversion in external communication modules.
  • Refactor
    • Updated import paths across various modules for better code organization.
    • Renamed IrisMessage to PyrisMessage in multiple files for consistency.
  • Bug Fixes
    • Adjusted optional attribute types in DTOs to handle null values more gracefully.

Copy link
Contributor

coderabbitai bot commented Apr 7, 2024

Walkthrough

The recent update focuses on enhancing message conversion and handling across the application, particularly in the domain of chat and pipeline execution. It introduces PyrisMessage and IrisMessageRole to standardize message formats and roles. Additionally, it updates optional attributes in DTOs, refines import paths, and aligns external model interactions with the new message structures. These changes aim to improve flexibility, readability, and the handling of chat history in tutoring and pipeline functionalities.

Changes

Files Change Summary
app/common/__init__.py
app/domain/__init__.py
.../pipeline_execution_dto.py
Updated import paths.
app/common/message_converters.py
.../ollama.py
.../openai_chat.py
Updated message conversion functions, roles, and content handling.
app/domain/data/feedback_dto.py
.../programming_exercise_dto.py
Changed attribute types to Optional[str].
app/domain/pyris_message.py Introduced PyrisMessage model and IrisMessageRole enumeration.
.../tutor_chat/tutor_chat_pipeline_execution_dto.py Changed chat_history type to a list of PyrisMessage.
app/llm/external/model.py
.../request_handler/basic_request_handler.py
.../capability_request_handler.py
.../request_handler_interface.py
Renamed IrisMessage to PyrisMessage and updated related functionality.
app/pipeline/chat/file_selector_pipeline.py
.../tutor_chat_pipeline.py
Updated request handling, data types, exception handling, and message conversion.
app/web/status/status_update.py Adjusted initialization based on initial_stages.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 17d87b6 and cfa9502.
Files selected for processing (2)
  • app/pipeline/chat/tutor_chat_pipeline.py (7 hunks)
  • app/pipeline/shared/summary_pipeline.py (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/pipeline/chat/tutor_chat_pipeline.py
Additional comments not posted (2)
app/pipeline/shared/summary_pipeline.py (2)

8-8: Imports for CapabilityRequestHandler and RequirementList are correctly added to support the new capability-based system.


26-31: Initialization of CapabilityRequestHandler with specific requirements via RequirementList is correctly implemented. This aligns well with the PR's objectives to enhance capability handling.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Hialus Hialus changed the title Feature/enable capability use Pipeline: Use capabilities instead of hardcoded LLMs Apr 8, 2024
@Hialus Hialus added this to the 1.0.1 milestone Apr 8, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 24, 2024
Copy link
Member

@Hialus Hialus left a comment

Choose a reason for hiding this comment

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

When running this I get this error:

pyris-app    |   File "/app/app/main.py", line 4, in <module>
pyris-app    |     from app.web.routers.health import router as health_router
pyris-app    |   File "/app/app/web/routers/__init__.py", line 2, in <module>
pyris-app    |     from ..routers.pipelines import router as pipelines_router
pyris-app    |   File "/app/app/web/routers/pipelines.py", line 9, in <module>
pyris-app    |     from app.pipeline.chat.tutor_chat_pipeline import TutorChatPipeline
pyris-app    |   File "/app/app/pipeline/chat/tutor_chat_pipeline.py", line 13, in <module>
pyris-app    |     from common import convert_iris_message_to_langchain_message
pyris-app    | ModuleNotFoundError: No module named 'common'
pyris-app exited with code 1

Please ensure that all imports are correct by either giving the full path or using relative paths. I'd reccommend the latter

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 25, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 25, 2024
@kaancayli kaancayli requested a review from Hialus April 25, 2024 17:11
@kaancayli
Copy link
Contributor Author

@Hialus I have updated the problematic import statements. For general overhaul of import statements I will create an issue

Copy link
Member

@Hialus Hialus left a comment

Choose a reason for hiding this comment

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

Looks mostly good, however the capability declarations are not sensible.

Also you did not adjust the SummaryPipeline.

app/pipeline/chat/file_selector_pipeline.py Outdated Show resolved Hide resolved
app/pipeline/chat/tutor_chat_pipeline.py Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 25, 2024
@Hialus Hialus merged commit bfa9966 into main Apr 25, 2024
5 checks passed
@Hialus Hialus deleted the feature/enable-capability-use branch April 25, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants