mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
feat: update search query handling and enhance serpCluster schema
This commit is contained in:
parent
74f521bec8
commit
0bbcf9ca85
@ -305,7 +305,8 @@ async function executeSearchQueries(
|
|||||||
switch (searchProvider || SEARCH_PROVIDER) {
|
switch (searchProvider || SEARCH_PROVIDER) {
|
||||||
case 'jina':
|
case 'jina':
|
||||||
case 'arxiv':
|
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;
|
break;
|
||||||
case 'duck':
|
case 'duck':
|
||||||
results = (await duckSearch(query.q, { safeSearch: SafeSearchType.STRICT })).results;
|
results = (await duckSearch(query.q, { safeSearch: SafeSearchType.STRICT })).results;
|
||||||
|
|||||||
@ -29,6 +29,7 @@ export async function serpCluster(results: SearchSnippet[], trackers: TrackerCon
|
|||||||
system: prompt.system,
|
system: prompt.system,
|
||||||
prompt: prompt.user,
|
prompt: prompt.user,
|
||||||
});
|
});
|
||||||
|
trackers?.actionTracker.trackThink(result.object.think);
|
||||||
const clusters = result.object.clusters;
|
const clusters = result.object.clusters;
|
||||||
logInfo(TOOL_NAME, { clusters });
|
logInfo(TOOL_NAME, { clusters });
|
||||||
return clusters;
|
return clusters;
|
||||||
|
|||||||
@ -176,6 +176,7 @@ export class Schemas {
|
|||||||
|
|
||||||
getSerpClusterSchema(): z.ZodObject<any> {
|
getSerpClusterSchema(): z.ZodObject<any> {
|
||||||
return z.object({
|
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(
|
clusters: z.array(
|
||||||
z.object({
|
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),
|
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),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user