@agentv/core 4.0.0 → 4.1.0

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.
package/dist/index.js CHANGED
@@ -733,7 +733,7 @@ function validateTemplateVariables(content, source) {
733
733
  match = variablePattern.exec(content);
734
734
  }
735
735
  const hasCandidateAnswer = foundVariables.has(TEMPLATE_VARIABLES.OUTPUT) || foundVariables.has(TEMPLATE_VARIABLES.OUTPUT_TEXT);
736
- const hasExpectedOutput = foundVariables.has(TEMPLATE_VARIABLES.EXPECTED_OUTPUT);
736
+ const hasExpectedOutput = foundVariables.has(TEMPLATE_VARIABLES.EXPECTED_OUTPUT) || foundVariables.has(TEMPLATE_VARIABLES.EXPECTED_OUTPUT_TEXT);
737
737
  const hasRequiredFields = hasCandidateAnswer || hasExpectedOutput;
738
738
  if (!hasRequiredFields) {
739
739
  throw new Error(
@@ -3984,7 +3984,8 @@ function toContentArray(content) {
3984
3984
  } else if (p.type === "image" && typeof p.source === "object" && p.source !== null) {
3985
3985
  const src = p.source;
3986
3986
  const mediaType = typeof p.media_type === "string" ? p.media_type : typeof src.media_type === "string" ? src.media_type : "application/octet-stream";
3987
- const data = typeof src.data === "string" ? `data:${mediaType};base64,${src.data}` : typeof p.url === "string" ? p.url : "";
3987
+ const data = typeof src.data === "string" && src.data !== "" ? `data:${mediaType};base64,${src.data}` : typeof p.url === "string" && p.url !== "" ? p.url : "";
3988
+ if (!data) continue;
3988
3989
  blocks.push({ type: "image", media_type: mediaType, source: data });
3989
3990
  hasNonText = true;
3990
3991
  } else if (p.type === "tool_use") {