Skip to content

Commit

Permalink
revert: removal of expected in dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
saikatmitra91 committed May 22, 2024
1 parent b68545f commit 07ff068
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/scorer/src/provider/model-graded/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export const checkLlmCriteria = async ({
const scorerName = config.name || name;
if (config.criteria) {
let replacements: any = { ...sample.inputs };
if (sample.expected) {
// llm-critic supports {{expected}} as placeholder
replacements.expected = sample.expected;
}
criteria = replacePlaceholders(config.criteria, replacements);
}
if (!criteria) {
Expand Down
5 changes: 5 additions & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export type DatasetSampleInputs = any;
export type DatasetSample = {
id: string;
inputs: DatasetSampleInputs;
expected?: string;
};

export type Dataset = {
Expand All @@ -182,6 +183,7 @@ export type Dataset = {
export type DatasetSampleConfig = {
id?: string;
inputs: DatasetSampleInputs;
expected?: string;
};

export type DatasetConfig =
Expand Down Expand Up @@ -213,6 +215,9 @@ export type RunSampleOutput = {
scores?: Score[];
inputs: DatasetSampleInputs;
output: RunOutput;
expected?: {
value: string;
};
error?: {
code?: string;
message: string;
Expand Down

0 comments on commit 07ff068

Please sign in to comment.