Skip to content

Commit 0bbcf9c

Browse files
committed
feat: update search query handling and enhance serpCluster schema
1 parent 74f521b commit 0bbcf9c

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/agent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ async function executeSearchQueries(
305305
switch (searchProvider || SEARCH_PROVIDER) {
306306
case 'jina':
307307
case 'arxiv':
308-
results = (await search(query, searchProvider, 30, meta, context.tokenTracker)).response.results || [];
308+
const num = meta ? undefined : 30;
309+
results = (await search(query, searchProvider, num, meta, context.tokenTracker)).response.results || [];
309310
break;
310311
case 'duck':
311312
results = (await duckSearch(query.q, { safeSearch: SafeSearchType.STRICT })).results;

src/tools/serp-cluster.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export async function serpCluster(results: SearchSnippet[], trackers: TrackerCon
2929
system: prompt.system,
3030
prompt: prompt.user,
3131
});
32+
trackers?.actionTracker.trackThink(result.object.think);
3233
const clusters = result.object.clusters;
3334
logInfo(TOOL_NAME, { clusters });
3435
return clusters;

src/utils/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export class Schemas {
176176

177177
getSerpClusterSchema(): z.ZodObject<any> {
178178
return z.object({
179+
think: z.string().describe(`Short explain of why you group the search results like this. ${this.getLanguagePrompt()}`).max(500),
179180
clusters: z.array(
180181
z.object({
181182
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),

0 commit comments

Comments
 (0)