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

Added threadId to Element #1005

Merged

Conversation

mayaankvad
Copy link
Contributor

@mayaankvad mayaankvad commented May 19, 2024

Adding this as prep for a custom data layer. This change will allow more flexible custom data layers, especially document ones like Dynamo.

Currently you can get the threadId in create element:

async def create_element(self, element: "Element"):
        thread_id = element.thread_id)

This change adds the thread_id param to delete element:

async def delete_element(self, element_id: str, thread_id: Optional[str]):

All current data layers have been modified to accept the new param. The Custom Data Layer API Docs will need to be updated. Should not be a breaking change but should be a mention in a migration guide.

@@ -114,7 +114,7 @@ async def get_thread_author(self, thread_id: str):
return "admin"

async def list_threads(
self, pagination: cl_data.Pagination, filter: cl_data.ThreadFilter
self, pagination: cl_data.Pagination, filters: cl_data.ThreadFilter
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed error:

Parameter 'filters' has been renamed to 'filter' in overriding 'TestDataLayer.list_threads' method PylintW0237:arguments-renamed

Method "list_threads" overrides class "BaseDataLayer" in an incompatible manner
  Parameter 3 name mismatch: base parameter is named "filters", override parameter is named "filter" Pylance reportIncompatibleMethodOverride
__init__.py(118, 15): Overridden method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

git hook pnpm lint-staged has made changes everywhere here to add the logger on a new line.

@willydouhard willydouhard merged commit d19ed3c into Chainlit:main May 23, 2024
4 checks passed
@mayaankvad mayaankvad deleted the feature/add-threadId-to-element branch May 24, 2024 01:01
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

2 participants