rg.Argilla
¶
To interact with the Argilla server from Python you can use the Argilla
class. The Argilla
client is used to create, get, update, and delete all Argilla resources, such as workspaces, users, datasets, and records.
Usage Examples¶
Connecting to an Argilla server¶
To connect to an Argilla server, instantiate the Argilla
class and pass the api_url
of the server and the api_key
to authenticate.
import argilla as rg
client = rg.Argilla(
api_url="https://argilla.example.com",
api_key="my_api_key",
)
Accessing Dataset, Workspace, and User objects¶
The Argilla
clients provides access to the Dataset
, Workspace
, and User
objects of the Argilla server.
my_dataset = client.datasets("my_dataset")
my_workspace = client.workspaces("my_workspace")
my_user = client.users("my_user")
These resources can then be interacted with to access their properties and methods. For example, to list all datasets in a workspace:
Argilla
¶
Bases: APIClient
Argilla API client. This is the main entry point to interact with the API.
Attributes:
Name | Type | Description |
---|---|---|
workspaces |
Workspaces
|
A collection of workspaces. |
datasets |
Datasets
|
A collection of datasets. |
users |
Users
|
A collection of users. |
me |
User
|
The current user. |
Source code in src/argilla/client.py
workspaces: Workspaces
property
¶
A collection of workspaces on the server.
datasets: Datasets
property
¶
A collection of datasets on the server.
users: Users
property
¶
A collection of users on the server.
__init__(api_url=DEFAULT_HTTP_CONFIG.api_url, api_key=DEFAULT_HTTP_CONFIG.api_key, timeout=DEFAULT_HTTP_CONFIG.timeout, retries=DEFAULT_HTTP_CONFIG.retries, **http_client_args)
¶
Inits the Argilla
client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url |
Optional[str]
|
the URL of the Argilla API. If not provided, then the value will try
to be set from |
api_url
|
api_key |
Optional[str]
|
the key to be used to authenticate in the Argilla API. If not provided,
then the value will try to be set from |
api_key
|
timeout |
int
|
the maximum time in seconds to wait for a request to the Argilla API
to be completed before raising an exception. Defaults to |
timeout
|
retries |
int
|
the number of times to retry the HTTP connection to the Argilla API
before raising an exception. Defaults to |
retries
|