openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
81 lines (80 loc) • 2.38 kB
JavaScript
import { t as createExaWebSearchProviderBase } from "./exa-web-search-provider.shared-CmAvcR4N.js";
//#region extensions/exa/src/exa-web-search-provider.ts
const EXA_SEARCH_TYPES = [
"auto",
"neural",
"fast",
"deep",
"deep-reasoning",
"instant"
];
const EXA_FRESHNESS_VALUES = [
"day",
"week",
"month",
"year"
];
const EXA_MAX_SEARCH_COUNT = 100;
let exaWebSearchRuntimePromise;
function loadExaWebSearchRuntime() {
exaWebSearchRuntimePromise ??= import("./exa-web-search-provider.runtime.js");
return exaWebSearchRuntimePromise;
}
const ExaSearchSchema = {
type: "object",
properties: {
query: {
type: "string",
description: "Search query string."
},
count: {
type: "integer",
description: "Number of results to return (1-100, subject to Exa search-type limits).",
minimum: 1,
maximum: EXA_MAX_SEARCH_COUNT
},
freshness: {
type: "string",
enum: [...EXA_FRESHNESS_VALUES],
description: "Filter by time: \"day\", \"week\", \"month\", or \"year\"."
},
date_after: {
type: "string",
description: "Only results published after this date (YYYY-MM-DD)."
},
date_before: {
type: "string",
description: "Only results published before this date (YYYY-MM-DD)."
},
type: {
type: "string",
enum: [...EXA_SEARCH_TYPES],
description: "Exa search mode: \"auto\", \"neural\", \"fast\", \"deep\", \"deep-reasoning\", or \"instant\"."
},
contents: {
type: "object",
properties: {
highlights: { description: "Highlights config: true, or an object with maxCharacters, query, numSentences, or highlightsPerUrl." },
text: { description: "Text config: true, or an object with maxCharacters." },
summary: { description: "Summary config: true, or an object with query." }
},
additionalProperties: false
}
},
additionalProperties: false
};
function createExaWebSearchProvider() {
return {
...createExaWebSearchProviderBase(),
createTool: (ctx) => ({
description: "Search the web using Exa AI. Supports neural or keyword search, publication date filters, and optional highlights or text extraction.",
parameters: ExaSearchSchema,
execute: async (args) => {
const { executeExaWebSearchProviderTool } = await loadExaWebSearchRuntime();
return await executeExaWebSearchProviderTool(ctx, args);
}
})
};
}
//#endregion
export { createExaWebSearchProvider as t };