Commit 6452993
authored
[ENHANCEMENT] Argilla SDK: Updating record fields and vectors (#5026)
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->
# Description
This PR reviews the record attributes and normalizes how to work with
fields, vectors, and metadata. Now, all are treated as dictionaries and
users can update in the same way that working with dictionaries or
creating new attributes:
```python
record = Record(fields={"name": "John"})
record.fields.update({"name": "Jane", "age": "30"})
record.fields.new_field = "value"
record.vectors["new-vector"] = [1.0, 2.0, 3.0]
record.vectors.vector = [1.0, 2.0, 3.0]
record.metadata["new-key"] = "new_value"
record.metadata.key = "new_value"
```
Once this approach is approved, I will create a new PR changing the
docs.
**Type of change**
(Please delete options that are not relevant. Remember to title the PR
according to the type of change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Refactor (change restructuring the codebase without changing
functionality)
- [x] Improvement (change adding some improvement to an existing
functionality)
**How Has This Been Tested**
(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)
- [ ] Test A
- [ ] Test B
**Checklist**
- [ ] I added relevant documentation
- [ ] I followed the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the `CHANGELOG.md` file (See
https://keepachangelog.com/)1 parent 90f1ef6 commit 6452993
File tree
10 files changed
+154
-121
lines changed- argilla
- src/argilla
- _models
- _record
- records
- tests
- integration
- unit
- export
- test_resources
10 files changed
+154
-121
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | | - | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
409 | | - | |
410 | 408 | | |
411 | | - | |
412 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
413 | 412 | | |
414 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
415 | 417 | | |
416 | 418 | | |
417 | 419 | | |
| |||
466 | 468 | | |
467 | 469 | | |
468 | 470 | | |
469 | | - | |
| 471 | + | |
470 | 472 | | |
471 | 473 | | |
472 | 474 | | |
| |||
478 | 480 | | |
479 | 481 | | |
480 | 482 | | |
481 | | - | |
482 | | - | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
485 | 487 | | |
486 | 488 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
96 | | - | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
161 | | - | |
162 | | - | |
| 163 | + | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| |||
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
| 186 | + | |
| 187 | + | |
184 | 188 | | |
185 | | - | |
| 189 | + | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
| 193 | + | |
189 | 194 | | |
190 | | - | |
| 195 | + | |
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
196 | | - | |
| 201 | + | |
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
| |||
219 | 224 | | |
220 | 225 | | |
221 | 226 | | |
222 | | - | |
223 | 227 | | |
224 | 228 | | |
225 | 229 | | |
| |||
245 | 249 | | |
246 | 250 | | |
247 | 251 | | |
248 | | - | |
| 252 | + | |
249 | 253 | | |
250 | 254 | | |
251 | 255 | | |
| |||
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
261 | | - | |
| 265 | + | |
262 | 266 | | |
263 | | - | |
| 267 | + | |
264 | 268 | | |
265 | 269 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 270 | + | |
| 271 | + | |
270 | 272 | | |
271 | | - | |
272 | | - | |
| 273 | + | |
| 274 | + | |
273 | 275 | | |
274 | | - | |
275 | | - | |
| 276 | + | |
| 277 | + | |
276 | 278 | | |
277 | | - | |
278 | | - | |
| 279 | + | |
| 280 | + | |
279 | 281 | | |
280 | | - | |
281 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
282 | 321 | | |
283 | 322 | | |
284 | 323 | | |
| |||
309 | 348 | | |
310 | 349 | | |
311 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
312 | 361 | | |
313 | 362 | | |
314 | 363 | | |
| |||
321 | 370 | | |
322 | 371 | | |
323 | 372 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | 373 | | |
334 | 374 | | |
335 | 375 | | |
| |||
345 | 385 | | |
346 | 386 | | |
347 | 387 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | 388 | | |
352 | 389 | | |
353 | 390 | | |
354 | 391 | | |
355 | 392 | | |
356 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
357 | 397 | | |
358 | 398 | | |
359 | 399 | | |
| |||
368 | 408 | | |
369 | 409 | | |
370 | 410 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
| 411 | + | |
| 412 | + | |
412 | 413 | | |
413 | | - | |
414 | | - | |
415 | | - | |
0 commit comments