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

Update file expiry with RAG chat #435

Merged
merged 4 commits into from
May 23, 2024

Conversation

rachaelcodes
Copy link
Contributor

Context

File expiry dates are set on file creation (since #425 ), but should be updated to give another 30 days before expiry whenever they are quoted in a RAG chat.

Changes proposed in this pull request

On a call to /post-message, the returned source files each have their expiry date extended for another 30 days (or as long into the future as configured with env vars).

Guidance to review

Could use Django shell to inspect a file expiry date before and after it is used in a RAG chat.

Relevant links

https://technologyprogramme.atlassian.net/browse/REDBOX-234

Things to check

  • [ ] I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed
  • [ ] I have run integration tests

@rachaelcodes rachaelcodes marked this pull request as ready for review May 22, 2024 11:50
django_app/redbox_app/redbox_core/views.py Show resolved Hide resolved
assert (
ChatMessage.objects.get(chat_history__id=session_id, role=ChatRoleEnum.ai).source_files.first() == uploaded_file
)
assert initial_file_expiry_date != File.objects.get(core_file_uuid=uploaded_file.core_file_uuid).expiry_date
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we make this more utilitarian by adding a last_used date, so it can be used for more than expiry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good idea :)


def __str__(self) -> str: # pragma: no cover
return f"{self.original_file_name} {self.user}"

def save(self, *args, **kwargs):
if not self.expiry_date:
if not self.last_referenced:
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we need this part if we have the migration? (or vice versa)

@rachaelcodes rachaelcodes force-pushed the feature/REDBOX-234-update-file-expiry-on-rag branch from 1ff6288 to eeeb8ad Compare May 23, 2024 08:34
@rachaelcodes rachaelcodes force-pushed the feature/REDBOX-234-update-file-expiry-on-rag branch from eeeb8ad to ce22eb9 Compare May 23, 2024 08:41
@rachaelcodes rachaelcodes force-pushed the feature/REDBOX-234-update-file-expiry-on-rag branch from ce22eb9 to 929d927 Compare May 23, 2024 08:49
@rachaelcodes rachaelcodes merged commit 51c9888 into main May 23, 2024
9 checks passed
@rachaelcodes rachaelcodes deleted the feature/REDBOX-234-update-file-expiry-on-rag branch May 23, 2024 10:27
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.

3 participants