fix(deep-research): searchLanguage
is missing when recursively calling deepResearch
This commit is contained in:
@ -92,22 +92,24 @@ export function generateSearchQueries({
|
||||
const schema = z.object({
|
||||
queries: z
|
||||
.array(
|
||||
z.object({
|
||||
query: z.string().describe('The SERP query'),
|
||||
z
|
||||
.object({
|
||||
query: z.string().describe('The SERP query.'),
|
||||
researchGoal: z
|
||||
.string()
|
||||
.describe(
|
||||
'First talk about the goal of the research that this query is meant to accomplish, then go deeper into how to advance the research once the results are found, mention additional research directions. Be as specific as possible, especially for additional research directions.',
|
||||
),
|
||||
}),
|
||||
})
|
||||
.required({ query: true, researchGoal: true }),
|
||||
)
|
||||
.describe(`List of SERP queries, max of ${numQueries}`),
|
||||
})
|
||||
const jsonSchema = JSON.stringify(zodToJsonSchema(schema))
|
||||
let lp = languagePrompt(language)
|
||||
|
||||
if (searchLanguage !== language) {
|
||||
lp += `Use ${searchLanguage} for the SERP queries.`
|
||||
if (searchLanguage && searchLanguage !== language) {
|
||||
lp += ` Use ${searchLanguage} for the SERP queries.`
|
||||
}
|
||||
const prompt = [
|
||||
`Given the following prompt from the user, generate a list of SERP queries to research the topic. Return a maximum of ${numQueries} queries, but feel free to return less if the original prompt is clear. Make sure each query is unique and not similar to each other: <prompt>${query}</prompt>\n\n`,
|
||||
@ -443,6 +445,7 @@ export async function deepResearch({
|
||||
currentDepth: nextDepth,
|
||||
nodeId: childNodeId(nodeId, i),
|
||||
languageCode,
|
||||
searchLanguage,
|
||||
})
|
||||
return r
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user