@absolutejs/absolute 0.19.0-beta.514 → 0.19.0-beta.515

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/ai/index.js CHANGED
@@ -5043,6 +5043,54 @@ var buildRAGContextProvenanceLabel = (metadata) => {
5043
5043
  ].filter((value) => value.length > 0);
5044
5044
  return labels.length > 0 ? labels.join(" \xB7 ") : undefined;
5045
5045
  };
5046
+ var buildRAGContextCitationGuidance = (hits) => {
5047
+ const needsPageGuidance = hits.some((hit) => {
5048
+ const metadata = hit.metadata;
5049
+ if (!metadata) {
5050
+ return false;
5051
+ }
5052
+ return getContextNumber(metadata.page) !== undefined || getContextNumber(metadata.pageNumber) !== undefined || typeof metadata.pageIndex === "number";
5053
+ });
5054
+ const needsSheetGuidance = hits.some((hit) => {
5055
+ const metadata = hit.metadata;
5056
+ if (!metadata) {
5057
+ return false;
5058
+ }
5059
+ return getContextString(metadata.sheetName) !== undefined || Array.isArray(metadata.sheetNames) && getContextString(metadata.sheetNames[0]) !== undefined;
5060
+ });
5061
+ const needsSlideGuidance = hits.some((hit) => {
5062
+ const metadata = hit.metadata;
5063
+ if (!metadata) {
5064
+ return false;
5065
+ }
5066
+ return getContextNumber(metadata.slide) !== undefined || getContextNumber(metadata.slideNumber) !== undefined || typeof metadata.slideIndex === "number";
5067
+ });
5068
+ const needsTimestampGuidance = hits.some((hit) => {
5069
+ const metadata = hit.metadata;
5070
+ if (!metadata) {
5071
+ return false;
5072
+ }
5073
+ return typeof metadata.startMs === "number" || typeof metadata.endMs === "number";
5074
+ });
5075
+ const needsAttachmentGuidance = hits.some((hit) => getContextString(hit.metadata?.emailKind) === "attachment");
5076
+ const needsThreadGuidance = hits.some((hit) => getContextString(hit.metadata?.threadTopic) !== undefined || getContextString(hit.metadata?.from) !== undefined);
5077
+ const needsArchiveGuidance = hits.some((hit) => {
5078
+ const metadata = hit.metadata;
5079
+ return getContextString(metadata?.archiveEntryPath) !== undefined || getContextString(metadata?.entryPath) !== undefined;
5080
+ });
5081
+ const guidanceLines = [
5082
+ "When you use retrieved context, cite it inline with [1], [2]. Prefer the most specific evidence available and preserve page, sheet, slide, timestamp, attachment, archive entry, or thread cues when the context provides them.",
5083
+ needsPageGuidance ? "For PDF evidence, keep the cited page number in the answer when the context includes one." : "",
5084
+ needsSheetGuidance ? "For spreadsheet evidence, name the worksheet when the context identifies a sheet." : "",
5085
+ needsSlideGuidance ? "For presentation evidence, keep the slide number in the answer when the context provides it." : "",
5086
+ needsTimestampGuidance ? "For media evidence, preserve the cited timestamp range in the answer." : "",
5087
+ needsAttachmentGuidance ? "For email attachment evidence, distinguish the attachment from the parent message." : "",
5088
+ needsThreadGuidance ? "For email message evidence, preserve sender or thread cues when they matter to the claim." : "",
5089
+ needsArchiveGuidance ? "For archive evidence, identify the archive entry path instead of only naming the outer archive." : ""
5090
+ ].filter((value) => value.length > 0);
5091
+ return guidanceLines.join(`
5092
+ `);
5093
+ };
5046
5094
  var buildRAGContext = (hits) => {
5047
5095
  if (hits.length === 0) {
5048
5096
  return "";
@@ -5066,7 +5114,7 @@ ${sourceLines.join(`
5066
5114
 
5067
5115
  `)}
5068
5116
 
5069
- When you use retrieved context, cite it inline with [1], [2]. Prefer the most specific evidence available and preserve page, sheet, slide, timestamp, attachment, or thread cues when the context provides them.`;
5117
+ ${buildRAGContextCitationGuidance(hits)}`;
5070
5118
  };
5071
5119
 
5072
5120
  // src/ai/rag/chat.ts
@@ -10497,5 +10545,5 @@ export {
10497
10545
  aiChat
10498
10546
  };
10499
10547
 
10500
- //# debugId=B33CC824E07DC89F64756E2164756E21
10548
+ //# debugId=80D809BE3389E86564756E2164756E21
10501
10549
  //# sourceMappingURL=index.js.map