Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api): distinguish absent search content

Rakshith Ramprakashe9e5d3bf63b4
diff --git a/apps/api/src/lib/agent-hints.test.ts b/apps/api/src/lib/agent-hints.test.ts
index cc062b35b..2b767db54 100644
--- a/apps/api/src/lib/agent-hints.test.ts
+++ b/apps/api/src/lib/agent-hints.test.ts
@@ -24,6 +24,22 @@ describe("deterministic agent hints", () => {
},
);
+ it.each(["markdown", "html", "rawHtml"])(
+ "treats a present but empty %s field as fetched content",
+ contentField => {
+ expect(
+ hints({
+ response: {
+ success: true,
+ data: {
+ web: [{ url: "https://example.com", [contentField]: "" }],
+ },
+ },
+ }),
+ ).toEqual([]);
+ },
+ );
+
it("checks missing full content per result and does not scrape everything", () => {
expect(
hints({
diff --git a/apps/api/src/lib/agent-hints.ts b/apps/api/src/lib/agent-hints.ts
index 55c859b82..e4b0250c0 100644
--- a/apps/api/src/lib/agent-hints.ts
+++ b/apps/api/src/lib/agent-hints.ts
@@ -94,9 +94,9 @@ export function buildAgentHints(context: AgentHintContext): string[] {
const item = object(value);
return (
typeof item.url === "string" &&
- !item.markdown &&
- !item.html &&
- !item.rawHtml
+ item.markdown === undefined &&
+ item.html === undefined &&
+ item.rawHtml === undefined
);
});
if (hasMissingContent) {