@@ -85,8 +85,8 @@ def _get_input_filename(
8585) -> str :
8686 """Extract base filename (without extension) from file or URL input."""
8787 if file_input is not None and not isinstance (file_input , Omit ):
88- if isinstance (file_input , Path ):
89- return file_input .stem
88+ if isinstance (file_input , ( Path , os . PathLike ) ):
89+ return Path ( file_input ) .stem
9090 elif isinstance (file_input , str ):
9191 # Strings are always treated as raw content, not file paths.
9292 # File inputs should use Path objects, tuples, or IO objects.
@@ -119,7 +119,8 @@ def _save_response(
119119
120120 If save_to ends with '.json', it is treated as a full file path and the
121121 response is written there directly. Otherwise it is treated as a directory
122- and the file is auto-named '{filename}_{method_name}_output.json'.
122+ and the file is auto-named '{filename}_{method_name}_output.json'
123+ (or '{method_name}_output.json' when filename is 'output').
123124 """
124125 try :
125126 save_path = Path (save_to )
@@ -344,9 +345,10 @@ def extract(
344345 strict: If True, reject schemas with unsupported fields (HTTP 422). If False, prune
345346 unsupported fields and continue. Only applies to extract versions that support
346347 schema validation.
347- save_to: Optional output path. Accepts either a directory path (auto-generates
348- filename as {input_file}_extract_output.json) or a full file path ending
349- in .json (saves to that exact path). Parent directories are created automatically.
348+ save_to: Optional output path. If a directory, auto-generates the filename
349+ (e.g. {input_file}_extract_output.json, or extract_output.json when no
350+ input filename is available). If a full path ending in .json, saves there
351+ directly. Parent directories are created automatically.
350352
351353 extra_headers: Send extra headers
352354
@@ -445,9 +447,10 @@ def parse(
445447 parameter. Set the parameter to page to split documents at the page level. The
446448 splits object in the API output will contain a set of data for each page.
447449
448- save_to: Optional output path. Accepts either a directory path (auto-generates
449- filename as {input_file}_parse_output.json) or a full file path ending
450- in .json (saves to that exact path). Parent directories are created automatically.
450+ save_to: Optional output path. If a directory, auto-generates the filename
451+ (e.g. {input_file}_parse_output.json, or parse_output.json when no
452+ input filename is available). If a full path ending in .json, saves there
453+ directly. Parent directories are created automatically.
451454
452455 extra_headers: Send extra headers
453456
@@ -534,9 +537,10 @@ def split(
534537
535538 model: Model version to use for split classification. Defaults to the latest version.
536539
537- save_to: Optional output path. Accepts either a directory path (auto-generates
538- filename as {input_file}_split_output.json) or a full file path ending
539- in .json (saves to that exact path). Parent directories are created automatically.
540+ save_to: Optional output path. If a directory, auto-generates the filename
541+ (e.g. {input_file}_split_output.json, or split_output.json when no
542+ input filename is available). If a full path ending in .json, saves there
543+ directly. Parent directories are created automatically.
540544
541545 extra_headers: Send extra headers
542546
@@ -818,9 +822,10 @@ async def extract(
818822 unsupported fields and continue. Only applies to extract versions that support
819823 schema validation.
820824
821- save_to: Optional output path. Accepts either a directory path (auto-generates
822- filename as {input_file}_extract_output.json) or a full file path ending
823- in .json (saves to that exact path). Parent directories are created automatically.
825+ save_to: Optional output path. If a directory, auto-generates the filename
826+ (e.g. {input_file}_extract_output.json, or extract_output.json when no
827+ input filename is available). If a full path ending in .json, saves there
828+ directly. Parent directories are created automatically.
824829
825830 extra_headers: Send extra headers
826831
@@ -919,9 +924,10 @@ async def parse(
919924 parameter. Set the parameter to page to split documents at the page level. The
920925 splits object in the API output will contain a set of data for each page.
921926
922- save_to: Optional output path. Accepts either a directory path (auto-generates
923- filename as {input_file}_parse_output.json) or a full file path ending
924- in .json (saves to that exact path). Parent directories are created automatically.
927+ save_to: Optional output path. If a directory, auto-generates the filename
928+ (e.g. {input_file}_parse_output.json, or parse_output.json when no
929+ input filename is available). If a full path ending in .json, saves there
930+ directly. Parent directories are created automatically.
925931
926932 extra_headers: Send extra headers
927933
@@ -1008,9 +1014,10 @@ async def split(
10081014
10091015 model: Model version to use for split classification. Defaults to the latest version.
10101016
1011- save_to: Optional output path. Accepts either a directory path (auto-generates
1012- filename as {input_file}_split_output.json) or a full file path ending
1013- in .json (saves to that exact path). Parent directories are created automatically.
1017+ save_to: Optional output path. If a directory, auto-generates the filename
1018+ (e.g. {input_file}_split_output.json, or split_output.json when no
1019+ input filename is available). If a full path ending in .json, saves there
1020+ directly. Parent directories are created automatically.
10141021
10151022 extra_headers: Send extra headers
10161023
0 commit comments