mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-11 18:08:59 +08:00
Nick: let user format the analysis
This commit is contained in:
parent
7e7b7e10fe
commit
010c8750d4
@ -10,6 +10,7 @@ export const deepResearchRequestSchema = z.object({
|
||||
maxDepth: z.number().min(1).max(12).default(7).describe('Maximum depth of research iterations'),
|
||||
maxUrls: z.number().min(1).max(1000).default(20).describe('Maximum number of URLs to analyze'),
|
||||
timeLimit: z.number().min(30).max(600).default(300).describe('Time limit in seconds'),
|
||||
analysisPrompt: z.string().describe('The prompt to use for the final analysis').optional(),
|
||||
// @deprecated Use query instead
|
||||
topic: z.string().describe('The topic or question to research').optional(),
|
||||
}).refine(data => data.query || data.topic, {
|
||||
|
@ -14,6 +14,7 @@ interface DeepResearchServiceOptions {
|
||||
maxDepth: number;
|
||||
maxUrls: number;
|
||||
timeLimit: number;
|
||||
analysisPrompt: string;
|
||||
subId?: string;
|
||||
}
|
||||
|
||||
@ -262,6 +263,7 @@ export async function performDeepResearch(options: DeepResearchServiceOptions) {
|
||||
options.query,
|
||||
state.getFindings(),
|
||||
state.getSummaries(),
|
||||
options.analysisPrompt,
|
||||
);
|
||||
|
||||
await state.addActivity({
|
||||
|
@ -253,6 +253,7 @@ export class ResearchLLMService {
|
||||
topic: string,
|
||||
findings: DeepResearchFinding[],
|
||||
summaries: string[],
|
||||
analysisPrompt: string,
|
||||
): Promise<string> {
|
||||
const { extract } = await generateCompletions({
|
||||
logger: this.logger.child({
|
||||
@ -265,7 +266,9 @@ export class ResearchLLMService {
|
||||
"You are an expert research analyst who creates comprehensive, well-structured reports. Your reports are detailed, properly formatted in Markdown, and include clear sections with citations. Today's date is " +
|
||||
new Date().toISOString().split("T")[0],
|
||||
prompt: trimToTokenLimit(
|
||||
`Create a comprehensive research report on "${topic}" based on the collected findings and analysis.
|
||||
analysisPrompt
|
||||
? `${analysisPrompt}\n\nResearch data:\n${findings.map((f) => `[From ${f.source}]: ${f.text}`).join("\n")}`
|
||||
: `Create a comprehensive research report on "${topic}" based on the collected findings and analysis.
|
||||
|
||||
Research data:
|
||||
${findings.map((f) => `[From ${f.source}]: ${f.text}`).join("\n")}
|
||||
|
@ -412,6 +412,7 @@ const processDeepResearchJobInternal = async (
|
||||
timeLimit: job.data.request.timeLimit,
|
||||
subId: job.data.subId,
|
||||
maxUrls: job.data.request.maxUrls,
|
||||
analysisPrompt: job.data.request.analysisPrompt,
|
||||
});
|
||||
|
||||
if(result.success) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user