@arizeai/phoenix-client
Version:
A client for the Phoenix API
25 lines • 855 B
JavaScript
import { createClient } from "../client.js";
import { getExperimentInfo } from "./getExperimentInfo.js";
import { getExperimentRuns } from "./getExperimentRuns.js";
/**
* A function that gets the result of a experiment.
* Fetches the experiment data as well as the runs.
*/
export async function getExperiment({ client: _client, experimentId, }) {
const client = _client || createClient();
const [experiment, experimentRuns] = await Promise.all([
getExperimentInfo({ client, experimentId }),
getExperimentRuns({ client, experimentId }),
]);
const experimentRunsMap = {
runs: experimentRuns.runs.reduce((acc, run) => {
acc[run.id] = run;
return acc;
}, {}),
};
return {
...experiment,
...experimentRunsMap,
};
}
//# sourceMappingURL=getExperiment.js.map