-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
98 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
## Description | ||
|
||
This is a basic webhook example to show how to setup webhook listeners using the argilla SDK | ||
This is a basic webhook example to show how to configure webhook listeners using the argilla SDK | ||
|
||
The application defines three webhook listeners for the following events: | ||
|
||
- Record events: `record.deleted`, `record.completed` | ||
- Dataset events: `dataset.created`, `dataset.updated`, `dataset.published`, `dataset.deleted` | ||
- Response events: `response.created`, `response.updated` | ||
|
||
You can visit the [Argilla documentation](https://docs.argilla.io/dev/how_to_guides/webhooks) for more information. | ||
|
||
## Running the app | ||
|
||
1. Start argilla server and argilla worker | ||
This example is intended to be used locally. You can check [this space](https://huggingface.co/spaces/argilla/argilla-webhooks) | ||
for a remote example. | ||
|
||
First, you must start the argilla server. We recommend you to use the docker installation. You can run the following commands to start the argilla server: | ||
```bash | ||
pdm server start | ||
pdm worker | ||
mkdir argilla && cd argilla | ||
curl https://raw.githubusercontent.com/argilla-io/argilla/main/examples/deployments/docker/docker-compose.yaml -o docker-compose.yaml | ||
docker compose up -d | ||
``` | ||
|
||
2. Start the app | ||
For more information on how to install the argilla server, please refer to the [argilla documentation](https://docs.argilla.io/latest/getting_started). | ||
|
||
Once the argilla server is up and running, start the webhook server by running the following command: | ||
|
||
```bash | ||
ARGILLA_API_KEY=argilla.apikey \ | ||
WEBHOOK_SERVER_URL=http://host.docker.internal:8000 \ | ||
uvicorn main:server | ||
``` | ||
|
||
The `ARGILLA_API_KEY` environment variable should be set to the API key of the argilla server. | ||
The `WEBHOOK_SERVER_URL` environment variable should be set to the URL where the webhook server is running. | ||
In this case, we are using `http://host.docker.internal:8000` because the webhook calls will be done inside a docker container. | ||
|
||
The application will remove all existing webhook listeners and create new ones for the events mentioned above. | ||
|
||
## Testing the app | ||
|
||
You can see in se server logs traces when working with dataset, records and responses in the argilla server | ||
When you start working with the argilla server, you can see the logs in the webhook server. | ||
You can test the webhook listeners by creating, updating, and deleting datasets, responses and records in the argilla server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
argilla @ git+https://github.com/argilla-io/argilla.git@feat/argilla/working-with-webhooks#subdirectory=argilla | ||
fastapi | ||
uvicorn[standard] | ||
argilla ~= 2.5.0 |