mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
chore: first commit
This commit is contained in:
parent
d8678467d7
commit
98a3e033fb
@ -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}".
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user