firecrawl 1.20.1 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -922,10 +922,25 @@ var FirecrawlApp = class {
922
922
  */
923
923
  async asyncDeepResearch(query, params) {
924
924
  const headers = this.prepareHeaders();
925
+ let jsonData = { query, ...params };
926
+ if (jsonData?.jsonOptions?.schema) {
927
+ let schema = jsonData.jsonOptions.schema;
928
+ try {
929
+ schema = (0, import_zod_to_json_schema.zodToJsonSchema)(schema);
930
+ } catch (error) {
931
+ }
932
+ jsonData = {
933
+ ...jsonData,
934
+ jsonOptions: {
935
+ ...jsonData.jsonOptions,
936
+ schema
937
+ }
938
+ };
939
+ }
925
940
  try {
926
941
  const response = await this.postRequest(
927
942
  `${this.apiUrl}/v1/deep-research`,
928
- { query, ...params },
943
+ jsonData,
929
944
  headers
930
945
  );
931
946
  if (response.status === 200) {
package/dist/index.d.cts CHANGED
@@ -326,7 +326,7 @@ interface CrawlErrorsResponse {
326
326
  * Parameters for deep research operations.
327
327
  * Defines options for conducting deep research on a query.
328
328
  */
329
- interface DeepResearchParams {
329
+ interface DeepResearchParams<LLMSchema extends zt.ZodSchema = any> {
330
330
  /**
331
331
  * Maximum depth of research iterations (1-10)
332
332
  * @default 7
@@ -343,9 +343,25 @@ interface DeepResearchParams {
343
343
  */
344
344
  maxUrls?: number;
345
345
  /**
346
- * Experimental flag for streaming steps
346
+ * The prompt to use for the final analysis
347
347
  */
348
- __experimental_streamSteps?: boolean;
348
+ analysisPrompt?: string;
349
+ /**
350
+ * The system prompt to use for the research agent
351
+ */
352
+ systemPrompt?: string;
353
+ /**
354
+ * The formats to use for the final analysis
355
+ */
356
+ formats?: ("markdown" | "json")[];
357
+ /**
358
+ * The JSON options to use for the final analysis
359
+ */
360
+ jsonOptions?: {
361
+ prompt?: string;
362
+ schema?: LLMSchema;
363
+ systemPrompt?: string;
364
+ };
349
365
  }
350
366
  /**
351
367
  * Response interface for deep research operations.
@@ -614,7 +630,7 @@ declare class FirecrawlApp {
614
630
  * @param onSource - Optional callback to receive source updates in real-time.
615
631
  * @returns The final research results.
616
632
  */
617
- deepResearch(query: string, params: DeepResearchParams, onActivity?: (activity: {
633
+ deepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>, onActivity?: (activity: {
618
634
  type: string;
619
635
  status: string;
620
636
  message: string;
@@ -631,7 +647,7 @@ declare class FirecrawlApp {
631
647
  * @param params - Parameters for the deep research operation.
632
648
  * @returns The response containing the research job ID.
633
649
  */
634
- asyncDeepResearch(query: string, params: DeepResearchParams): Promise<DeepResearchResponse | ErrorResponse>;
650
+ asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse>;
635
651
  /**
636
652
  * Checks the status of a deep research operation.
637
653
  * @param id - The ID of the deep research operation.
package/dist/index.d.ts CHANGED
@@ -326,7 +326,7 @@ interface CrawlErrorsResponse {
326
326
  * Parameters for deep research operations.
327
327
  * Defines options for conducting deep research on a query.
328
328
  */
329
- interface DeepResearchParams {
329
+ interface DeepResearchParams<LLMSchema extends zt.ZodSchema = any> {
330
330
  /**
331
331
  * Maximum depth of research iterations (1-10)
332
332
  * @default 7
@@ -343,9 +343,25 @@ interface DeepResearchParams {
343
343
  */
344
344
  maxUrls?: number;
345
345
  /**
346
- * Experimental flag for streaming steps
346
+ * The prompt to use for the final analysis
347
347
  */
348
- __experimental_streamSteps?: boolean;
348
+ analysisPrompt?: string;
349
+ /**
350
+ * The system prompt to use for the research agent
351
+ */
352
+ systemPrompt?: string;
353
+ /**
354
+ * The formats to use for the final analysis
355
+ */
356
+ formats?: ("markdown" | "json")[];
357
+ /**
358
+ * The JSON options to use for the final analysis
359
+ */
360
+ jsonOptions?: {
361
+ prompt?: string;
362
+ schema?: LLMSchema;
363
+ systemPrompt?: string;
364
+ };
349
365
  }
350
366
  /**
351
367
  * Response interface for deep research operations.
@@ -614,7 +630,7 @@ declare class FirecrawlApp {
614
630
  * @param onSource - Optional callback to receive source updates in real-time.
615
631
  * @returns The final research results.
616
632
  */
617
- deepResearch(query: string, params: DeepResearchParams, onActivity?: (activity: {
633
+ deepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>, onActivity?: (activity: {
618
634
  type: string;
619
635
  status: string;
620
636
  message: string;
@@ -631,7 +647,7 @@ declare class FirecrawlApp {
631
647
  * @param params - Parameters for the deep research operation.
632
648
  * @returns The response containing the research job ID.
633
649
  */
634
- asyncDeepResearch(query: string, params: DeepResearchParams): Promise<DeepResearchResponse | ErrorResponse>;
650
+ asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse>;
635
651
  /**
636
652
  * Checks the status of a deep research operation.
637
653
  * @param id - The ID of the deep research operation.
package/dist/index.js CHANGED
@@ -886,10 +886,25 @@ var FirecrawlApp = class {
886
886
  */
887
887
  async asyncDeepResearch(query, params) {
888
888
  const headers = this.prepareHeaders();
889
+ let jsonData = { query, ...params };
890
+ if (jsonData?.jsonOptions?.schema) {
891
+ let schema = jsonData.jsonOptions.schema;
892
+ try {
893
+ schema = zodToJsonSchema(schema);
894
+ } catch (error) {
895
+ }
896
+ jsonData = {
897
+ ...jsonData,
898
+ jsonOptions: {
899
+ ...jsonData.jsonOptions,
900
+ schema
901
+ }
902
+ };
903
+ }
889
904
  try {
890
905
  const response = await this.postRequest(
891
906
  `${this.apiUrl}/v1/deep-research`,
892
- { query, ...params },
907
+ jsonData,
893
908
  headers
894
909
  );
895
910
  if (response.status === 200) {
package/dump.rdb ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -356,7 +356,7 @@ export interface CrawlErrorsResponse {
356
356
  * Parameters for deep research operations.
357
357
  * Defines options for conducting deep research on a query.
358
358
  */
359
- export interface DeepResearchParams {
359
+ export interface DeepResearchParams<LLMSchema extends zt.ZodSchema = any> {
360
360
  /**
361
361
  * Maximum depth of research iterations (1-10)
362
362
  * @default 7
@@ -373,9 +373,29 @@ export interface DeepResearchParams {
373
373
  */
374
374
  maxUrls?: number;
375
375
  /**
376
+ * The prompt to use for the final analysis
377
+ */
378
+ analysisPrompt?: string;
379
+ /**
380
+ * The system prompt to use for the research agent
381
+ */
382
+ systemPrompt?: string;
383
+ /**
384
+ * The formats to use for the final analysis
385
+ */
386
+ formats?: ("markdown" | "json")[];
387
+ /**
388
+ * The JSON options to use for the final analysis
389
+ */
390
+ jsonOptions?:{
391
+ prompt?: string;
392
+ schema?: LLMSchema;
393
+ systemPrompt?: string;
394
+ };
395
+ /**
376
396
  * Experimental flag for streaming steps
377
397
  */
378
- __experimental_streamSteps?: boolean;
398
+ // __experimental_streamSteps?: boolean;
379
399
  }
380
400
 
381
401
  /**
@@ -1416,7 +1436,7 @@ export default class FirecrawlApp {
1416
1436
  */
1417
1437
  async deepResearch(
1418
1438
  query: string,
1419
- params: DeepResearchParams,
1439
+ params: DeepResearchParams<zt.ZodSchema>,
1420
1440
  onActivity?: (activity: {
1421
1441
  type: string;
1422
1442
  status: string;
@@ -1501,12 +1521,31 @@ export default class FirecrawlApp {
1501
1521
  * @param params - Parameters for the deep research operation.
1502
1522
  * @returns The response containing the research job ID.
1503
1523
  */
1504
- async asyncDeepResearch(query: string, params: DeepResearchParams): Promise<DeepResearchResponse | ErrorResponse> {
1524
+ async asyncDeepResearch(query: string, params: DeepResearchParams<zt.ZodSchema>): Promise<DeepResearchResponse | ErrorResponse> {
1505
1525
  const headers = this.prepareHeaders();
1526
+ let jsonData: any = { query, ...params };
1527
+
1528
+ if (jsonData?.jsonOptions?.schema) {
1529
+ let schema = jsonData.jsonOptions.schema;
1530
+ // Try parsing the schema as a Zod schema
1531
+ try {
1532
+ schema = zodToJsonSchema(schema);
1533
+ } catch (error) {
1534
+
1535
+ }
1536
+ jsonData = {
1537
+ ...jsonData,
1538
+ jsonOptions: {
1539
+ ...jsonData.jsonOptions,
1540
+ schema: schema,
1541
+ },
1542
+ };
1543
+ }
1544
+
1506
1545
  try {
1507
1546
  const response: AxiosResponse = await this.postRequest(
1508
1547
  `${this.apiUrl}/v1/deep-research`,
1509
- { query, ...params },
1548
+ jsonData,
1510
1549
  headers
1511
1550
  );
1512
1551