filename
stringclasses
32 values
chunks
stringlengths
28
500
repo_name
stringclasses
1 value
argilla/argilla/docs/index.md
description: Argilla is a collaboration platform for AI engineers and domain experts that require high-quality outputs, full data ownership, and overall efficiency. hide: navigation
argilla-io/argilla
argilla/argilla/docs/index.md
Welcome to Argilla Argilla is a collaboration platform for AI engineers and domain experts that require high-quality outputs, full data ownership, and overall efficiency. !!! SUCCESS "Welcome to Argilla 2.x!" To skip the introductions and go directly to installing and creating your first dataset, see Quickstart. !!! DANGER "Looking for Argilla 1.x?" Looking for documentation for Argilla 1.x? Visit the latest release here.
argilla-io/argilla
argilla/argilla/docs/index.md
!!! NOTE "Migrate to Argilla 2.x" Want to learn how to migrate from Argilla 1.x to 2.x? Take a look at our dedicated Migration Guide.
argilla-io/argilla
argilla/argilla/docs/index.md
__Get started in 5 minutes!__ --- Install `argilla` with `pip` and deploy a `Docker` locally or for free on Hugging Face to get up and running in minutes. [:octicons-arrow-right-24: Quickstart](getting_started/quickstart.md) - __Educational guides__ --- Get familiar with basic and complex workflows for Argilla. From managing `Users`, `Workspaces`. `Datasets` and `Records` to fine-tuning a model. [:octicons-arrow-right-24: Learn more](how_to_guides/index.md)
argilla-io/argilla
argilla/argilla/docs/index.md
Why use Argilla? Whether you are working on monitoring and improving complex generative tasks involving LLM pipelines with RAG, or you are working on a predictive task for things like AB-testing of span- and text-classification models. Our versatile platform helps you ensure your data work pays off. Improve your AI output quality through data quality
argilla-io/argilla
argilla/argilla/docs/index.md
Compute is expensive and output quality is important. We help you focus on data, which tackles the root cause of both of these problems at once. Argilla helps you to achieve and keep high-quality standards for your data. This means you can improve the quality of your AI output. Take control of your data and models
argilla-io/argilla
argilla/argilla/docs/index.md
Most AI platforms are black boxes. Argilla is different. We believe that you should be the owner of both your data and your models. That's why we provide you with all the tools your team needs to manage your data and models in a way that suits you best. Improve efficiency by quickly iterating on the right data and models
argilla-io/argilla
argilla/argilla/docs/index.md
Gathering data is a time-consuming process. Argilla helps by providing a platform that allows you to interact with your data in a more engaging way. This means you can quickly and easily label your data with filters, AI feedback suggestions and semantic search. So you can focus on training your models and monitoring their performance. What do people build with Argilla?
argilla-io/argilla
argilla/argilla/docs/index.md
Datasets and models Argilla is a tool that can be used to achieve and keep high-quality data standards with a focus on NLP and LLMs. Our community uses Argilla to create amazing open-source datasets and models, and we love contributions to open-source ourselves too. Our cleaned UltraFeedback dataset and the Notus and Notux models, where we improved benchmark and empirical human judgment for the Mistral and Mixtral models with cleaner data using human feedback.
argilla-io/argilla
argilla/argilla/docs/index.md
Our distilabeled Intel Orca DPO dataset and the improved OpenHermes model, show how we improve model performance by filtering out 50% of the original dataset through human and AI feedback.
argilla-io/argilla
argilla/argilla/docs/index.md
Projects and pipelines AI teams from companies like the Red Cross, Loris.ai and Prolific use Argilla to improve the quality and efficiency of AI projects. They shared their experiences in our AI community meetup. AI for good: the Red Cross presentation showcases how their experts and AI team collaborate by classifying and redirecting requests from refugees of the Ukrainian crisis to streamline the support processes of the Red Cross.
argilla-io/argilla
argilla/argilla/docs/index.md
Customer support: during the Loris meetup they showed how their AI team uses unsupervised and few-shot contrastive learning to help them quickly validate and gain labelled samples for a huge amount of multi-label classifiers.
argilla-io/argilla
argilla/argilla/docs/index.md
Research studies: the showcase from Prolific announced their integration with our platform. They use it to actively distribute data collection projects among their annotating workforce. This allows them to quickly and efficiently collect high-quality data for their research studies.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Migrate your legacy datasets to Argilla V2 This guide will help you migrate task specific datasets to Argilla V2. These do not include the FeedbackDataset which is just an interim naming convention for the latest extensible dataset. Task specific datasets are datasets that are used for a specific task, such as text classification, token classification, etc. If you would like to learn about the backstory of SDK this migration, please refer to the SDK migration blog post.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
!!! note Legacy Datasets include: DatasetForTextClassification, DatasetForTokenClassification, and DatasetForText2Text. To follow this guide, you will need to have the following prerequisites: An argilla 1.* server instance running with legacy datasets. An argilla >=1.29 server instance running. If you don't have one, you can create one by following the Argilla installation guide. The argilla sdk package installed in your environment.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
If your current legacy datasets are on a server with Argilla release after 1.29, you could chose to recreate your legacy datasets as new datasets on the same server. You could then upgrade the server to Argilla 2.0 and carry on working their. Your legacy datasets will not be visible on the new server, but they will remain in storage layers if you need to access them.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Steps The guide will take you through three steps: Retrieve the legacy dataset from the Argilla V1 server using the new argilla package. Define the new dataset in the Argilla V2 format. Upload the dataset records to the new Argilla V2 dataset format and attributes. Step 1: Retrieve the legacy dataset Connect to the Argilla V1 server via the new argilla package. The new sdk contains a v1 module that allows you to connect to the Argilla V1 server: ```python import argilla.v1 as rg_v1
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Initialize the API with an Argilla server less than 2.0 api_url = "" api_key = "" rg_v1.init(api_url, api_key) ``` Next, load the dataset settings and records from the Argilla V1 server: ```python dataset_name = "news-programmatic-labeling" workspace = "demo" settings_v1 = rg_v1.load_dataset_settings(dataset_name, workspace) records_v1 = rg_v1.load(dataset_name, workspace) hf_dataset = records_v1.to_datasets() ``` Your legacy dataset is now loaded into the hf_dataset object.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Step 2: Define the new dataset Define the new dataset in the Argilla V2 format. The new dataset format is defined in the argilla package. You can create a new dataset with the Settings and Dataset classes: First, instantiate the Argilla class to connect to the Argilla V2 server: ```python import argilla as rg
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
client = rg.Argilla() ``` Next, define the new dataset settings: python settings = rg.Settings( fields=[ rg.TextField(name="text"), # (1) ], questions=[ rg.LabelQuestion(name="label", labels=settings_v1.label_schema), # (2) ], metadata=[ rg.TermsMetadataProperty(name="split"), # (3) ], vectors=[ rg.VectorField(name='mini-lm-sentence-transformers', dimensions=384), # (4) ], )
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
The default name for text classification is text, but we should provide all names included in record.inputs. The basis question for text classification is a LabelQuestion for single-label or MultiLabelQuestion for multi-label classification. Here, we need to provide all relevant metadata fields. The vectors fields available in the dataset. Finally, create the new dataset on the Argilla V2 server: python dataset = rg.Dataset(name=dataset_name, settings=settings) dataset.create()
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
!!! note If a dataset with the same name already exists, the create method will raise an exception. You can check if the dataset exists and delete it before creating a new one.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Step 3: Upload the dataset records To upload the records to the new server, we will need to convert the records from the Argilla V1 format to the Argilla V2 format. The new argilla sdk package uses a generic Record class, but legacy datasets have specific record classes. We will need to convert the records to the generic Record class. Here are a set of example functions to convert the records for single-label and multi-label classification. You can modify these functions to suit your dataset.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
=== "For single-label classification" === "For multi-label classification" === "For token classification" === "For Text generation" The functions above depend on the users_by_name dictionary and the current_user object to assign responses to users, we need to load the existing users. You can retrieve the users from the Argilla V2 server and the current user as follows: ```python
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
For users_by_name = {user.username: user for user in client.users} current_user = client.me ``` Finally, upload the records to the new dataset using the log method and map functions. ```python records = [] for data in hf_records: records.append(map_to_record_for_single_label(data, users_by_name, current_user))
argilla-io/argilla
argilla/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md
Upload the records to the new dataset dataset.records.log(records) ``` You have now successfully migrated your legacy dataset to Argilla V2. For more guides on how to use the Argilla SDK, please refer to the How to guides.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
description: In this section, we will provide a step-by-step guide to show how to manage records. Add, update, and delete records This guide provides an overview of records, explaining the basics of how to define and manage them in Argilla.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
A record in Argilla is a data item that requires annotation, consisting of one or more fields. These are the pieces of information displayed to the user in the UI to facilitate the completion of the annotation task. Each record also includes questions that annotators are required to answer, with the option of adding suggestions and responses to assist them. Guidelines are also provided to help annotators effectively complete their tasks.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
A record is part of a dataset, so you will need to create a dataset before adding records. Check these guides to learn how to create a dataset. !!! info "Main Class"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Add records You can add records to a dataset in two different ways: either by using a dictionary or by directly initializing a Record object. You should ensure that fields, metadata and vectors match those configured in the dataset settings. In both cases, are added via the Dataset.records.log method. As soon as you add the records, these will be available in the Argilla UI. If they do not appear in the UI, you may need to click the refresh button to update the view.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
!!! tip Take some time to inspect the data before adding it to the dataset in case this triggers changes in the questions or fields. !!! note If you are planning to use public data, the Datasets page of the Hugging Face Hub is a good place to start. Remember to always check the license to make sure you can legally use it for your specific use case. === "As Record objects" === "From a generic data structure" === "From a Hugging Face dataset"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Metadata Record metadata can include any information about the record that is not part of the fields in the form of a dictionary. To use metadata for filtering and sorting records, make sure that the key of the dictionary corresponds with the metadata property name. When the key doesn't correspond, this will be considered extra metadata that will get stored with the record (as long as allow_extra_metadata is set to True for the dataset), but will not be usable for filtering and sorting.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
!!! note Remember that to use metadata within a dataset, you must define a metadata property in the dataset settings. === "As Record objects" === "From a generic data structure" You can add metadata to a record directly as a dictionary structure, where the keys correspond to the names of metadata properties in the dataset and the values are the metadata to be added. Remember that you can also use the mapping parameter to specify the data structure.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Vectors You can associate vectors, like text embeddings, to your records. They can be used for semantic search in the UI and the Python SDK. Make sure that the length of the list corresponds to the dimensions set in the vector settings. !!! note Remember that to use vectors within a dataset, you must define them in the dataset settings. === "As Record objects" === "From a generic data structure"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Suggestions Suggestions refer to suggested responses (e.g. model predictions) that you can add to your records to make the annotation process faster. These can be added during the creation of the record or at a later stage. Only one suggestion can be provided for each question, and suggestion values must be compliant with the pre-defined questions e.g. if we have a RatingQuestion between 1 and 5, the suggestion should have a valid value within that range.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
=== "As Record objects" You can also add suggestions to a record in an initialized Record object. === "From a generic data structure" You can add suggestions as a dictionary, where the keys correspond to the names of the labels that were configured for your dataset. Remember that you can also use the mapping parameter to specify the data structure.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Responses If your dataset includes some annotations, you can add those to the records as you create them. Make sure that the responses adhere to the same format as Argilla's output and meet the schema requirements for the specific type of question being answered. Make sure to include the user_id in case you're planning to add more than one response for the same question, if not responses will apply to all the annotators.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
!!! note Keep in mind that records with responses will be displayed as "Draft" in the UI. === "As Record objects" You can also add suggestions to a record in an initialized Record object. === "From a generic data structure"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
List records To list records in a dataset, you can use the records method on the Dataset object. This method returns a list of Record objects that can be iterated over to access the record properties. ```python for record in dataset.records( with_suggestions=True, with_responses=True, with_vectors=True ): ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Update records You can update records in a dataset calling the log method on the Dataset object. To update a record, you need to provide the record id and the new data to be updated. ```python data = dataset.records.to_list(flatten=True) updated_data = [ { "text": sample["text"], "label": "positive", "id": sample["id"], } for sample in data ] dataset.records.log(records=updated_data) ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
=== "Update the metadata" The metadata of Record object is a python dictionary. So to update the metadata of a record, you can iterate over the records and update the metadata by key or using metadata.update. After that, you should update the records in the dataset.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
=== "Update vectors" When a new vector field is added to the dataset settings, or some value for the existing record vectors must updated, you can iterate over the records and update the vectors in the same way as the metadata.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/record.md
Delete records You can delete records in a dataset calling the delete method on the Dataset object. To delete records, you need to retrieve them from the server and get a list with those that you want to delete. python records_to_delete = list(dataset.records)[:5] dataset.records.delete(records=records_to_delete) !!! tip "Delete records based on a query" It can be very useful to avoid eliminating records with responses.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
description: In this section, we will provide a step-by-step guide to show how to manage datasets and configure dataset settings. Dataset management This guide provides an overview of datasets, explaining the basics of how to set them up and manage them in Argilla.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
A dataset is a collection of records that you can configure for labelers to provide feedback using the UI. Depending on the specific requirements of your task, you may need various types of feedback. You can customize the dataset to include different kinds of questions, so the first step will be to define the aim of your project and the kind of data and feedback you will need. With this information, you can start configuring a dataset by defining fields, questions, metadata, vectors, and
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
guidelines through settings.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
??? Question "Question: Who can manage datasets?" !!! info "Main Classes" === "rg.Dataset"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Create a dataset To create a dataset, you can define it in the Dataset class and then call the create method that will send the dataset to the server so that it can be visualized in the UI. If the dataset does not appear in the UI, you may need to click the refresh button to update the view. For further configuration of the dataset, you can refer to the settings section. The created dataset will be empty, to add the records refer to this how-to guide. ```python import argilla as rg
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
client = rg.Argilla(api_url="", api_key="") settings = rg.Settings( guidelines="These are some guidelines.", fields=[ rg.TextField( name="text", ), ], questions=[ rg.LabelQuestion( name="label", labels=["label_1", "label_2", "label_3"] ), ], ) dataset = rg.Dataset( name="my_dataset", workspace="my_workspace", settings=settings, client=client, )
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
dataset.create() `` !!! tip "Accessing attributes" Access the attributes of a dataset by calling them directly on thedatasetobject. For example,dataset.id,dataset.nameordataset.settings. You can similarly access the fields, questions, metadata, vectors and guidelines. For instance,dataset.fieldsordataset.questions`.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Create multiple datasets with the same settings To create multiple datasets with the same settings, define the settings once and pass it to each dataset. ```python import argilla as rg settings = rg.Settings( guidelines="Select the sentiment of the prompt.", fields=[rg.TextField(name="prompt", use_markdown=True)], questions=[rg.LabelQuestion(name="sentiment", labels=["positive", "negative"])], )
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
dataset1 = rg.Dataset(name="sentiment_analysis_1", settings=settings) dataset2 = rg.Dataset(name="sentiment_analysis_2", settings=settings) Create the datasets on the server dataset1.create() dataset2.create() ``` Create a dataset with settings from an existing dataset To create a new dataset with settings from an existing dataset, get the settings from the existing dataset and pass it to the new dataset. ```python import argilla as rg Get the settings from an existing dataset
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
existing_dataset = client.datasets("sentiment_analysis") Create a new dataset with the same settings dataset = rg.Dataset(name="sentiment_analysis_copy", settings=existing_dataset.settings) Create the dataset on the server dataset.create() ``` Define dataset settings
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Fields The fields in a dataset consist of one or more data items requiring annotation. Currently, Argilla only supports plain text and markdown through the TextField, though we plan to introduce additional field types in future updates. A field is defined in the TextField class that has the following arguments: name: The name of the field. title (optional): The name of the field, as it will be displayed in the UI. Defaults to the name value.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
required (optional): Whether the field is required or not. Defaults to True. At least one field must be required. use_markdown (optional): Specify whether you want markdown rendered in the UI. Defaults to False. If you set it to True, you will be able to use all the Markdown features for text formatting, as well as embed multimedia content and PDFs. !!! note The order of the fields in the UI follows the order in which these are added to the fields attribute in the Python SDK.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
python rg.TextField( name="text", title="Text", required=True, use_markdown=False ) Questions To collect feedback for your dataset, you need to formulate questions that annotators will be asked to answer. Currently, Argilla supports the following types of questions: LabelQuestion, MultiLabelQuestion, RankingQuestion, RatingQuestion, SpanQuestion, and TextQuestion.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Label" A LabelQuestion asks annotators to choose a unique label from a list of options. This type is useful for text classification tasks. In the UI, they will have a rounded shape. It has the following configuration: === "Multi-label" A MultiLabelQuestion asks annotators to choose all applicable labels from a list of options. This type is useful for multi-label text classification tasks. In the UI, they will have a squared shape. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Multi-label" A MultiLabelQuestion asks annotators to choose all applicable labels from a list of options. This type is useful for multi-label text classification tasks. In the UI, they will have a squared shape. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Ranking" A RankingQuestion asks annotators to order a list of options. It is useful to gather information on the preference or relevance of a set of options. Ties are allowed and all options will need to be ranked. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Ranking" A RankingQuestion asks annotators to order a list of options. It is useful to gather information on the preference or relevance of a set of options. Ties are allowed and all options will need to be ranked. It has the following configuration: === "Rating" A RatingQuestion asks annotators to select one option from a list of integer values. This type is useful for collecting numerical scores. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Rating" A RatingQuestion asks annotators to select one option from a list of integer values. This type is useful for collecting numerical scores. It has the following configuration: === "Span" A SpanQuestion asks annotators to select a portion of the text of a specific field and apply a label to it. This type of question is useful for named entity recognition or information extraction tasks. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Span" A SpanQuestion asks annotators to select a portion of the text of a specific field and apply a label to it. This type of question is useful for named entity recognition or information extraction tasks. It has the following configuration: === "Text" A TextQuestion offers to annotators a free-text area where they can enter any text. This type is useful for collecting natural language data, such as corrections or explanations. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Text" A TextQuestion offers to annotators a free-text area where they can enter any text. This type is useful for collecting natural language data, such as corrections or explanations. It has the following configuration: Metadata
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Metadata Metadata properties allow you to configure the use of metadata information for the filtering and sorting features available in the UI and Python SDK. There exist three types of metadata you can add: TermsMetadataProperty, IntegerMetadataProperty and FloatMetadataProperty. === "Terms" A TermsMetadataProperty allows to add a list of strings as metadata options. It has the following configuration:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
=== "Integer" An IntegerMetadataProperty allows to add integer values as metadata. It has the following configuration: === "Integer" An IntegerMetadataProperty allows to add integer values as metadata. It has the following configuration: === "Float" A FloatMetadataProperty allows to add float values as metadata. It has the following configuration: === "Float" A FloatMetadataProperty allows to add float values as metadata. It has the following configuration: Vectors
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Vectors To use the similarity search in the UI and the Python SDK, you will need to configure vectors using the VectorField class. It has the following configuration: name: The name of the vector. title (optional): A name for the vector to display in the UI for better readability. dimensions: The dimensions of the vectors used in this setting. python rg.VectorField( name="my_vector", title="My Vector", dimensions=768 ),
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Guidelines Once you have decided on the data to show and the questions to ask, it's important to provide clear guidelines to the annotators. These guidelines help them understand the task and answer the questions consistently. You can provide guidelines in two ways:
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
In the dataset guidelines: this is added as an argument when you create your dataset in the Python SDK. It will appear in the dataset settings in the UI. python guidelines = "In this dataset, you will find a collection of records that show a category, an instruction, a context and a response to that instruction. [...]" As question descriptions: these are added as an argument when you create questions in the Python SDK. This text will appear in a tooltip next to the question in the UI.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
It is good practice to use at least the dataset guidelines if not both methods. Question descriptions should be short and provide context to a specific question. They can be a summary of the guidelines to that question, but often that is not sufficient to align the whole annotation team. In the guidelines, you can include a description of the project, details on how to answer each question with examples, instructions on when to discard a record, etc.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
!!! tip If you want further guidance on good practices for guidelines during the project development, check our blog post. List datasets You can list all the datasets available in a workspace using the datasets attribute of the Workspace class. You can also use len(workspace.datasets) to get the number of datasets in a workspace. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace") datasets = workspace.datasets
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
for dataset in datasets: print(dataset) ``` Retrieve a dataset You can retrieve a dataset by calling the datasets method on the Argilla class and passing the name of the dataset as an argument. By default, this method attempts to retrieve the dataset from the first workspace. If the dataset is in a different workspace, you must specify either the workspace name or id as an argument. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="")
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
workspace = client.workspaces("my_workspace") Retrieve the dataset from the first workspace retrieved_dataset = client.datasets(name="my_dataset") Retrieve the dataset from the specified workspace retrieved_dataset = client.datasets(name="my_dataset", workspace=workspace) ``` Check dataset existence You can check if a dataset exists by calling the exists method on the Dataset class. This method returns a boolean value. ```python import argilla as rg
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
client = rg.Argilla(api_url="", api_key="") dataset = client.datasets(name="my_dataset") dataset_existed = dataset.exists() ``` Update a dataset You can update a dataset by calling the update method on the Dataset class and passing the new settings as an argument. !!! note Keep in mind that once your dataset is published, only the guidelines can be updated. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="")
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
dataset_to_update = client.datasets(name="my_dataset") settings_to_update = rg.Settings( guidelines="These are some updated guidelines.", fields=[ rg.TextField( name="text", ), ], questions=[ rg.LabelQuestion( name="label", labels=["label_4", "label_5", "label_6"] ), ], ) dataset_to_update.settings = settings_to_update dataset_updated = dataset_to_update.update() ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/dataset.md
Delete a dataset You can delete an existing dataset by calling the delete method on the Dataset class. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") dataset_to_delete = client.datasets(name="my_dataset") dataset_deleted = dataset_to_delete.delete() ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
description: In this section, we will provide a step-by-step guide to show how to filter and query a dataset. Query, filter, and export records This guide provides an overview of how to query and filter a dataset in Argilla and export records.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
You can search for records in your dataset by querying or filtering. The query focuses on the content of the text field, while the filter is used to filter the records based on conditions. You can use them independently or combine multiple filters to create complex search queries. You can also export records from a dataset either as a single dictionary or a list of dictionaries. !!! info "Main Classes"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
Query with search terms To search for records with terms, you can use the Dataset.records attribute with a query string. The search terms are used to search for records that contain the terms in the text field. You can search a single term or various terms, in the latter, all of them should appear in the record to be retrieved. === "Single search term" === "Multiple search term"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
Filter by conditions You can use the Filter class to define the conditions and pass them to the Dataset.records attribute to fetch records based on the conditions. Conditions include "==", ">=", "<=", or "in". Conditions can be combined with dot notation to filter records based on metadata, suggestions, or responses. You can use a single condition or multiple conditions to filter records.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
operator description == The field value is equal to the value >= The field value is greater than or equal to the value <= The field value is less than or equal to the value in TThe field value is included in a list of values
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
=== "Single condition" === "Multiple conditions" Filter by status You can filter records based on their status. The status can be pending, draft, submitted, or discarded. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace") dataset = client.datasets(name="my_dataset", workspace=workspace) status_filter = rg.Query( filter=rg.Filter(("status", "==", "submitted")) )
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
filtered_records = list(dataset.records(status_filter)) ``` Query and filter a dataset As mentioned, you can use a query with a search term and a filter or various filters to create complex search queries. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace")
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
dataset = client.datasets(name="my_dataset", workspace=workspace) query_filter = rg.Query( query="my_term", filter=rg.Filter( [ ("label.suggestion", "==", "positive"), ("metadata.count", ">=", 10), ] ) ) queried_filtered_records = list(dataset.records( query=query_filter, with_metadata=True, with_suggestions=True ) ) ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
Export records to a dictionary Records can be exported from Dataset.records as a dictionary. The to_dict method can be used to export records as a dictionary. You can specify the orientation of the dictionary output. You can also decide if to flatten or not the dictionary. === " ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace") dataset = client.datasets(name="my_dataset", workspace=workspace)
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
Export records as a dictionary exported_records = dataset.records.to_dict() {'fields': [{'text': 'Hello'},{'text': 'World'}], suggestions': [{'label': {'value': 'positive'}}, {'label': {'value': 'negative'}}] Export records as a dictionary with orient=index exported_records = dataset.records.to_dict(orient="index") {"uuid": {'fields': {'text': 'Hello'}, 'suggestions': {'label': {'value': 'positive'}}}, {"uuid": {'fields': {'text': 'World'}, 'suggestions': {'label': {'value': 'negative'}}},
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
Export records as a dictionary with flatten=false exported_records = dataset.records.to_dict(flatten=True) {"text": ["Hello", "World"], "label.suggestion": ["greeting", "greeting"]} ``` Export records to a list Records can be exported from Dataset.records as a list of dictionaries. The to_list method can be used to export records as a list of dictionaries. You can decide if to flatten it or not. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="")
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
workspace = client.workspaces("my_workspace") dataset = client.datasets(name="my_dataset", workspace=workspace) Export records as a list of dictionaries exported_records = dataset.records.to_list() [{'fields': {'text': 'Hello'}, 'suggestion': {'label': {value: 'greeting'}}}, {'fields': {'text': 'World'}, 'suggestion': {'label': {value: 'greeting'}}}] Export records as a list of dictionaries with flatten=False exported_records = dataset.records.to_list(flatten=True)
argilla-io/argilla
argilla/argilla/docs/how_to_guides/query_export.md
[{"text": "Hello", "label": "greeting"}, {"text": "World", "label": "greeting"}] ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
description: In this section, we will provide a step-by-step guide to show how to manage workspaces. Workspace management This guide provides an overview of workspaces, explaining how to set up and manage workspaces in Argilla. A workspace is a space inside your Argilla instance where authorized users can collaborate on datasets. It is accessible through the Python SDK and the UI. ??? Question "Question: Who can manage workspaces?"
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
Default workspaces Argilla provides a default workspace to help you get started in Python and the UI. The name of this workspace varies depending on the server configuration.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
Environment Name Quickstart Docker and HF Space admin Server image argilla
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
!!! info "Main Class" Create a new workspace To create a new workspace in Argilla, you can define it in the Workspace class and then call the create method. This method is inherited from the Resource base class and operates without modifications. When you create a new workspace, it will be empty. To create and add a new dataset, check these guides. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="")
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
workspace_to_create = rg.Workspace( name="my_workspace", client=client ) created_workspace = workspace_to_create.create() created_workspace `` !!! tip "Accessing attributes" Access the attributes of a workspace by calling them directly on theWorkspaceobject. For example,workspace.idorworkspace.name`.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
List workspaces You can list all the existing workspaces in Argilla by calling the workspaces attribute on the Argilla class and iterating over them. You can also use len(client.workspaces) to get the number of workspaces. ```python import argilla as rg
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
client = rg.Argilla(api_url="", api_key="") workspaces = client.workspaces for workspace in workspaces: print(workspace) `` !!! tip "Notebooks" When using a notebook, executingclient.workspaceswill display a table with the number ofdatasetsin each workspace,name,id, and the last update asupdated_at`.
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
Retrieve a workspace You can retrieve a workspace by accessing the workspaces method on the Argilla class and passing the name of the workspace as an argument. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") retrieved_workspace = client.workspaces("my_workspace") ``` Check workspace existence You can check if a workspace exists by calling the exists method on the Workspace class. This method returns a boolean value. ```python import argilla as rg
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace") workspace_existed = workspace.exists() ``` List users in a workspace You can list all the users in a workspace by accessing the users attribute on the Workspace class and iterating over them. You can also use len(workspace.users) to get the number of users by workspace. For further information on how to manage users, check this how-to guide. ```python import argilla as rg
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces('my_workspace') for user in workspace.users: print(user) ``` Add a user to a workspace You can also add a user to a workspace by calling the add_user method on the Workspace class. For further information on how to manage users, check this how-to guide. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace")
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
added_user = workspace.add_user("my_username") ``` Remove a user from workspace You can also remove a user from a workspace by calling the remove_user method on the Workspace class. For further information on how to manage users, check this how-to guide. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace = client.workspaces("my_workspace") removed_user = workspace.remove_user("my_username") ```
argilla-io/argilla
argilla/argilla/docs/how_to_guides/workspace.md
Delete a workspace To delete a workspace, no dataset can be associated with it. If the workspace contains any dataset, deletion will fail. You can delete a workspace by calling the delete method on the Workspace class. To clear a workspace and delete all their datasets, refer to this how-to guide. ```python import argilla as rg client = rg.Argilla(api_url="", api_key="") workspace_to_delete = client.workspaces("my_workspace") deleted_workspace = workspace_to_delete.delete() ```
argilla-io/argilla
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
0
Edit dataset card