chore: improve prompts
This commit is contained in:
@ -112,7 +112,7 @@ export function generateSearchQueries({
|
|||||||
lp += ` Use ${searchLanguage} for the SERP queries.`
|
lp += ` Use ${searchLanguage} for the SERP queries.`
|
||||||
}
|
}
|
||||||
const prompt = [
|
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`,
|
`Given the following prompt from the user, generate a list of highly effective Google search 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 creative, unique and not similar to each other: <prompt>${query}</prompt>`,
|
||||||
learnings
|
learnings
|
||||||
? `Here are some learnings from previous research, use them to generate more specific queries: ${learnings.join(
|
? `Here are some learnings from previous research, use them to generate more specific queries: ${learnings.join(
|
||||||
'\n',
|
'\n',
|
||||||
@ -182,7 +182,7 @@ function processSearchResult({
|
|||||||
const jsonSchema = JSON.stringify(zodToJsonSchema(schema))
|
const jsonSchema = JSON.stringify(zodToJsonSchema(schema))
|
||||||
const contents = results.map((item) => trimPrompt(item.content))
|
const contents = results.map((item) => trimPrompt(item.content))
|
||||||
const prompt = [
|
const prompt = [
|
||||||
`Given the following contents from a SERP search for the query <query>${query}</query>, extract key learnings from the contents. For each learning, include the source URL. Return a maximum of ${numLearnings} learnings, but feel free to return less if the contents are clear. Make sure each learning is unique and not similar to each other. The learnings should be as detailed and information dense as possible. Include any entities like people, places, companies, products, things, etc in the learnings, as well as any exact metrics, numbers, or dates. Also generate up to ${numFollowUpQuestions} follow-up questions that could help explore this topic further.`,
|
`Given the following contents from a SERP search for the query <query>${query}</query>, extract ${numLearnings} key learnings from the contents. Make sure each learning is unique and not similar to each other. The learnings should be as detailed and information dense as possible. Include any entities like people, places, companies, products, things, etc in the learnings, as well as any exact metrics, numbers, or dates. Also generate up to ${numFollowUpQuestions} follow-up questions that could help explore this topic further.`,
|
||||||
`<contents>${contents
|
`<contents>${contents
|
||||||
.map(
|
.map(
|
||||||
(content, index) =>
|
(content, index) =>
|
||||||
@ -211,8 +211,10 @@ export function writeFinalReport({
|
|||||||
const learningsString = trimPrompt(
|
const learningsString = trimPrompt(
|
||||||
learnings
|
learnings
|
||||||
.map(
|
.map(
|
||||||
(learning) =>
|
(learning, index) =>
|
||||||
`<learning url="${learning.url}">\n${learning.learning}\n</learning>`,
|
`<learning index="${index + 1}">
|
||||||
|
${learning.learning}
|
||||||
|
</learning>`,
|
||||||
)
|
)
|
||||||
.join('\n'),
|
.join('\n'),
|
||||||
)
|
)
|
||||||
@ -221,7 +223,7 @@ export function writeFinalReport({
|
|||||||
`<prompt>${prompt}</prompt>`,
|
`<prompt>${prompt}</prompt>`,
|
||||||
`Here are all the learnings from previous research:`,
|
`Here are all the learnings from previous research:`,
|
||||||
`<learnings>\n${learningsString}\n</learnings>`,
|
`<learnings>\n${learningsString}\n</learnings>`,
|
||||||
`Write the report using Markdown. When citing information, use numbered citations with superscript numbers in square brackets (e.g., [1], [2], [3]). Each citation should correspond to the index of the source in your learnings list. DO NOT include the actual URLs in the report text - only use the citation numbers.`,
|
`Write the report using Markdown. Be factual, NEVER lie or make things up. Cite learnings from previous research when needed, using numbered citations like "[1]". Each citation should correspond to the index of the source in your learnings list. DO NOT include the actual URLs in the report text - only use the citation numbers.`,
|
||||||
languagePrompt(language),
|
languagePrompt(language),
|
||||||
`## Deep Research Report`,
|
`## Deep Research Report`,
|
||||||
].join('\n\n')
|
].join('\n\n')
|
||||||
|
@ -29,7 +29,8 @@ export function generateFeedback({
|
|||||||
})
|
})
|
||||||
const jsonSchema = JSON.stringify(zodToJsonSchema(schema))
|
const jsonSchema = JSON.stringify(zodToJsonSchema(schema))
|
||||||
const prompt = [
|
const prompt = [
|
||||||
`Given the following query from the user, ask ${numQuestions} follow up questions to clarify the research direction. Return a maximum of ${numQuestions} questions, but feel free to return less if the original query is clear: <query>${query}</query>`,
|
`Given the following query from the user, ask several follow up questions to clarify the research direction. Return a maximum of ${numQuestions} questions. Feel free to return less if the original query is clear, but always provide at least 1 question.`,
|
||||||
|
`<query>${query}</query>`,
|
||||||
`You MUST respond in JSON matching this JSON schema: ${jsonSchema}`,
|
`You MUST respond in JSON matching this JSON schema: ${jsonSchema}`,
|
||||||
languagePrompt(language),
|
languagePrompt(language),
|
||||||
].join('\n\n')
|
].join('\n\n')
|
||||||
|
Reference in New Issue
Block a user