@agentv/core 2.2.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,17 +188,31 @@ async function validateEvalFile(filePath) {
188
188
  });
189
189
  }
190
190
  const inputMessages = evalCase.input_messages;
191
- if (!Array.isArray(inputMessages)) {
191
+ const inputAlias = evalCase.input;
192
+ if (Array.isArray(inputMessages)) {
193
+ validateMessages(inputMessages, `${location}.input_messages`, absolutePath, errors);
194
+ } else if (inputAlias !== void 0) {
195
+ if (typeof inputAlias === "string") {
196
+ } else if (Array.isArray(inputAlias)) {
197
+ validateMessages(inputAlias, `${location}.input`, absolutePath, errors);
198
+ } else {
199
+ errors.push({
200
+ severity: "error",
201
+ filePath: absolutePath,
202
+ location: `${location}.input`,
203
+ message: "Invalid 'input' field (must be a string or array of messages)"
204
+ });
205
+ }
206
+ } else {
192
207
  errors.push({
193
208
  severity: "error",
194
209
  filePath: absolutePath,
195
210
  location: `${location}.input_messages`,
196
- message: "Missing or invalid 'input_messages' field (must be an array)"
211
+ message: "Missing 'input_messages' or 'input' field (must provide one)"
197
212
  });
198
- } else {
199
- validateMessages(inputMessages, `${location}.input_messages`, absolutePath, errors);
200
213
  }
201
214
  const expectedMessages = evalCase.expected_messages;
215
+ const expectedOutputAlias = evalCase.expected_output;
202
216
  if (expectedMessages !== void 0 && !Array.isArray(expectedMessages)) {
203
217
  errors.push({
204
218
  severity: "error",
@@ -208,6 +222,26 @@ async function validateEvalFile(filePath) {
208
222
  });
209
223
  } else if (Array.isArray(expectedMessages)) {
210
224
  validateMessages(expectedMessages, `${location}.expected_messages`, absolutePath, errors);
225
+ } else if (expectedOutputAlias !== void 0) {
226
+ if (typeof expectedOutputAlias === "string") {
227
+ } else if (Array.isArray(expectedOutputAlias)) {
228
+ if (expectedOutputAlias.length > 0 && isObject(expectedOutputAlias[0]) && "role" in expectedOutputAlias[0]) {
229
+ validateMessages(
230
+ expectedOutputAlias,
231
+ `${location}.expected_output`,
232
+ absolutePath,
233
+ errors
234
+ );
235
+ }
236
+ } else if (isObject(expectedOutputAlias)) {
237
+ } else {
238
+ errors.push({
239
+ severity: "error",
240
+ filePath: absolutePath,
241
+ location: `${location}.expected_output`,
242
+ message: "Invalid 'expected_output' field (must be a string, object, or array)"
243
+ });
244
+ }
211
245
  }
212
246
  }
213
247
  return {