mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
feat: improve search action
This commit is contained in:
parent
4925303c57
commit
fa05e53307
14
src/agent.ts
14
src/agent.ts
@ -75,6 +75,7 @@ function getPrompt(
|
||||
question: string,
|
||||
context?: string[],
|
||||
allQuestions?: string[],
|
||||
allKeywords?: string[],
|
||||
allowReflect: boolean = true,
|
||||
allowAnswer: boolean = true,
|
||||
allowRead: boolean = true,
|
||||
@ -190,11 +191,18 @@ ${urlList}
|
||||
}
|
||||
|
||||
if (allowSearch) {
|
||||
|
||||
actionSections.push(`
|
||||
<action-search>
|
||||
- Query external sources using a public search engine
|
||||
- Search external, realtime world-knoweledge using a search engine
|
||||
- Focus on solving one specific aspect of the question
|
||||
- Only give keywords search query, not full sentences
|
||||
- Only use keywords in th search query, not full sentences
|
||||
${allKeywords?.length ? `
|
||||
- The following searched queries do not give useful information, you need to think out of the box or cut from a completely different angle:
|
||||
<bad-queries>
|
||||
${allKeywords.join('\n')}
|
||||
</bad-queries>
|
||||
` : ''}
|
||||
</action-search>
|
||||
`);
|
||||
}
|
||||
@ -314,6 +322,7 @@ export async function getResponse(question: string, tokenBudget: number = 1_000_
|
||||
currentQuestion,
|
||||
diaryContext,
|
||||
allQuestions,
|
||||
allKeywords,
|
||||
allowReflect,
|
||||
allowAnswer,
|
||||
allowRead,
|
||||
@ -640,6 +649,7 @@ You decided to think out of the box or cut from a completely different angle.`);
|
||||
question,
|
||||
diaryContext,
|
||||
allQuestions,
|
||||
allKeywords,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
|
||||
@ -18,7 +18,7 @@ const responseSchema = z.object({
|
||||
|
||||
|
||||
function getPrompt(action: SearchAction): string {
|
||||
return `You are an expert Information Retrieval Assistant. Transform user queries into precise keyword combinations with strategic reasoning and appropriate search operators.
|
||||
return `You are an expert Information Retrieval query optimizer. Optimize user queries into precise keyword combinations with strategic reasoning and appropriate search operators.
|
||||
|
||||
<rules>
|
||||
1. Generate search queries that directly include appropriate operators
|
||||
@ -61,7 +61,7 @@ Input Query: How to fix a leaking kitchen faucet?
|
||||
<think>
|
||||
This is a how-to query seeking practical solutions. User likely wants step-by-step guidance and visual demonstrations for DIY repair. We'll target both video tutorials and written guides.
|
||||
</think>
|
||||
Queries: [
|
||||
Output Queries: [
|
||||
"kitchen faucet leak repair",
|
||||
"faucet drip fix site:youtube.com",
|
||||
"how to repair faucet "
|
||||
@ -71,7 +71,7 @@ Input Query: What are healthy breakfast options for type 2 diabetes?
|
||||
<think>
|
||||
This is a health-specific informational query. User needs authoritative medical advice combined with practical meal suggestions. Splitting into medical guidelines and recipes will provide comprehensive coverage.
|
||||
</think>
|
||||
Queries: [
|
||||
Output Queries: [
|
||||
"what to eat for type 2 diabetes",
|
||||
"type 2 diabetes breakfast guidelines",
|
||||
"diabetic breakfast recipes"
|
||||
@ -81,7 +81,7 @@ Input Query: Latest AWS Lambda features for serverless applications
|
||||
<think>
|
||||
This is a product research query focused on recent updates. User wants current information about specific technology features, likely for implementation purposes. We'll target official docs and community insights.
|
||||
</think>
|
||||
Queries: [
|
||||
Output Queries: [
|
||||
"aws lambda features site:aws.amazon.com intitle:2025",
|
||||
"new features lambda serverless"
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user