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

refact: Refactor Document to be natively multimodal #17204

Merged
merged 10 commits into from
Dec 11, 2024
Merged

Conversation

masci
Copy link
Member

@masci masci commented Dec 9, 2024

Description

  • Make Document derive from Node and inherit its multimodal capabilities.
  • Deprecate old properties and classes.

Part of #15950

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

  • I added new unit tests to cover this change
  • I believe this change is already covered by existing unit tests

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 9, 2024
@@ -300,6 +301,7 @@ class BaseNode(BaseComponent):
metadata_separator: str = Field(
default="\n",
description="Separator between metadata fields when converting to string.",
alias="metadata_seperator",
Copy link
Collaborator

Choose a reason for hiding this comment

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

lol

@@ -537,18 +539,25 @@ def hash(self) -> str:


class Node(BaseNode):
text: MediaResource | None = Field(
text_resource: MediaResource | None = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this have an impact on the current openai multimodal stuff we had working?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it won't, even if the logic is almost duplicated (and we might want to refactor it later), that depends on ChatMessage and not Node.

Copy link
Collaborator

@logan-markewich logan-markewich left a comment

Choose a reason for hiding this comment

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

This looks mostly fine, but I need to take the PR for a run, want to make sure serialized data from the old stuff still works in the new stuff

Copy link
Collaborator

@logan-markewich logan-markewich left a comment

Choose a reason for hiding this comment

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

Tested a few indexes created in main and loading them with this PR (an in memory vector index, qdrant, as well as adding both nodes and documents into the docstore)

All tests worked (i.e. forward compatible), so I think this is safe? 🙏🏻

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 10, 2024
@masci masci merged commit b004ea0 into main Dec 11, 2024
11 checks passed
@masci masci deleted the massi/document-v2 branch December 11, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants