Skip to content

Commit

Permalink
chore: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Feb 4, 2025
1 parent b2d385a commit 0698382
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,10 @@ export async function getResponse(question: string, tokenBudget: number = 1_000_
step++;
totalStep++;
context.actionTracker.trackAction({totalStep, thisStep, gaps, badAttempts});
const budgetPercentage = (context.tokenTracker.getTotalUsage() / tokenBudget * 100).toFixed(2);
console.log(`| Recursion ${recursionLevel} | Step ${totalStep} | Budget used ${budgetPercentage}% |`);
console.log('Gaps:', gaps);
allowReflect = allowReflect && (gaps.length <= 1);
const currentQuestion = gaps.length > 0 ? gaps.shift()! : question;
const budgetPercentage = (context.tokenTracker.getTotalUsage() / tokenBudget * 100).toFixed(0);
const currentQuestion = question
console.log(`| Recursion ${recursionLevel} | Step ${totalStep} | Token Budget ${tokenBudget} | Budget Used: ${budgetPercentage}% | Q: ${currentQuestion} |`);

// update all urls with buildURLMap
allowRead = allowRead && (Object.keys(allURLs).length > 0);
allowSearch = allowSearch && (Object.keys(allURLs).length < 20); // disable search when too many urls already
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const modelConfigs: ToolConfigs = {
};

export const STEP_SLEEP = 1000;
export const DEFAULT_BUDGET_SPLIT_RATIO = 0.3; // Each sub-question gets 30% of parent's budget
export const DEFAULT_BUDGET_SPLIT_RATIO = 1; // Each sub-question gets 30% of parent's budget


if (!GEMINI_API_KEY) throw new Error("GEMINI_API_KEY not found");
Expand Down

0 comments on commit 0698382

Please sign in to comment.