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

[FEAUTURE] argilla: working with webhooks #5502

Merged

Conversation

frascuchon
Copy link
Member

@frascuchon frascuchon commented Sep 17, 2024

Description

This PR adds the argilla.webhooks module to work with webhooks from the SDK. With the changes on this PR, users can easily create webhook listeners using the python SDK. For example, listening changes can be defined as follows:

import argilla as rg


@rg.webhook_listener(events="response.updated")
async def on_response_updated(response: rg.UserResponse, **kwargs):
   ... # do your work 

@rg.webhook_listener(events=["dataset.created", "dataset.updated", "dataset.published"])
async def on_dataset_event(
    type: str,
    timestamp: datetime,
    dataset: rg.Dataset,
    **kwargs,
):
    print(f"Event type {type} at {timestamp}")
    print(dataset.settings)

You can find a fully basic example using webhooks here

This is still a draft PR and the final feature may change.

Refs: #4658

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested

Checklist

  • I added relevant documentation
  • I followed the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • I confirm My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@davidberenstein1957
Copy link
Member

import ** as rb getting sentimental @frascuchon ?

@frascuchon
Copy link
Member Author

import ** as rb getting sentimental @frascuchon ?

I have been rubrixified. :-)

argilla/src/argilla/client.py Outdated Show resolved Hide resolved
argilla/src/argilla/client.py Outdated Show resolved Hide resolved
argilla/src/argilla/client.py Outdated Show resolved Hide resolved
argilla/src/argilla/webhooks/_event.py Outdated Show resolved Hide resolved
argilla/src/argilla/webhooks/_handler.py Outdated Show resolved Hide resolved
examples/webhooks/basic-webhooks/main.py Show resolved Hide resolved
@frascuchon frascuchon force-pushed the feat/argilla/working-with-webhooks branch from 0e766cc to a351a9d Compare September 19, 2024 09:42
@frascuchon frascuchon changed the title [DRAFT] [FEAUTURE] argilla: working with webhooks [FEAUTURE] argilla: working with webhooks Oct 2, 2024
argilla/CHANGELOG.md Outdated Show resolved Hide resolved
frascuchon and others added 8 commits October 2, 2024 16:12
# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->


**Type of change**
<!-- Please delete options that are not relevant. Remember to title the
PR according to the type of change -->

- Documentation update

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: Sara Han <[email protected]>
Co-authored-by: David Berenstein <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: José Francisco Calvo <[email protected]>
@frascuchon frascuchon merged commit 22dfb92 into feat/add-webhooks-feature-branch Oct 8, 2024
5 of 6 checks passed
@frascuchon frascuchon deleted the feat/argilla/working-with-webhooks branch October 8, 2024 15:31
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.

2 participants