@absolutejs/rag 0.22.6 → 0.22.7
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/CHANGELOG.md +7 -0
- package/changelog.json +440 -424
- package/dist/research/index.js +18 -5
- package/dist/research/index.js.map +5 -5
- package/dist/src/research/plugin.d.ts +5 -0
- package/dist/src/research/types.d.ts +2 -0
- package/dist/web-index/index.js +16 -5
- package/dist/web-index/index.js.map +3 -3
- package/package.json +1 -1
package/dist/research/index.js
CHANGED
|
@@ -121450,7 +121450,7 @@ ${prompt}`,
|
|
|
121450
121450
|
return generated.object;
|
|
121451
121451
|
};
|
|
121452
121452
|
const normalize = (text) => text.normalize("NFKC").toLowerCase().replace(/\s+/gu, " ").trim();
|
|
121453
|
-
const requiredPhrases = input.requiredPhrases ?? [...input.query.matchAll(/"([^"\n]+)"/gu)].map((match) => match[1]);
|
|
121453
|
+
const requiredPhrases = input.requiredPhrases ?? (input.queryMode === "task" ? [] : [...input.query.matchAll(/"([^"\n]+)"/gu)].map((match) => match[1]));
|
|
121454
121454
|
const urls = new Set;
|
|
121455
121455
|
const queries = new Set;
|
|
121456
121456
|
let evidenceChars = 0;
|
|
@@ -121557,9 +121557,20 @@ ${prompt}`,
|
|
|
121557
121557
|
}
|
|
121558
121558
|
};
|
|
121559
121559
|
try {
|
|
121560
|
-
|
|
121561
|
-
|
|
121562
|
-
|
|
121560
|
+
const needsInitialPlan = !input.queries && (input.queryMode === "task" || boundedQueries(input.query).length > 1) && limits.rounds > 0;
|
|
121561
|
+
if (needsInitialPlan) {
|
|
121562
|
+
const initial = await generate("plan", PlanSchema, "Turn the research task into concise search-engine queries. Preserve the requested company identity and target criteria, but never copy instructions, JSON, internal markers, or the whole brief into a query. Prioritize the most useful query first. Return at most remainingSearches queries. Return no URLs: source URLs must be discovered rather than invented.", {
|
|
121563
|
+
query: input.query,
|
|
121564
|
+
instructions: task.instructions,
|
|
121565
|
+
remainingSearches: limits.searches
|
|
121566
|
+
});
|
|
121567
|
+
for (const query of initial.queries)
|
|
121568
|
+
await doSearch(query);
|
|
121569
|
+
} else {
|
|
121570
|
+
for (const query of input.queries ?? [input.query])
|
|
121571
|
+
await doSearch(query);
|
|
121572
|
+
}
|
|
121573
|
+
for (let round = needsInitialPlan ? 1 : 0;round < limits.rounds; round++) {
|
|
121563
121574
|
if (!result.sources.length && queries.size >= limits.searches)
|
|
121564
121575
|
break;
|
|
121565
121576
|
let plan;
|
|
@@ -121669,6 +121680,7 @@ var renderResearchResult = (result) => `<section aria-label="Research result"><p
|
|
|
121669
121680
|
}).join("")}</li>`).join("")}</ul>${result.limitations.map((message) => `<p>${escape5(message)}</p>`).join("")}</section>`;
|
|
121670
121681
|
var bodySchema = t.Object({
|
|
121671
121682
|
query: t.String({ minLength: 1, maxLength: 8000 }),
|
|
121683
|
+
queryMode: t.Optional(t.Union([t.Literal("search"), t.Literal("task")])),
|
|
121672
121684
|
task: t.Optional(t.String({ maxLength: 128 })),
|
|
121673
121685
|
freshness: t.Optional(t.String({ maxLength: 64 }))
|
|
121674
121686
|
}, { additionalProperties: false });
|
|
@@ -122388,6 +122400,7 @@ var researchManifest = defineManifest()({
|
|
|
122388
122400
|
},
|
|
122389
122401
|
input: Type.Object({
|
|
122390
122402
|
query: Type.String({ minLength: 1, maxLength: 8000 }),
|
|
122403
|
+
queryMode: Type.Optional(Type.Union([Type.Literal("search"), Type.Literal("task")])),
|
|
122391
122404
|
task: Type.Optional(Type.String({ maxLength: 128 }))
|
|
122392
122405
|
}),
|
|
122393
122406
|
handler: async (input, runtime) => JSON.stringify(await runtime.run(input))
|
|
@@ -122486,5 +122499,5 @@ export {
|
|
|
122486
122499
|
selectResearchMonitorEvents
|
|
122487
122500
|
};
|
|
122488
122501
|
|
|
122489
|
-
//# debugId=
|
|
122502
|
+
//# debugId=F48D3A6490A0A2CE64756E2164756E21
|
|
122490
122503
|
//# sourceMappingURL=index.js.map
|