chore: first commit

This commit is contained in:
Han Xiao 2025-01-31 18:42:11 +08:00
parent d8678467d7
commit 98a3e033fb
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import { dedupQueries } from "./tools/dedup";
import { evaluateAnswer } from "./tools/evaluator";
import { StepData } from "./tools/getURLIndex";
import { analyzeSteps } from "./tools/error-analyzer";
import { GEMINI_API_KEY, JINA_API_KEY, MODEL_NAME, BRAVE_API_KEY, SEARCH_PROVIDER } from "./config";
import {GEMINI_API_KEY, JINA_API_KEY, MODEL_NAME, BRAVE_API_KEY, SEARCH_PROVIDER, STEP_SLEEP} from "./config";
import { tokenTracker } from "./utils/token-tracker";
async function sleep(ms: number) {
@ -273,7 +273,7 @@ async function getResponse(question: string, tokenBudget: number = 1000000, maxB
const allURLs: Record<string, string> = {};
while (tokenTracker.getTotalUsage() < tokenBudget) {
// add 1s delay to avoid rate limiting
await sleep(1000);
await sleep(STEP_SLEEP);
step++;
totalStep++;
console.log(`Step ${totalStep}`);
@ -487,7 +487,6 @@ But then you realized you have asked them before. You decided to to think out of
}
searchResults.push({query, results: minResults});
allKeywords.push(query);
await sleep(5000);
}
diaryContext.push(`
At step ${step}, you took the **search** action and look for external information for the question: "${currentQuestion}".

View File

@ -20,6 +20,7 @@ export const BRAVE_API_KEY = process.env.BRAVE_API_KEY as string;
export const SEARCH_PROVIDER = BRAVE_API_KEY ? 'brave' : 'duck';
export const MODEL_NAME = 'gemini-1.5-flash';
export const STEP_SLEEP = 1000;
if (!GEMINI_API_KEY) throw new Error("GEMINI_API_KEY not found");
if (!JINA_API_KEY) throw new Error("JINA_API_KEY not found");