| | |
- builtins.object
-
- Dataset
class Dataset(builtins.object) |
| |
Dataset(source: Union[str, pathlib.Path, gen_ai_hub.evaluations.models.artifact_source.ArtifactSource])
Dataset object for the evaluations flow.
The Dataset class accepts various source types for evaluation datasets including
local file paths (as strings or Path objects) or AI Core artifacts.
:param source: Source of the dataset - can be a file path string, Path object, or ArtifactSource
:type source: Union[str, Path, ArtifactSource]
**Examples**:
Using a Path object:
>>> Dataset(Path("data/sample.json"))
Using a string path:
>>> Dataset("data/sample.json")
Using an ArtifactSource with artifact dictionary:
>>> Dataset(
... ArtifactSource(
... artifact={
... "id": "xyfz-rtyu-2456-ojns-yu6s",
... "name": "dataset-artifact",
... "url": "ai://default/eval_dataset"
... },
... path="rootfolder/data.csv",
... file_type="csv"
... )
... )
Using an ArtifactSource with artifact ID:
>>> Dataset(
... ArtifactSource(
... artifact="xyfz-rtyu-2456-ojns-yu6s",
... path="rootfolder/data.csv",
... file_type="csv"
... )
... ) |
| |
Methods defined here:
- __init__(self, source: Union[str, pathlib.Path, gen_ai_hub.evaluations.models.artifact_source.ArtifactSource])
- Initialize a Dataset instance.
:param source: Source of the dataset - can be a file path string, Path object, or ArtifactSource
:type source: Union[str, Path, ArtifactSource]
Readonly properties defined here:
- file_type
- Infer the file type from the source.
For ArtifactSource, returns the explicitly set file_type.
For file paths, infers the type from the file extension.
:return: File type (e.g., "json", "jsonl", "csv") or None if cannot be determined
:rtype: Optional[str]
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |