Skip to content

Commit 3697110

Browse files
authored
feat: introduce combined generate input schema for validation (#3046)
1 parent f18c89b commit 3697110

File tree

1 file changed

+12
-1
lines changed
  • genkit-tools/common/src/types

1 file changed

+12
-1
lines changed

genkit-tools/common/src/types/eval.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {
2323
ListEvalKeysResponse,
2424
UpdateDatasetRequest,
2525
} from './apis';
26-
import { GenerateRequestSchema } from './model';
26+
import { GenerateActionOptionsSchema, GenerateRequestSchema } from './model';
2727

2828
/**
2929
* This file defines schema and types that are used by the Eval store.
@@ -56,6 +56,17 @@ export const GenerateRequestJSONSchema = zodToJsonSchema(
5656
}
5757
) as JSONSchema7;
5858

59+
/**
60+
* Combined GenerateInput JSON schema to support eval-inference using models
61+
*/
62+
export const GenerateInputJSONSchema = zodToJsonSchema(
63+
z.union([GenerateRequestSchema, GenerateActionOptionsSchema]),
64+
{
65+
$refStrategy: 'none',
66+
removeAdditionalStrategy: 'strict',
67+
}
68+
) as JSONSchema7;
69+
5970
/**
6071
* A single sample to be used for inference.
6172
**/

0 commit comments

Comments
 (0)