feat!: make web search Exa-only
BREAKING CHANGE: remove Tavily, Firecrawl, provider fallback, and web-search-config. web_search and web_fetch now use Exa-shaped inputs and return raw Exa-style details.
This commit is contained in:
@@ -2,14 +2,14 @@ import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { createWebFetchTool } from "./web-fetch.ts";
|
||||
|
||||
test("createWebFetchTool passes Firecrawl fetch options through to the runtime", async () => {
|
||||
test("createWebFetchTool passes Exa getContents options through without injecting default text", async () => {
|
||||
let captured: any;
|
||||
|
||||
const tool = createWebFetchTool({
|
||||
async executeFetch(request) {
|
||||
captured = request;
|
||||
return {
|
||||
providerName: "firecrawl-main",
|
||||
requestId: "req-fetch-1",
|
||||
results: [],
|
||||
};
|
||||
},
|
||||
@@ -17,22 +17,48 @@ test("createWebFetchTool passes Firecrawl fetch options through to the runtime",
|
||||
|
||||
await tool.execute("tool-call", {
|
||||
urls: ["https://pi.dev"],
|
||||
provider: "firecrawl-main",
|
||||
firecrawl: {
|
||||
formats: ["markdown", "summary", "images"],
|
||||
summary: true,
|
||||
extras: {
|
||||
links: 5,
|
||||
},
|
||||
} as any);
|
||||
|
||||
assert.deepEqual(captured, {
|
||||
urls: ["https://pi.dev/"],
|
||||
text: true,
|
||||
highlights: false,
|
||||
summary: false,
|
||||
textMaxCharacters: undefined,
|
||||
provider: "firecrawl-main",
|
||||
tavily: undefined,
|
||||
firecrawl: {
|
||||
formats: ["markdown", "summary", "images"],
|
||||
summary: true,
|
||||
extras: {
|
||||
links: 5,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("createWebFetchTool supports the single-url alias", async () => {
|
||||
let captured: any;
|
||||
|
||||
const tool = createWebFetchTool({
|
||||
async executeFetch(request) {
|
||||
captured = request;
|
||||
return {
|
||||
requestId: "req-fetch-1",
|
||||
results: [],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
const prepared = tool.prepareArguments({ url: "https://exa.ai" });
|
||||
await tool.execute("tool-call", prepared as any);
|
||||
|
||||
assert.deepEqual(captured, {
|
||||
urls: ["https://exa.ai/"],
|
||||
});
|
||||
});
|
||||
|
||||
test("createWebFetchTool rejects invalid urls", async () => {
|
||||
const tool = createWebFetchTool({
|
||||
async executeFetch() {
|
||||
throw new Error("not used");
|
||||
},
|
||||
});
|
||||
|
||||
await assert.rejects(() => tool.execute("tool-call", { urls: ["notaurl"] } as any), /Invalid URL: notaurl/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user