feat: update search query handling and enhance serpCluster schema

This commit is contained in:
Han Xiao 2025-06-17 18:48:38 -07:00
parent 74f521bec8
commit 0bbcf9ca85
3 changed files with 4 additions and 1 deletions

View File

@ -305,7 +305,8 @@ async function executeSearchQueries(
switch (searchProvider || SEARCH_PROVIDER) {
case 'jina':
case 'arxiv':
results = (await search(query, searchProvider, 30, meta, context.tokenTracker)).response.results || [];
const num = meta ? undefined : 30;
results = (await search(query, searchProvider, num, meta, context.tokenTracker)).response.results || [];
break;
case 'duck':
results = (await duckSearch(query.q, { safeSearch: SafeSearchType.STRICT })).results;

View File

@ -29,6 +29,7 @@ export async function serpCluster(results: SearchSnippet[], trackers: TrackerCon
system: prompt.system,
prompt: prompt.user,
});
trackers?.actionTracker.trackThink(result.object.think);
const clusters = result.object.clusters;
logInfo(TOOL_NAME, { clusters });
return clusters;

View File

@ -176,6 +176,7 @@ export class Schemas {
getSerpClusterSchema(): z.ZodObject<any> {
return z.object({
think: z.string().describe(`Short explain of why you group the search results like this. ${this.getLanguagePrompt()}`).max(500),
clusters: z.array(
z.object({
insight: z.string().describe('Summary and list key numbers, data, soundbites, and insights that worth to be highlighted. End with an actionable advice such as "Visit these URLs if you want to understand [what...]". Do not use "This cluster..."').max(200),