Skip to content

Issue on docs - Run an Experiment #439

Description

@KazChe

Path: /getting-started/experiments

when running your first experiment in code using prompts and datasets

The getDataset() function throws an error when a dataset is not found, rather than returning null or undefined.

Current Behavior:

When calling getDataset() with a nonexistent dataset name, the function throws an error:

const dataset = await getDataset({ name: "My Dataset" });
// Error: Galileo dataset My Dataset not found

Expected Behavior:

The function should return null or undefined when a dataset doesn't exist, and allowing for simple conditional logic:

let dataset = await getDataset({ name: "My Dataset" });
if (!dataset) {
    dataset = await createDataset([...], "My Dataset");
}

Current Workaround:

Users must wrap getDataset() calls in try-catch blocks:

let dataset;
try {
    dataset = await getDataset({ name: "My Dataset" });
} catch (e) {
    dataset = await createDataset([...], "My Dataset");
}

Suggested Fix:

Either:

  1. Return null or undefined when a dataset is not found (breaking change)
  2. Add a { throwOnNotFound?: boolean } option tocontrol this behavior

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions