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:
- Return
null or undefined when a dataset is not found (breaking change)
- Add a
{ throwOnNotFound?: boolean } option tocontrol this behavior
Path: /getting-started/experiments
when running
your first experiment in code using prompts and datasetsThe
getDataset()function throws an error when a dataset is not found, rather than returningnullorundefined.Current Behavior:
When calling
getDataset()with a nonexistent dataset name, the function throws an error:Expected Behavior:
The function should return
nullorundefinedwhen a dataset doesn't exist, and allowing for simple conditional logic:Current Workaround:
Users must wrap
getDataset()calls in try-catch blocks:Suggested Fix:
Either:
nullorundefinedwhen a dataset is not found (breaking change){ throwOnNotFound?: boolean }option tocontrol this behavior