You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$2?q=openai&page=5&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=openai
Returns an array of strings in format "username" or "username/projectName"
Found 2155 results for "openai"(1027ms)
1import ky from "https://esm.sh/ky";
23const response = await fetch("https://www.google.com?q=openai&hl=en&gl=us", {
4headers: {
5"User-Agent":
593594export default async function(req: Request) {
595const { OpenAI } = await import("https://esm.town/v/std/openai");
596const { PDFExtract } = await import("npm:pdf.js-extract");
597607const action = url.searchParams.get("action");
608const sourceUrl = import.meta.url.replace("esm.town", "val.town");
609const openai = new OpenAI();
610const MAX_TEXT_SUGGEST = 20000;
611const MAX_TEXT_ANALYZE = 30000;
636agentName: string,
637): Promise<object> {
638log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` });
639try {
640const response = await openai.chat.completions.create({
641model: "gpt-4o",
642messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],