File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 33import json
44import os
55import tempfile
6- import urllib
76from typing import Any
87from typing import Dict
98from typing import List
1211from typing import TypedDict
1312from typing import Union
1413from typing import cast
14+ import urllib
1515from urllib .parse import quote
1616from urllib .parse import urlparse
1717
@@ -495,15 +495,16 @@ def dataset_get_with_records(
495495
496496 list_base_path = f"/api/unstable/llm-obs/v1/datasets/{ dataset_id } /records"
497497
498- url_options = {}
499- if version :
500- url_options ["filter[version]" ] = version
501-
502498 has_next_page = True
503499 class_records : List [DatasetRecord ] = []
504- list_path = f"{ list_base_path } ?{ urllib .parse .urlencode (url_options , safe = '[]' )} "
505500 page_num = 0
501+ url_options = {}
506502 while has_next_page :
503+ if version :
504+ url_options ["filter[version]" ] = version
505+
506+ list_path = f"{ list_base_path } ?{ urllib .parse .urlencode (url_options , safe = '[]' )} "
507+ logger .debug ("list records page %d, request path=%s" , page_num , list_path )
507508 resp = self .request ("GET" , list_path , timeout = self .LIST_RECORDS_TIMEOUT )
508509 if resp .status != 200 :
509510 raise ValueError (
@@ -523,12 +524,12 @@ def dataset_get_with_records(
523524 }
524525 )
525526 next_cursor = records_data .get ("meta" , {}).get ("after" )
527+
528+ url_options = {}
526529 has_next_page = False
527530 if next_cursor :
528531 has_next_page = True
529532 url_options ["page[cursor]" ] = next_cursor
530- list_path = f"{ list_base_path } ?{ urllib .parse .urlencode (url_options , safe = '[]' )} "
531- logger .debug ("next list records request path %s" , list_path )
532533 page_num += 1
533534 return Dataset (
534535 name = dataset_name ,
You can’t perform that action at this time.
0 commit comments