rg.User
¶
A user in Argilla is a profile that uses the SDK or UI. Their profile can be used to track their feedback activity and to manage their access to the Argilla server.
Usage Examples¶
To create a new user, instantiate the User
object with the client and the username:
Existing users can be retrieved by their username:
The current user of the rg.Argilla
client can be accessed using the me
attribute:
Class Reference¶
rg.User
¶
Bases: Resource
Class for interacting with Argilla users in the Argilla server. User profiles are used to manage access to the Argilla server and track responses to records.
Attributes:
Name | Type | Description |
---|---|---|
username |
str
|
The username of the user. |
first_name |
str
|
The first name of the user. |
last_name |
str
|
The last name of the user. |
role |
str
|
The role of the user, either 'annotator' or 'admin'. |
password |
str
|
The password of the user. |
id |
UUID
|
The ID of the user. |
Source code in src/argilla_sdk/users/_resource.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
__init__(username=None, first_name=None, last_name=None, role=None, password=None, client=None, id=None, _model=None)
¶
Initializes a User object with a client and a username
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
The username of the user |
None
|
first_name |
str
|
The first name of the user |
None
|
last_name |
str
|
The last name of the user |
None
|
role |
str
|
The role of the user, either 'annotator', admin, or 'owner' |
None
|
password |
str
|
The password of the user. If not provided, a random password will be generated |
None
|
client |
Argilla
|
The client used to interact with Argilla |
None
|
Returns:
Name | Type | Description |
---|---|---|
User |
None
|
The initialized user object |
```
Source code in src/argilla_sdk/users/_resource.py
add_to_workspace(workspace)
¶
Adds the user to a workspace. After adding a user to a workspace, it will have access to the datasets in the workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace |
Workspace
|
The workspace to add the user to. |
required |
Returns:
Name | Type | Description |
---|---|---|
User |
User
|
The user that was added to the workspace. |
Source code in src/argilla_sdk/users/_resource.py
create()
¶
Creates the user in Argilla. After creating a user, it will be able to log in to the Argilla server.
Returns:
Name | Type | Description |
---|---|---|
User |
User
|
The user that was created in Argilla. |
Source code in src/argilla_sdk/users/_resource.py
delete()
¶
Deletes the user from Argilla. After deleting a user, it will no longer be able to log in to the Argilla server.
Source code in src/argilla_sdk/users/_resource.py
exists()
¶
Checks if the user exists in Argilla
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the user exists, False otherwise. |
remove_from_workspace(workspace)
¶
Removes the user from a workspace. After removing a user from a workspace, it will no longer have access to the datasets in the workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace |
Workspace
|
The workspace to remove the user from. |
required |
Returns:
Name | Type | Description |
---|---|---|
User |
User
|
The user that was removed from the workspace. |