feat(actions): update web search action to use reasoning

This commit is contained in:
ItzCrazyKns
2025-12-13 22:17:02 +05:30
parent 0b9e193ed1
commit 0688630863

View File

@@ -21,7 +21,7 @@ For example, if the user is asking about the features of a new technology, you m
You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding. You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding.
If this tool is present and no other tools are more relevant, you MUST use this tool to get the needed information. If this tool is present and no other tools are more relevant, you MUST use this tool to get the needed information.
` `;
const balancedModePrompt = ` const balancedModePrompt = `
Use this tool to perform web searches based on the provided queries. This is useful when you need to gather information from the web to answer the user's questions. You can provide up to 3 queries at a time. You will have to use this every single time if this is present and relevant. Use this tool to perform web searches based on the provided queries. This is useful when you need to gather information from the web to answer the user's questions. You can provide up to 3 queries at a time. You will have to use this every single time if this is present and relevant.
@@ -32,16 +32,16 @@ Start initially with broader queries to get an overview, then narrow down with m
Your queries shouldn't be sentences but rather keywords that are SEO friendly and can be used to search the web for information. Your queries shouldn't be sentences but rather keywords that are SEO friendly and can be used to search the web for information.
For example if the user is asking about Tesla, your actions should be like: For example if the user is asking about Tesla, your actions should be like:
1. __plan "The user is asking about Tesla. I will start with broader queries to get an overview of Tesla, then narrow down with more specific queries based on the results I receive." then 1. 0_reasoning "The user is asking about Tesla. I will start with broader queries to get an overview of Tesla, then narrow down with more specific queries based on the results I receive." then
2. web_search ["Tesla", "Tesla latest news", "Tesla stock price"] then 2. web_search ["Tesla", "Tesla latest news", "Tesla stock price"] then
3. __plan "Based on the previous search results, I will now narrow down my queries to focus on Tesla's recent developments and stock performance." then 3. 0_reasoning "Based on the previous search results, I will now narrow down my queries to focus on Tesla's recent developments and stock performance." then
4. web_search ["Tesla Q2 2025 earnings", "Tesla new model 2025", "Tesla stock analysis"] then done. 4. web_search ["Tesla Q2 2025 earnings", "Tesla new model 2025", "Tesla stock analysis"] then done.
5. __plan "I have gathered enough information to provide a comprehensive answer." 5. 0_reasoning "I have gathered enough information to provide a comprehensive answer."
6. done. 6. done.
You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding. You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding.
If this tool is present and no other tools are more relevant, you MUST use this tool to get the needed information. You can call this tools, multiple times as needed. If this tool is present and no other tools are more relevant, you MUST use this tool to get the needed information. You can call this tools, multiple times as needed.
` `;
const qualityModePrompt = ` const qualityModePrompt = `
Use this tool to perform web searches based on the provided queries. This is useful when you need to gather information from the web to answer the user's questions. You can provide up to 3 queries at a time. You will have to use this every single time if this is present and relevant. Use this tool to perform web searches based on the provided queries. This is useful when you need to gather information from the web to answer the user's questions. You can provide up to 3 queries at a time. You will have to use this every single time if this is present and relevant.
@@ -54,31 +54,32 @@ Your queries shouldn't be sentences but rather keywords that are SEO friendly an
You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding. You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding.
If this tool is present and no other tools are more relevant, you MUST use this tool to get the needed information. You can call this tools, multiple times as needed. If this tool is present and no other tools are more relevant, you MUST use this tool to get the needed information. You can call this tools, multiple times as needed.
` `;
const webSearchAction: ResearchAction<typeof actionSchema> = { const webSearchAction: ResearchAction<typeof actionSchema> = {
name: 'web_search', name: 'web_search',
schema: actionSchema, schema: actionSchema,
getToolDescription: () => 'Use this tool to perform web searches based on the provided queries. This is useful when you need to gather information from the web to answer the user\'s questions. You can provide up to 3 queries at a time. You will have to use this every single time if this is present and relevant.', getToolDescription: () =>
"Use this tool to perform web searches based on the provided queries. This is useful when you need to gather information from the web to answer the user's questions. You can provide up to 3 queries at a time. You will have to use this every single time if this is present and relevant.",
getDescription: (config) => { getDescription: (config) => {
let prompt = '' let prompt = '';
switch (config.mode) { switch (config.mode) {
case 'speed': case 'speed':
prompt = speedModePrompt prompt = speedModePrompt;
break; break;
case 'balanced': case 'balanced':
prompt = balancedModePrompt prompt = balancedModePrompt;
break; break;
case 'quality': case 'quality':
prompt = qualityModePrompt prompt = qualityModePrompt;
break; break;
default: default:
prompt = speedModePrompt prompt = speedModePrompt;
break; break;
} }
return prompt return prompt;
}, },
enabled: (config) => enabled: (config) =>
config.classification.classification.skipSearch === false, config.classification.classification.skipSearch === false,