import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
import Exa from "npm:exa-js"
const exa = new Exa(Deno.env.get("EXA_API_KEY"));
export const exaSearch = async ({ query, type, useAutoprompt, numResults, text, summary=true, highlights }) => {
const result = await exa.searchAndContents(
query,
{
type: type || "auto" || "neural",
useAutoprompt: useAutoprompt || true,
numResults: 10,
highlights: highlights || {
numSentences: 3,
highlightsPerUrl: 1,
},
text,
summary,
}
)
return result.results
}
export const search = async (query) => {
return await exaSearch({query})
}