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

Graph updates for COG-166 #88

Closed
wants to merge 5 commits into from
Closed

Graph updates for COG-166 #88

wants to merge 5 commits into from

Conversation

Vasilije1990
Copy link
Contributor

@Vasilije1990 Vasilije1990 commented Apr 27, 2024

Summary by CodeRabbit

  • Refactor
    • Updated type annotations in the IngestionData class to use Union for the data attribute.
    • Added return type annotations to the get_data, get_identifier, and get_metadata methods in the IngestionData class.
    • Removed the import statement for create_vector_memory from the module cognee/modules/memory/vector/__init__.py.
    • Removed imports of is_existing_memory and register_memory_for_user and added an import for create_information_points in the cognee/modules/users/memory/__init__.py.

Copy link
Contributor

coderabbitai bot commented Apr 27, 2024

Walkthrough

A delightful addition has been made to the GitHub Actions workflow, introducing a new environment variable setting 'dev'. This tweak is likely to impact how the tests are executed or configured during the development phase. Additionally, there are changes in type annotations and import statements across various Python modules, refining the codebase structure and functionality.

Changes

File Path Change Summary
cognee/modules/ingestion/data_types/IngestionData.py Updated type annotations in IngestionData class and method return types.
cognee/modules/memory/vector/__init__.py Removed import statement for create_vector_memory in the vector module.
cognee/modules/users/memory/__init__.py Removed imports of is_existing_memory and register_memory_for_user, added import for create_information_points.
cognee/config.py Explicit return type annotations added to load and save methods in Config class.
cognee/fetch_secret.py Updated fetch_secret function with type annotations for parameters and return type.
cognee/infrastructure/files/storage/LocalStorage.py Type annotations added to method parameters and return types in LocalStorage class.
cognee/utils.py Type hinting and docstring added to send_telemetry, project_api_key updated in Posthog, return type hint added to get_document_names.

🐰✨🌟
In the realm of bits and bytes,
A small change brings forth the lights.
'Dev' murmurs the wind,
Through code it gently twinned,
The rabbit dances with pure delight!
🌟✨🐰


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between a855ebb and 0b54f9e.
Files selected for processing (4)
  • cognee/config.py (2 hunks)
  • cognee/fetch_secret.py (1 hunks)
  • cognee/infrastructure/files/storage/LocalStorage.py (3 hunks)
  • cognee/utils.py (3 hunks)
Files skipped from review due to trivial changes (2)
  • cognee/config.py
  • cognee/fetch_secret.py
Additional comments not posted (6)
cognee/infrastructure/files/storage/LocalStorage.py (4)

10-10: Initialization of storage_path looks good with proper type annotation.


25-25: Retrieval method correctly handles file reading with adjustable modes.


36-36: File removal method is correctly implemented with proper path handling.


44-44: Proper handling of directory removal with exception management for FileNotFoundError.

cognee/utils.py (2)

Line range hint 23-39: Telemetry function enhancements with type hinting and comprehensive docstring are well implemented.


54-54: Function to get document names is well-documented and handles various input types effectively.


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.

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: 1

@@ -1,13 +1,16 @@
from typing import Protocol, BinaryIO

from typing import Union, Protocol, BinaryIO
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the redundant imports of Protocol and BinaryIO as they are already imported at the beginning of the file.

- from typing import Union, Protocol, BinaryIO
+ from typing import Union

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
from typing import Union, Protocol, BinaryIO
from typing import Union

@Vasilije1990 Vasilije1990 changed the title Added init for LanceDB for tests to pass Graph updates for COG-166 Apr 27, 2024
Copy link

gitguardian bot commented Apr 27, 2024

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10531072 Triggered Generic High Entropy Secret 0b54f9e cognee/utils.py View secret
10531072 Triggered Generic High Entropy Secret 0b54f9e cognee/utils.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

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: 1

self.storage_path = storage_path

def store(self, file_path: str, data: Union[BinaryIO, str]):
def store(self, file_path: str, data: Union[BinaryIO, str]) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using os.path.join for constructing file paths to ensure cross-platform compatibility.

- full_file_path = self.storage_path + "/" + file_path
+ full_file_path = os.path.join(self.storage_path, file_path)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def store(self, file_path: str, data: Union[BinaryIO, str]) -> None:
def store(self, file_path: str, data: Union[BinaryIO, str]) -> None:
full_file_path = os.path.join(self.storage_path, file_path)

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