Skip to content

Conversation

@lxobr
Copy link
Collaborator

@lxobr lxobr commented Mar 13, 2025

Description

  • Created get_default_tasks_by_indices to filter default tasks by specific indices
  • Added get_no_summary_tasks function to skip summarization tasks
  • Added get_just_chunks_tasks function for chunk extraction and data points only
  • Added NO_SUMMARIES and JUST_CHUNKS to the TaskGetters enum

DCO Affirmation

I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin

Summary by CodeRabbit

  • New Features
    • The evaluation configuration now includes expanded task retrieval options. Users can choose customized modes that bypass summarization or focus solely on extracting data chunks, offering a more tailored evaluation experience.
    • Enhanced asynchronous task processing brings increased flexibility and smoother performance during task selection.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

Walkthrough

This pull request removes unused import statements from two corpus builder modules and updates the task retrieval functionality. The TaskGetters enum is enhanced with two new members, NO_SUMMARIES and JUST_CHUNKS, which refer to corresponding asynchronous functions. A deprecated default task getter file has been removed, and a new file has been introduced to support task retrieval by indices. Additionally, the evaluation configuration now accepts the new task getter types alongside existing options.

Changes

File(s) Change Summary
cognee/eval_framework/corpus_builder/corpus_builder_executor.py, cognee/eval_framework/corpus_builder/run_corpus_builder.py Removed unused import statements (deleted TaskGetters import in the executor and chunk function import in run_corpus_builder)
cognee/eval_framework/corpus_builder/task_getters/TaskGetters.py Added new enum members NO_SUMMARIES and JUST_CHUNKS linked to new task getter functions
cognee/eval_framework/corpus_builder/task_getters/default_task_getter.py Removed the DefaultTaskGetter class and file
cognee/eval_framework/corpus_builder/task_getters/get_default_tasks_by_indices.py Introduced asynchronous functions: get_default_tasks_by_indices, get_no_summary_tasks, and get_just_chunks_tasks utilizing TextChunker
cognee/eval_framework/eval_config.py Updated task_getter_type to include 'NoSummaries' and 'JustChunks' as valid options alongside existing types

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as EvalConfig
    participant T as TaskGetters
    participant G as Task Getter Functions

    U->>C: Read configuration (task_getter_type option)
    C->>T: Determine task getter based on type
    alt Default
        T->>G: get_default_tasks_by_indices(...)
    else NoSummaries
        T->>G: get_no_summary_tasks(...)
    else JustChunks
        T->>G: get_just_chunks_tasks(...)
    end
    G-->>T: Return tasks
    T-->>C: Return tasks
    C-->>U: Provide retrieved tasks
Loading

Suggested labels

run-checks

Suggested reviewers

  • hajdul88

Poem

I'm a rabbit hopping through code so light,
Tweaking and tuning from morning to night.
New task getters sprout like buds in spring,
With async flows and updates they bring.
A carrot of change in each line we compose,
Hoppily celebrating how our program grows!
🥕🐇

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
cognee/eval_framework/corpus_builder/task_getters/get_default_tasks_by_indices.py (3)

7-19: Improve type annotations for the chunker parameter

The function effectively filters tasks by indices with proper error handling for out-of-range indices. However, the type annotation for the chunker parameter could be improved.

- async def get_default_tasks_by_indices(
-     indices: List[int], chunk_size: int = None, chunker=TextChunker
- ) -> List[Task]:
+ from typing import Type
+ 
+ async def get_default_tasks_by_indices(
+     indices: List[int], chunk_size: Optional[int] = None, chunker: Type[TextChunker] = TextChunker
+ ) -> List[Task]:

Also consider handling the case where an empty list of indices is provided, perhaps returning an empty list with a warning log.


21-27: Consider expanding docstring with parameter details

The function works correctly to filter out summarization tasks. The comment explaining the indices is helpful, but consider expanding the docstring to include parameter descriptions.

async def get_no_summary_tasks(chunk_size: int = None, chunker=TextChunker) -> List[Task]:
-    """Returns default tasks without summarization tasks."""
+    """Returns default tasks without summarization tasks.
+    
+    Args:
+        chunk_size: Optional size for text chunks
+        chunker: Chunker class to use for text chunking
+        
+    Returns:
+        List of tasks excluding summarization tasks
+    """

29-33: Avoid duplicating index documentation

The function correctly implements the task filtering logic, but the comment about indices is duplicated from the previous function.

Consider centralizing this information in a module-level docstring or constants to avoid duplication and improve maintainability:

+ # Task indices mapping
+ TASK_INDICES = {
+     "classify": 0,
+     "check_permissions": 1,
+     "extract_chunks": 2, 
+     "extract_graph": 3,
+     "summarize": 4,
+     "add_data_points": 5
+ }
+

async def get_just_chunks_tasks(chunk_size: int = None, chunker=TextChunker) -> List[Task]:
    """Returns default tasks with only chunk extraction and data points addition."""
-    # Default tasks indices: 0=classify, 1=check_permissions, 2=extract_chunks, 3=extract_graph, 4=summarize, 5=add_data_points
+    # Only include classify, permissions, chunk extraction and data points
    return await get_default_tasks_by_indices([0, 1, 2, 5], chunk_size=chunk_size, chunker=chunker)

This would make the code more maintainable if task indices change in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f206edb and 853eb53.

📒 Files selected for processing (6)
  • cognee/eval_framework/corpus_builder/corpus_builder_executor.py (0 hunks)
  • cognee/eval_framework/corpus_builder/run_corpus_builder.py (0 hunks)
  • cognee/eval_framework/corpus_builder/task_getters/TaskGetters.py (1 hunks)
  • cognee/eval_framework/corpus_builder/task_getters/default_task_getter.py (0 hunks)
  • cognee/eval_framework/corpus_builder/task_getters/get_default_tasks_by_indices.py (1 hunks)
  • cognee/eval_framework/eval_config.py (1 hunks)
💤 Files with no reviewable changes (3)
  • cognee/eval_framework/corpus_builder/run_corpus_builder.py
  • cognee/eval_framework/corpus_builder/task_getters/default_task_getter.py
  • cognee/eval_framework/corpus_builder/corpus_builder_executor.py
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: lint (ubuntu-latest, 3.11.x)
  • GitHub Check: lint (ubuntu-latest, 3.10.x)
  • GitHub Check: Build Cognee Backend Docker App Image
  • GitHub Check: docker-compose-test
🔇 Additional comments (4)
cognee/eval_framework/eval_config.py (1)

11-13: Clean formatting and well-documented options

The updated formatting for task_getter_type improves readability and the comment clearly indicates all the available options. This change aligns well with the new task getter types introduced in the PR.

cognee/eval_framework/corpus_builder/task_getters/TaskGetters.py (2)

8-11: Imports correctly added for new task getter functions

The import statement has been properly updated to include the new task getter functions from the newly created module.


19-20: New enum members follow consistent pattern

The additions of NO_SUMMARIES and JUST_CHUNKS enum members maintain the same structure as existing members, keeping the codebase consistent.

cognee/eval_framework/corpus_builder/task_getters/get_default_tasks_by_indices.py (1)

1-5: Imports look good

All necessary imports are included for the functionality being implemented.

@lxobr lxobr self-assigned this Mar 13, 2025
@lxobr lxobr requested a review from hajdul88 March 14, 2025 13:15
DEFAULT = ("Default", get_default_tasks)
CASCADE_GRAPH = ("CascadeGraph", get_cascade_graph_tasks)
NO_SUMMARIES = ("NoSummaries", get_no_summary_tasks)
JUST_CHUNKS = ("JustChunks", get_just_chunks_tasks)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe OnlyChunks, its just naming so not that important

"""Returns default tasks without summarization tasks."""
# Default tasks indices: 0=classify, 1=check_permissions, 2=extract_chunks, 3=extract_graph, 4=summarize, 5=add_data_points
return await get_default_tasks_by_indices(
[0, 1, 2, 3, 5], chunk_size=chunk_size, chunker=chunker
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure I like the indices because whenever we change the default pipeline, we will have to update the index mapping. Fine for now but I think we will have to find a bit nicer solution

@lxobr lxobr merged commit cad9e0c into dev Mar 14, 2025
41 checks passed
@lxobr lxobr deleted the feat/COG-1491-pipeline-steps-in-eval branch March 14, 2025 13:20
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.

3 participants