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

[DRAFT] [FEAUTURE] argilla: working with webhooks #5502

Open
wants to merge 29 commits into
base: feat/add-webhooks-feature-branch
Choose a base branch
from

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