diff --git a/argilla/src/argilla/datasets/_resource.py b/argilla/src/argilla/datasets/_resource.py index f631d32653..7637d90da0 100644 --- a/argilla/src/argilla/datasets/_resource.py +++ b/argilla/src/argilla/datasets/_resource.py @@ -238,7 +238,7 @@ def api_model(self) -> DatasetModel: def _publish(self) -> "Dataset": self._settings.create() - self._api.publish(dataset_id=self._model.id) + # self._api.publish(dataset_id=self._model.id) return self.get() diff --git a/examples/add-records-to-draft-dataset.ipynb b/examples/add-records-to-draft-dataset.ipynb new file mode 100644 index 0000000000..9ac6898902 --- /dev/null +++ b/examples/add-records-to-draft-dataset.ipynb @@ -0,0 +1,178 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/ben/code/argilla/.venv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + } + ], + "source": [ + "from uuid import uuid4\n", + "import argilla as rg" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/ben/code/argilla/argilla/src/argilla/datasets/_resource.py:250: UserWarning: Workspace not provided. Using default workspace: argilla id: 735cae0d-eb08-45c3-ad79-0a11ad4dd2c2\n", + " warnings.warn(f\"Workspace not provided. Using default workspace: {workspace.name} id: {workspace.id}\")\n" + ] + }, + { + "data": { + "text/plain": [ + "Dataset(id=UUID('bb50f766-f6f8-4526-a470-75757ae21fb3') inserted_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 633100) updated_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 644515) name='trtrt' status='draft' guidelines=None allow_extra_metadata=False distribution=OverlapTaskDistributionModel(strategy='overlap', min_submitted=1) workspace_id=UUID('735cae0d-eb08-45c3-ad79-0a11ad4dd2c2') last_activity_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 644515))" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "client = rg.Argilla()\n", + "\n", + "dataset_name = \"trtrt\"\n", + "\n", + "dataset = rg.Dataset(\n", + " name=dataset_name,\n", + " settings=rg.Settings(\n", + " fields=[\n", + " rg.TextField(name=\"test_field\"),\n", + " ],\n", + " questions=[rg.RatingQuestion(name=\"test_question\", values=[1, 2, 3, 4, 5])],\n", + " ),\n", + ")\n", + "dataset.create()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
DatasetRecords: The provided batch size 256 was normalized. Using value 1.\n", + "\n" + ], + "text/plain": [ + "DatasetRecords: The provided batch size \u001b[1;36m256\u001b[0m was normalized. Using value \u001b[1;36m1\u001b[0m.\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sending records...: 0%| | 0/1 [00:00, ?batch/s]" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sending records...: 100%|██████████| 1/1 [00:00<00:00, 6.08batch/s]\n" + ] + }, + { + "data": { + "text/plain": [ + "DatasetRecords(Dataset(id=UUID('bb50f766-f6f8-4526-a470-75757ae21fb3') inserted_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 633100) updated_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 644515) name='trtrt' status='draft' guidelines=None allow_extra_metadata=False distribution=OverlapTaskDistributionModel(strategy='overlap', min_submitted=1) workspace_id=UUID('735cae0d-eb08-45c3-ad79-0a11ad4dd2c2') last_activity_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 644515)))" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dataset.records.log(\n", + " [\n", + " {\n", + " \"test_field\": \"test\",\n", + " }\n", + " ]\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "TextQuestion(name=feedback, title=feedback, description=None, type=text, required=True) " + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dataset.settings.questions.add(rg.TextQuestion(\"feedback\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Dataset(id=UUID('bb50f766-f6f8-4526-a470-75757ae21fb3') inserted_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 633100) updated_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 644515) name='trtrt' status='draft' guidelines=None allow_extra_metadata=False distribution=OverlapTaskDistributionModel(strategy='overlap', min_submitted=1) workspace_id=UUID('735cae0d-eb08-45c3-ad79-0a11ad4dd2c2') last_activity_at=datetime.datetime(2024, 10, 1, 9, 41, 14, 644515))" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dataset.update()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}