MCPcopy
hub / github.com/jina-ai/node-DeepResearch / evaluateQuestion

Function evaluateQuestion

src/tools/evaluator.ts:374–404  ·  view source on GitHub ↗
(
  question: string,
  tracker?: TokenTracker
)

Source from the content-addressed store, hash-verified

372const TOOL_NAME = 'evaluator';
373
374export async function evaluateQuestion(
375 question: string,
376 tracker?: TokenTracker
377): Promise<EvaluationType[]> {
378 try {
379 const generator = new ObjectGeneratorSafe(tracker);
380
381 const result = await generator.generateObject({
382 model: TOOL_NAME,
383 schema: questionEvaluationSchema,
384 prompt: getQuestionEvaluationPrompt(question),
385 });
386
387 console.log('Question Evaluation:', result.object);
388
389 // Always include definitive in types
390 const types: EvaluationType[] = ['definitive'];
391 if (result.object.needsFreshness) types.push('freshness');
392 if (result.object.needsPlurality) types.push('plurality');
393
394 console.log('Question Metrics:', types);
395
396 // Always evaluate definitive first, then freshness (if needed), then plurality (if needed)
397 return types;
398
399 } catch (error) {
400 console.error('Error in question evaluation:', error);
401 // Default to all evaluation types in case of error
402 return ['definitive', 'freshness', 'plurality'];
403 }
404}
405
406
407async function performEvaluation<T>(

Callers 1

getResponseFunction · 0.90

Calls 3

generateObjectMethod · 0.95
logMethod · 0.80

Tested by

no test coverage detected