mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2026-03-22 07:29:35 +08:00
fix: categorize agent tokens as reasoning tokens
Co-Authored-By: sha.zhou@jina.ai <sha.zhou@jina.ai>
This commit is contained in:
@@ -12,7 +12,7 @@ import {evaluateAnswer, evaluateQuestion} from "./tools/evaluator";
|
|||||||
import {analyzeSteps} from "./tools/error-analyzer";
|
import {analyzeSteps} from "./tools/error-analyzer";
|
||||||
import {TokenTracker} from "./utils/token-tracker";
|
import {TokenTracker} from "./utils/token-tracker";
|
||||||
import {ActionTracker} from "./utils/action-tracker";
|
import {ActionTracker} from "./utils/action-tracker";
|
||||||
import {StepAction, AnswerAction} from "./types";
|
import {StepAction, AnswerAction, TOKEN_CATEGORIES} from "./types";
|
||||||
import {TrackerContext} from "./types";
|
import {TrackerContext} from "./types";
|
||||||
import {search} from "./tools/jina-search";
|
import {search} from "./tools/jina-search";
|
||||||
// import {grounding} from "./tools/grounding";
|
// import {grounding} from "./tools/grounding";
|
||||||
@@ -366,7 +366,7 @@ export async function getResponse(question: string, tokenBudget: number = 1_000_
|
|||||||
console.log(thisStep)
|
console.log(thisStep)
|
||||||
|
|
||||||
context.actionTracker.trackAction({totalStep, thisStep, gaps, badAttempts});
|
context.actionTracker.trackAction({totalStep, thisStep, gaps, badAttempts});
|
||||||
context.tokenTracker.trackUsage('agent', totalTokens);
|
context.tokenTracker.trackUsage('agent', totalTokens, TOKEN_CATEGORIES.REASONING);
|
||||||
|
|
||||||
// reset allowAnswer to true
|
// reset allowAnswer to true
|
||||||
allowAnswer = true;
|
allowAnswer = true;
|
||||||
@@ -707,7 +707,7 @@ You decided to think out of the box or cut from a completely different angle.`);
|
|||||||
await storeContext(prompt, schema, [allContext, allKeywords, allQuestions, allKnowledge], totalStep);
|
await storeContext(prompt, schema, [allContext, allKeywords, allQuestions, allKnowledge], totalStep);
|
||||||
thisStep = object as StepAction;
|
thisStep = object as StepAction;
|
||||||
context.actionTracker.trackAction({totalStep, thisStep, gaps, badAttempts});
|
context.actionTracker.trackAction({totalStep, thisStep, gaps, badAttempts});
|
||||||
context.tokenTracker.trackUsage('agent', totalTokens);
|
context.tokenTracker.trackUsage('agent', totalTokens, TOKEN_CATEGORIES.REASONING);
|
||||||
console.log(thisStep)
|
console.log(thisStep)
|
||||||
return {result: thisStep, context};
|
return {result: thisStep, context};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user