Skip to content

Commit 7acc0cf

Browse files
committed
added dataset create and get
1 parent 88eb028 commit 7acc0cf

File tree

6 files changed

+229
-216
lines changed

6 files changed

+229
-216
lines changed

nbs/backends/ragas_api_client.ipynb

Lines changed: 53 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
},
4949
{
5050
"cell_type": "code",
51-
"execution_count": 66,
51+
"execution_count": 4,
5252
"metadata": {},
5353
"outputs": [],
5454
"source": [
@@ -127,7 +127,7 @@
127127
},
128128
{
129129
"cell_type": "code",
130-
"execution_count": 68,
130+
"execution_count": 5,
131131
"metadata": {},
132132
"outputs": [],
133133
"source": [
@@ -195,7 +195,7 @@
195195
},
196196
{
197197
"cell_type": "code",
198-
"execution_count": 69,
198+
"execution_count": 6,
199199
"metadata": {},
200200
"outputs": [
201201
{
@@ -230,20 +230,20 @@
230230
},
231231
{
232232
"cell_type": "code",
233-
"execution_count": 8,
233+
"execution_count": 7,
234234
"metadata": {},
235235
"outputs": [
236236
{
237237
"data": {
238238
"text/plain": [
239-
"{'id': '5f892600-e620-448c-a699-aa5971abefdc',\n",
239+
"{'id': '26b0e577-8ff8-4014-bc7a-cfc410df3488',\n",
240240
" 'title': 'test project',\n",
241241
" 'description': 'test description',\n",
242-
" 'created_at': '2025-04-09T23:00:39.272415+00:00',\n",
243-
" 'updated_at': '2025-04-09T23:00:39.272415+00:00'}"
242+
" 'created_at': '2025-04-10T00:12:34.606398+00:00',\n",
243+
" 'updated_at': '2025-04-10T00:12:34.606398+00:00'}"
244244
]
245245
},
246-
"execution_count": 8,
246+
"execution_count": 7,
247247
"metadata": {},
248248
"output_type": "execute_result"
249249
}
@@ -254,13 +254,28 @@
254254
},
255255
{
256256
"cell_type": "code",
257-
"execution_count": 9,
257+
"execution_count": 8,
258258
"metadata": {},
259259
"outputs": [
260260
{
261261
"data": {
262262
"text/plain": [
263-
"{'items': [{'id': '5f892600-e620-448c-a699-aa5971abefdc',\n",
263+
"{'items': [{'id': '26b0e577-8ff8-4014-bc7a-cfc410df3488',\n",
264+
" 'title': 'test project',\n",
265+
" 'description': 'test description',\n",
266+
" 'created_at': '2025-04-10T00:12:34.606398+00:00',\n",
267+
" 'updated_at': '2025-04-10T00:12:34.606398+00:00'},\n",
268+
" {'id': '18df1385-8ff6-4c3f-bd8d-a4fcbfba5f57',\n",
269+
" 'title': 'My Project',\n",
270+
" 'description': None,\n",
271+
" 'created_at': '2025-04-09T23:49:26.491293+00:00',\n",
272+
" 'updated_at': '2025-04-09T23:49:26.491293+00:00'},\n",
273+
" {'id': '940f2c5a-4c28-4dde-9643-97daede5408e',\n",
274+
" 'title': 'My Project',\n",
275+
" 'description': None,\n",
276+
" 'created_at': '2025-04-09T23:24:34.922817+00:00',\n",
277+
" 'updated_at': '2025-04-09T23:24:34.922817+00:00'},\n",
278+
" {'id': '5f892600-e620-448c-a699-aa5971abefdc',\n",
264279
" 'title': 'test project',\n",
265280
" 'description': 'test description',\n",
266281
" 'created_at': '2025-04-09T23:00:39.272415+00:00',\n",
@@ -307,12 +322,12 @@
307322
" 'updated_at': '2025-03-30T02:33:38.751793+00:00'}],\n",
308323
" 'pagination': {'offset': 0,\n",
309324
" 'limit': 50,\n",
310-
" 'total': 9,\n",
325+
" 'total': 12,\n",
311326
" 'order_by': 'created_at',\n",
312327
" 'sort_dir': 'desc'}}"
313328
]
314329
},
315-
"execution_count": 9,
330+
"execution_count": 8,
316331
"metadata": {},
317332
"output_type": "execute_result"
318333
}
@@ -323,7 +338,7 @@
323338
},
324339
{
325340
"cell_type": "code",
326-
"execution_count": 10,
341+
"execution_count": 9,
327342
"metadata": {},
328343
"outputs": [],
329344
"source": [
@@ -340,7 +355,7 @@
340355
},
341356
{
342357
"cell_type": "code",
343-
"execution_count": 11,
358+
"execution_count": 10,
344359
"metadata": {},
345360
"outputs": [],
346361
"source": [
@@ -403,17 +418,17 @@
403418
},
404419
{
405420
"cell_type": "code",
406-
"execution_count": 12,
421+
"execution_count": 11,
407422
"metadata": {},
408423
"outputs": [
409424
{
410425
"data": {
411426
"text/plain": [
412-
"('5f892600-e620-448c-a699-aa5971abefdc',\n",
427+
"('26b0e577-8ff8-4014-bc7a-cfc410df3488',\n",
413428
" 'e1b3f1e4-d344-48f4-a178-84e7e32e6ab6')"
414429
]
415430
},
416-
"execution_count": 12,
431+
"execution_count": 11,
417432
"metadata": {},
418433
"output_type": "execute_result"
419434
}
@@ -426,14 +441,14 @@
426441
},
427442
{
428443
"cell_type": "code",
429-
"execution_count": 13,
444+
"execution_count": 12,
430445
"metadata": {},
431446
"outputs": [
432447
{
433448
"name": "stdout",
434449
"output_type": "stream",
435450
"text": [
436-
"New dataset created: {'id': '43b6c819-3287-419b-a5bd-8423c1600463', 'name': 'New Dataset', 'description': 'This is a new dataset', 'updated_at': '2025-04-09T23:00:42.712663+00:00', 'created_at': '2025-04-09T23:00:42.712663+00:00', 'version_counter': 0, 'project_id': '5f892600-e620-448c-a699-aa5971abefdc'}\n"
451+
"New dataset created: {'id': 'e75f6ee2-2b36-4599-8e21-8da7f4006aa2', 'name': 'New Dataset', 'description': 'This is a new dataset', 'updated_at': '2025-04-10T00:12:36.940908+00:00', 'created_at': '2025-04-10T00:12:36.940908+00:00', 'version_counter': 0, 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}\n"
437452
]
438453
}
439454
],
@@ -447,7 +462,7 @@
447462
},
448463
{
449464
"cell_type": "code",
450-
"execution_count": 14,
465+
"execution_count": 13,
451466
"metadata": {},
452467
"outputs": [
453468
{
@@ -466,14 +481,14 @@
466481
},
467482
{
468483
"cell_type": "code",
469-
"execution_count": 15,
484+
"execution_count": 14,
470485
"metadata": {},
471486
"outputs": [
472487
{
473488
"name": "stdout",
474489
"output_type": "stream",
475490
"text": [
476-
"Updated dataset: {'id': '43b6c819-3287-419b-a5bd-8423c1600463', 'name': 'Updated Dataset', 'description': 'This is an updated dataset', 'created_at': '2025-04-09T23:00:42.712663+00:00', 'updated_at': '2025-04-09T23:00:44.380877+00:00', 'version_counter': 0, 'project_id': '5f892600-e620-448c-a699-aa5971abefdc'}\n"
491+
"Updated dataset: {'id': 'e75f6ee2-2b36-4599-8e21-8da7f4006aa2', 'name': 'Updated Dataset', 'description': 'This is an updated dataset', 'created_at': '2025-04-10T00:12:36.940908+00:00', 'updated_at': '2025-04-10T00:12:38.564782+00:00', 'version_counter': 0, 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}\n"
477492
]
478493
}
479494
],
@@ -489,7 +504,7 @@
489504
},
490505
{
491506
"cell_type": "code",
492-
"execution_count": 16,
507+
"execution_count": 15,
493508
"metadata": {},
494509
"outputs": [
495510
{
@@ -515,7 +530,7 @@
515530
},
516531
{
517532
"cell_type": "code",
518-
"execution_count": 17,
533+
"execution_count": 16,
519534
"metadata": {},
520535
"outputs": [],
521536
"source": [
@@ -577,17 +592,17 @@
577592
},
578593
{
579594
"cell_type": "code",
580-
"execution_count": 18,
595+
"execution_count": 17,
581596
"metadata": {},
582597
"outputs": [
583598
{
584599
"name": "stdout",
585600
"output_type": "stream",
586601
"text": [
587-
"New experiment created: {'id': 'cb487c5d-ef21-45da-8eab-7a8d3a02b515', 'name': 'New Experiment', 'description': 'This is a new experiment', 'updated_at': '2025-04-09T23:00:45.543119+00:00', 'created_at': '2025-04-09T23:00:45.543119+00:00', 'version_counter': 0, 'project_id': '5f892600-e620-448c-a699-aa5971abefdc'}\n",
602+
"New experiment created: {'id': 'b575c5d1-6934-45c0-b67a-fc9a4d7bdba3', 'name': 'New Experiment', 'description': 'This is a new experiment', 'updated_at': '2025-04-10T00:12:39.955229+00:00', 'created_at': '2025-04-10T00:12:39.955229+00:00', 'version_counter': 0, 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}\n",
588603
"Found 2 experiments\n",
589-
"Experiment: {'id': 'cb487c5d-ef21-45da-8eab-7a8d3a02b515', 'name': 'New Experiment', 'description': 'This is a new experiment', 'created_at': '2025-04-09T23:00:45.543119+00:00', 'updated_at': '2025-04-09T23:00:45.543119+00:00', 'version_counter': 0, 'project_id': '5f892600-e620-448c-a699-aa5971abefdc'}\n",
590-
"Updated experiment: {'id': 'cb487c5d-ef21-45da-8eab-7a8d3a02b515', 'name': 'Updated Experiment', 'description': 'This is an updated experiment', 'created_at': '2025-04-09T23:00:45.543119+00:00', 'updated_at': '2025-04-09T23:00:47.689729+00:00', 'version_counter': 0, 'project_id': '5f892600-e620-448c-a699-aa5971abefdc'}\n",
604+
"Experiment: {'id': 'b575c5d1-6934-45c0-b67a-fc9a4d7bdba3', 'name': 'New Experiment', 'description': 'This is a new experiment', 'created_at': '2025-04-10T00:12:39.955229+00:00', 'updated_at': '2025-04-10T00:12:39.955229+00:00', 'version_counter': 0, 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}\n",
605+
"Updated experiment: {'id': 'b575c5d1-6934-45c0-b67a-fc9a4d7bdba3', 'name': 'Updated Experiment', 'description': 'This is an updated experiment', 'created_at': '2025-04-10T00:12:39.955229+00:00', 'updated_at': '2025-04-10T00:12:41.676216+00:00', 'version_counter': 0, 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}\n",
591606
"Experiment deleted\n"
592607
]
593608
}
@@ -621,7 +636,7 @@
621636
},
622637
{
623638
"cell_type": "code",
624-
"execution_count": 19,
639+
"execution_count": 18,
625640
"metadata": {},
626641
"outputs": [
627642
{
@@ -646,7 +661,7 @@
646661
" 'sort_dir': 'asc'}}"
647662
]
648663
},
649-
"execution_count": 19,
664+
"execution_count": 18,
650665
"metadata": {},
651666
"output_type": "execute_result"
652667
}
@@ -681,7 +696,7 @@
681696
},
682697
{
683698
"cell_type": "code",
684-
"execution_count": 20,
699+
"execution_count": 19,
685700
"metadata": {},
686701
"outputs": [],
687702
"source": [
@@ -699,7 +714,7 @@
699714
},
700715
{
701716
"cell_type": "code",
702-
"execution_count": 21,
717+
"execution_count": 20,
703718
"metadata": {},
704719
"outputs": [],
705720
"source": [
@@ -778,22 +793,22 @@
778793
},
779794
{
780795
"cell_type": "code",
781-
"execution_count": 22,
796+
"execution_count": 21,
782797
"metadata": {},
783798
"outputs": [
784799
{
785800
"data": {
786801
"text/plain": [
787-
"{'id': 'dd741040-9305-448a-aa4d-7987905a626a',\n",
802+
"{'id': 'ebc3dd3e-f88b-4f8b-8c72-6cfcae0a0cd4',\n",
788803
" 'name': 'New Dataset for testing columns',\n",
789804
" 'description': 'This is a new dataset for testing columns',\n",
790-
" 'updated_at': '2025-04-09T23:00:50.291417+00:00',\n",
791-
" 'created_at': '2025-04-09T23:00:50.291417+00:00',\n",
805+
" 'updated_at': '2025-04-10T00:12:43.359691+00:00',\n",
806+
" 'created_at': '2025-04-10T00:12:43.359691+00:00',\n",
792807
" 'version_counter': 0,\n",
793-
" 'project_id': '5f892600-e620-448c-a699-aa5971abefdc'}"
808+
" 'project_id': '26b0e577-8ff8-4014-bc7a-cfc410df3488'}"
794809
]
795810
},
796-
"execution_count": 22,
811+
"execution_count": 21,
797812
"metadata": {},
798813
"output_type": "execute_result"
799814
}
@@ -807,44 +822,6 @@
807822
"datasets"
808823
]
809824
},
810-
{
811-
"cell_type": "code",
812-
"execution_count": null,
813-
"metadata": {},
814-
"outputs": [],
815-
"source": [
816-
"raise"
817-
]
818-
},
819-
{
820-
"cell_type": "code",
821-
"execution_count": 70,
822-
"metadata": {},
823-
"outputs": [
824-
{
825-
"ename": "AttributeError",
826-
"evalue": "'RagasApiClient' object has no attribute 'create_dataset_column'",
827-
"output_type": "error",
828-
"traceback": [
829-
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
830-
"\u001b[31mAttributeError\u001b[39m Traceback (most recent call last)",
831-
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[70]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;66;03m# add a new column to the dataset\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m new_column = \u001b[38;5;28;01mawait\u001b[39;00m \u001b[43mclient\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcreate_dataset_column\u001b[49m(\n\u001b[32m 3\u001b[39m project_id=\u001b[33m\"\u001b[39m\u001b[33m18df1385-8ff6-4c3f-bd8d-a4fcbfba5f57\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 4\u001b[39m dataset_id=\u001b[33m\"\u001b[39m\u001b[33m65155a96-c77c-4e2b-b872-1a2f14f5ce45\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 5\u001b[39m \u001b[38;5;28mid\u001b[39m=\u001b[33m\"\u001b[39m\u001b[33mnew_column_3\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 6\u001b[39m name=\u001b[33m\"\u001b[39m\u001b[33mNew Column 3\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 7\u001b[39m \u001b[38;5;28mtype\u001b[39m=\u001b[33m\"\u001b[39m\u001b[33mtext\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 8\u001b[39m )\n\u001b[32m 9\u001b[39m new_column\n",
832-
"\u001b[31mAttributeError\u001b[39m: 'RagasApiClient' object has no attribute 'create_dataset_column'"
833-
]
834-
}
835-
],
836-
"source": [
837-
"# add a new column to the dataset\n",
838-
"new_column = await client.create_dataset_column(\n",
839-
" project_id=\"18df1385-8ff6-4c3f-bd8d-a4fcbfba5f57\",\n",
840-
" dataset_id=\"65155a96-c77c-4e2b-b872-1a2f14f5ce45\",\n",
841-
" id=\"new_column_3\",\n",
842-
" name=\"New Column 3\",\n",
843-
" type=\"text\",\n",
844-
")\n",
845-
"new_column"
846-
]
847-
},
848825
{
849826
"cell_type": "code",
850827
"execution_count": null,

0 commit comments

Comments
 (0)