firecrawl 4.26.0 → 4.28.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/{chunk-P63N5KWQ.js → chunk-WZCSDWB2.js} +1 -1
- package/dist/index.cjs +59 -3
- package/dist/index.d.cts +77 -13
- package/dist/index.d.ts +77 -13
- package/dist/index.js +60 -4
- package/dist/{package-VYUXJRD4.js → package-ASYTUOW4.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/research.test.ts +8 -8
- package/src/__tests__/unit/v2/scrape-browser.unit.test.ts +2 -0
- package/src/v2/client.ts +23 -1
- package/src/v2/methods/feedback.ts +59 -0
- package/src/v2/methods/map.ts +2 -1
- package/src/v2/methods/research.ts +1 -1
- package/src/v2/types.ts +69 -12
|
@@ -12,7 +12,7 @@ var require_package = __commonJS({
|
|
|
12
12
|
"package.json"(exports, module) {
|
|
13
13
|
module.exports = {
|
|
14
14
|
name: "@mendable/firecrawl-js",
|
|
15
|
-
version: "4.
|
|
15
|
+
version: "4.28.0",
|
|
16
16
|
description: "JavaScript SDK for Firecrawl API",
|
|
17
17
|
main: "dist/index.js",
|
|
18
18
|
types: "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports2, module2) {
|
|
40
40
|
module2.exports = {
|
|
41
41
|
name: "@mendable/firecrawl-js",
|
|
42
|
-
version: "4.
|
|
42
|
+
version: "4.28.0",
|
|
43
43
|
description: "JavaScript SDK for Firecrawl API",
|
|
44
44
|
main: "dist/index.js",
|
|
45
45
|
types: "dist/index.d.ts",
|
|
@@ -820,13 +820,52 @@ async function map(http, url, options) {
|
|
|
820
820
|
description: item.description
|
|
821
821
|
});
|
|
822
822
|
}
|
|
823
|
-
return { links };
|
|
823
|
+
return { id: res.data.id, links };
|
|
824
824
|
} catch (err) {
|
|
825
825
|
if (err?.isAxiosError) return normalizeAxiosError(err, "map");
|
|
826
826
|
throw err;
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
+
// src/v2/methods/feedback.ts
|
|
831
|
+
function validateRating(rating) {
|
|
832
|
+
if (!["good", "partial", "bad"].includes(rating)) {
|
|
833
|
+
throw new Error("rating must be one of: good, partial, bad");
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
async function feedback(http, request) {
|
|
837
|
+
if (!request.endpoint) throw new Error("endpoint is required");
|
|
838
|
+
if (!request.jobId) throw new Error("jobId is required");
|
|
839
|
+
validateRating(request.rating);
|
|
840
|
+
try {
|
|
841
|
+
const res = await http.post("/v2/feedback", request);
|
|
842
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
843
|
+
throwForBadResponse(res, "feedback");
|
|
844
|
+
}
|
|
845
|
+
return res.data;
|
|
846
|
+
} catch (err) {
|
|
847
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "feedback");
|
|
848
|
+
throw err;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
async function searchFeedback(http, jobId, request) {
|
|
852
|
+
if (!jobId) throw new Error("jobId is required");
|
|
853
|
+
validateRating(request.rating);
|
|
854
|
+
try {
|
|
855
|
+
const res = await http.post(
|
|
856
|
+
`/v2/search/${encodeURIComponent(jobId)}/feedback`,
|
|
857
|
+
request
|
|
858
|
+
);
|
|
859
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
860
|
+
throwForBadResponse(res, "searchFeedback");
|
|
861
|
+
}
|
|
862
|
+
return res.data;
|
|
863
|
+
} catch (err) {
|
|
864
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "searchFeedback");
|
|
865
|
+
throw err;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
830
869
|
// src/v2/utils/pagination.ts
|
|
831
870
|
async function fetchAllPages(http, nextUrl, initial, pagination) {
|
|
832
871
|
const docs = initial.slice();
|
|
@@ -1437,7 +1476,7 @@ async function getTokenUsageHistorical(http, byApiKey) {
|
|
|
1437
1476
|
}
|
|
1438
1477
|
|
|
1439
1478
|
// src/v2/methods/research.ts
|
|
1440
|
-
var BASE = "/v2/research";
|
|
1479
|
+
var BASE = "/v2/search/research";
|
|
1441
1480
|
function appendParam(params, key, value) {
|
|
1442
1481
|
if (value == null) return;
|
|
1443
1482
|
if (Array.isArray(value)) {
|
|
@@ -2008,6 +2047,23 @@ var FirecrawlClient = class {
|
|
|
2008
2047
|
async search(query, req = {}) {
|
|
2009
2048
|
return search(this.http, { query, ...req });
|
|
2010
2049
|
}
|
|
2050
|
+
/**
|
|
2051
|
+
* Submit feedback for a v2 job.
|
|
2052
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
2053
|
+
* @returns Feedback record and refund details.
|
|
2054
|
+
*/
|
|
2055
|
+
async feedback(request) {
|
|
2056
|
+
return feedback(this.http, request);
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Submit feedback for a search job.
|
|
2060
|
+
* @param jobId Search job id returned by search.
|
|
2061
|
+
* @param request Search feedback payload.
|
|
2062
|
+
* @returns Feedback record and refund details.
|
|
2063
|
+
*/
|
|
2064
|
+
async searchFeedback(jobId, request) {
|
|
2065
|
+
return searchFeedback(this.http, jobId, request);
|
|
2066
|
+
}
|
|
2011
2067
|
// Research
|
|
2012
2068
|
/**
|
|
2013
2069
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
package/dist/index.d.cts
CHANGED
|
@@ -505,6 +505,7 @@ interface BatchScrapeJob {
|
|
|
505
505
|
data: Document[];
|
|
506
506
|
}
|
|
507
507
|
interface MapData {
|
|
508
|
+
id?: string;
|
|
508
509
|
links: SearchResultWeb[];
|
|
509
510
|
}
|
|
510
511
|
interface MapOptions {
|
|
@@ -518,6 +519,45 @@ interface MapOptions {
|
|
|
518
519
|
origin?: string;
|
|
519
520
|
location?: LocationConfig$1;
|
|
520
521
|
}
|
|
522
|
+
type FeedbackRating = "good" | "partial" | "bad";
|
|
523
|
+
type EndpointFeedbackEndpoint = "search" | "scrape" | "parse" | "map";
|
|
524
|
+
interface FeedbackValuableSource {
|
|
525
|
+
url: string;
|
|
526
|
+
reason?: string;
|
|
527
|
+
}
|
|
528
|
+
interface FeedbackMissingContent {
|
|
529
|
+
topic: string;
|
|
530
|
+
description?: string;
|
|
531
|
+
}
|
|
532
|
+
interface SearchFeedbackRequest {
|
|
533
|
+
rating: FeedbackRating;
|
|
534
|
+
valuableSources?: FeedbackValuableSource[];
|
|
535
|
+
missingContent?: FeedbackMissingContent[];
|
|
536
|
+
querySuggestions?: string;
|
|
537
|
+
integration?: string | null;
|
|
538
|
+
origin?: string;
|
|
539
|
+
}
|
|
540
|
+
interface EndpointFeedbackRequest extends SearchFeedbackRequest {
|
|
541
|
+
endpoint: EndpointFeedbackEndpoint;
|
|
542
|
+
jobId: string;
|
|
543
|
+
issues?: string[];
|
|
544
|
+
tags?: string[];
|
|
545
|
+
note?: string;
|
|
546
|
+
url?: string;
|
|
547
|
+
pageNumbers?: number[];
|
|
548
|
+
/** Small endpoint-specific metadata object. Must be 8KB or smaller. */
|
|
549
|
+
metadata?: Record<string, unknown>;
|
|
550
|
+
}
|
|
551
|
+
interface FeedbackResponse {
|
|
552
|
+
success: true;
|
|
553
|
+
feedbackId: string;
|
|
554
|
+
creditsRefunded: number;
|
|
555
|
+
alreadySubmitted?: boolean;
|
|
556
|
+
dailyCapReached?: boolean;
|
|
557
|
+
creditsRefundedToday?: number;
|
|
558
|
+
dailyRefundCap?: number;
|
|
559
|
+
warning?: string;
|
|
560
|
+
}
|
|
521
561
|
/**
|
|
522
562
|
* Schedule for a monitor.
|
|
523
563
|
*
|
|
@@ -849,6 +889,7 @@ interface BrowserCreateResponse {
|
|
|
849
889
|
}
|
|
850
890
|
interface BrowserExecuteResponse {
|
|
851
891
|
success: boolean;
|
|
892
|
+
cdpUrl?: string;
|
|
852
893
|
liveViewUrl?: string;
|
|
853
894
|
interactiveLiveViewUrl?: string;
|
|
854
895
|
output?: string;
|
|
@@ -900,15 +941,17 @@ interface PaperSignals {
|
|
|
900
941
|
structural: number;
|
|
901
942
|
/** Semantic score from the intent abstract search (0 if absent). */
|
|
902
943
|
semantic: number;
|
|
903
|
-
/** Citation-graph
|
|
904
|
-
|
|
944
|
+
/** Citation-graph article-rank score of the candidate. */
|
|
945
|
+
articleRank: number;
|
|
905
946
|
/** Number of distinct seeds connected to this candidate. */
|
|
906
|
-
|
|
947
|
+
seedOverlap: number;
|
|
907
948
|
}
|
|
908
|
-
/** A ranked paper. `
|
|
949
|
+
/** A ranked paper. `paperId` is canonical; arXiv lives in `ids`. */
|
|
909
950
|
interface PaperResult {
|
|
910
951
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
911
|
-
|
|
952
|
+
paperId: string;
|
|
953
|
+
/** Preferred cite/fetch identifier such as `arxiv:<id>`, `pmid:<id>`, or `doi:<id>`. */
|
|
954
|
+
primaryId: string;
|
|
912
955
|
ids?: IdMap;
|
|
913
956
|
title: string;
|
|
914
957
|
abstract: string;
|
|
@@ -918,7 +961,7 @@ interface PaperResult {
|
|
|
918
961
|
signals?: PaperSignals;
|
|
919
962
|
}
|
|
920
963
|
interface PaperMetadata {
|
|
921
|
-
|
|
964
|
+
paperId: string;
|
|
922
965
|
ids?: IdMap;
|
|
923
966
|
title: string;
|
|
924
967
|
abstract: string;
|
|
@@ -927,9 +970,9 @@ interface PaperMetadata {
|
|
|
927
970
|
/** arXiv categories. Omitted if unknown. */
|
|
928
971
|
categories?: string[];
|
|
929
972
|
/** Original creation date string (format varies). Omitted if unknown. */
|
|
930
|
-
|
|
973
|
+
createdDate?: string;
|
|
931
974
|
/** Last-updated date string. Omitted if unknown. */
|
|
932
|
-
|
|
975
|
+
updateDate?: string;
|
|
933
976
|
}
|
|
934
977
|
interface Passage {
|
|
935
978
|
/** In-body passage text (may be markdown, including tables). */
|
|
@@ -938,25 +981,29 @@ interface Passage {
|
|
|
938
981
|
score: number;
|
|
939
982
|
}
|
|
940
983
|
interface SearchPapersResponse {
|
|
984
|
+
success: boolean;
|
|
941
985
|
results: PaperResult[];
|
|
942
986
|
}
|
|
943
987
|
interface PaperMetadataResponse {
|
|
988
|
+
success: boolean;
|
|
944
989
|
paper: PaperMetadata;
|
|
945
990
|
}
|
|
946
991
|
interface ReadPaperResponse {
|
|
992
|
+
success: boolean;
|
|
947
993
|
paper: PaperMetadata;
|
|
948
994
|
/** Resolved canonical paper id (empty string if not found via id-key). */
|
|
949
|
-
|
|
995
|
+
paperId: string;
|
|
950
996
|
/** Echo of the read query. */
|
|
951
997
|
query: string;
|
|
952
998
|
/** Top matching in-body passages. */
|
|
953
999
|
passages: Passage[];
|
|
954
1000
|
}
|
|
955
1001
|
interface SimilarPapersResponse {
|
|
1002
|
+
success: boolean;
|
|
956
1003
|
/** Ranked related papers; each carries `signals`. */
|
|
957
1004
|
results: PaperResult[];
|
|
958
1005
|
/** Number of resolved candidates considered before truncation to `k`. */
|
|
959
|
-
|
|
1006
|
+
poolSize: number;
|
|
960
1007
|
/** True if more resolved candidates existed than were returned. */
|
|
961
1008
|
truncated: boolean;
|
|
962
1009
|
/** Human-readable note when no results are produced. */
|
|
@@ -968,10 +1015,11 @@ interface GitHubScoreBreakdown {
|
|
|
968
1015
|
semantic?: number;
|
|
969
1016
|
lexical?: number;
|
|
970
1017
|
fusion?: number;
|
|
1018
|
+
rerank?: number;
|
|
971
1019
|
}
|
|
972
1020
|
interface GitHubSearchItem {
|
|
973
|
-
resultType: "github_history" | "repo_readme";
|
|
974
|
-
/** `owner/name
|
|
1021
|
+
resultType: "github_history" | "repo_readme" | "web";
|
|
1022
|
+
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
975
1023
|
repo: string;
|
|
976
1024
|
url: string;
|
|
977
1025
|
/** History page type (e.g. `issue`, `pull`). Omitted for readmes. */
|
|
@@ -982,6 +1030,8 @@ interface GitHubSearchItem {
|
|
|
982
1030
|
segmentCount?: number;
|
|
983
1031
|
/** Readme URL (readme results). Omitted otherwise. */
|
|
984
1032
|
readmeUrl?: string;
|
|
1033
|
+
/** SERP page title. Only set on web results. */
|
|
1034
|
+
title?: string;
|
|
985
1035
|
/** Short matched excerpt. */
|
|
986
1036
|
snippet: string;
|
|
987
1037
|
/** Full matched content in markdown. Omitted unless available. */
|
|
@@ -989,6 +1039,7 @@ interface GitHubSearchItem {
|
|
|
989
1039
|
scores: GitHubScoreBreakdown;
|
|
990
1040
|
}
|
|
991
1041
|
interface GitHubSearchResponse {
|
|
1042
|
+
success: boolean;
|
|
992
1043
|
results: GitHubSearchItem[];
|
|
993
1044
|
}
|
|
994
1045
|
/** Options for `research.searchPapers`. */
|
|
@@ -1271,6 +1322,19 @@ declare class FirecrawlClient {
|
|
|
1271
1322
|
* @returns Structured search results.
|
|
1272
1323
|
*/
|
|
1273
1324
|
search(query: string, req?: Omit<SearchRequest, "query">): Promise<SearchData>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Submit feedback for a v2 job.
|
|
1327
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
1328
|
+
* @returns Feedback record and refund details.
|
|
1329
|
+
*/
|
|
1330
|
+
feedback(request: EndpointFeedbackRequest): Promise<FeedbackResponse>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Submit feedback for a search job.
|
|
1333
|
+
* @param jobId Search job id returned by search.
|
|
1334
|
+
* @param request Search feedback payload.
|
|
1335
|
+
* @returns Feedback record and refund details.
|
|
1336
|
+
*/
|
|
1337
|
+
searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse>;
|
|
1274
1338
|
/**
|
|
1275
1339
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
|
1276
1340
|
* Example: `firecrawl.research.searchPapers("diffusion models")`.
|
|
@@ -2439,4 +2503,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2439
2503
|
get v1(): FirecrawlApp;
|
|
2440
2504
|
}
|
|
2441
2505
|
|
|
2442
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2506
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -505,6 +505,7 @@ interface BatchScrapeJob {
|
|
|
505
505
|
data: Document[];
|
|
506
506
|
}
|
|
507
507
|
interface MapData {
|
|
508
|
+
id?: string;
|
|
508
509
|
links: SearchResultWeb[];
|
|
509
510
|
}
|
|
510
511
|
interface MapOptions {
|
|
@@ -518,6 +519,45 @@ interface MapOptions {
|
|
|
518
519
|
origin?: string;
|
|
519
520
|
location?: LocationConfig$1;
|
|
520
521
|
}
|
|
522
|
+
type FeedbackRating = "good" | "partial" | "bad";
|
|
523
|
+
type EndpointFeedbackEndpoint = "search" | "scrape" | "parse" | "map";
|
|
524
|
+
interface FeedbackValuableSource {
|
|
525
|
+
url: string;
|
|
526
|
+
reason?: string;
|
|
527
|
+
}
|
|
528
|
+
interface FeedbackMissingContent {
|
|
529
|
+
topic: string;
|
|
530
|
+
description?: string;
|
|
531
|
+
}
|
|
532
|
+
interface SearchFeedbackRequest {
|
|
533
|
+
rating: FeedbackRating;
|
|
534
|
+
valuableSources?: FeedbackValuableSource[];
|
|
535
|
+
missingContent?: FeedbackMissingContent[];
|
|
536
|
+
querySuggestions?: string;
|
|
537
|
+
integration?: string | null;
|
|
538
|
+
origin?: string;
|
|
539
|
+
}
|
|
540
|
+
interface EndpointFeedbackRequest extends SearchFeedbackRequest {
|
|
541
|
+
endpoint: EndpointFeedbackEndpoint;
|
|
542
|
+
jobId: string;
|
|
543
|
+
issues?: string[];
|
|
544
|
+
tags?: string[];
|
|
545
|
+
note?: string;
|
|
546
|
+
url?: string;
|
|
547
|
+
pageNumbers?: number[];
|
|
548
|
+
/** Small endpoint-specific metadata object. Must be 8KB or smaller. */
|
|
549
|
+
metadata?: Record<string, unknown>;
|
|
550
|
+
}
|
|
551
|
+
interface FeedbackResponse {
|
|
552
|
+
success: true;
|
|
553
|
+
feedbackId: string;
|
|
554
|
+
creditsRefunded: number;
|
|
555
|
+
alreadySubmitted?: boolean;
|
|
556
|
+
dailyCapReached?: boolean;
|
|
557
|
+
creditsRefundedToday?: number;
|
|
558
|
+
dailyRefundCap?: number;
|
|
559
|
+
warning?: string;
|
|
560
|
+
}
|
|
521
561
|
/**
|
|
522
562
|
* Schedule for a monitor.
|
|
523
563
|
*
|
|
@@ -849,6 +889,7 @@ interface BrowserCreateResponse {
|
|
|
849
889
|
}
|
|
850
890
|
interface BrowserExecuteResponse {
|
|
851
891
|
success: boolean;
|
|
892
|
+
cdpUrl?: string;
|
|
852
893
|
liveViewUrl?: string;
|
|
853
894
|
interactiveLiveViewUrl?: string;
|
|
854
895
|
output?: string;
|
|
@@ -900,15 +941,17 @@ interface PaperSignals {
|
|
|
900
941
|
structural: number;
|
|
901
942
|
/** Semantic score from the intent abstract search (0 if absent). */
|
|
902
943
|
semantic: number;
|
|
903
|
-
/** Citation-graph
|
|
904
|
-
|
|
944
|
+
/** Citation-graph article-rank score of the candidate. */
|
|
945
|
+
articleRank: number;
|
|
905
946
|
/** Number of distinct seeds connected to this candidate. */
|
|
906
|
-
|
|
947
|
+
seedOverlap: number;
|
|
907
948
|
}
|
|
908
|
-
/** A ranked paper. `
|
|
949
|
+
/** A ranked paper. `paperId` is canonical; arXiv lives in `ids`. */
|
|
909
950
|
interface PaperResult {
|
|
910
951
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
911
|
-
|
|
952
|
+
paperId: string;
|
|
953
|
+
/** Preferred cite/fetch identifier such as `arxiv:<id>`, `pmid:<id>`, or `doi:<id>`. */
|
|
954
|
+
primaryId: string;
|
|
912
955
|
ids?: IdMap;
|
|
913
956
|
title: string;
|
|
914
957
|
abstract: string;
|
|
@@ -918,7 +961,7 @@ interface PaperResult {
|
|
|
918
961
|
signals?: PaperSignals;
|
|
919
962
|
}
|
|
920
963
|
interface PaperMetadata {
|
|
921
|
-
|
|
964
|
+
paperId: string;
|
|
922
965
|
ids?: IdMap;
|
|
923
966
|
title: string;
|
|
924
967
|
abstract: string;
|
|
@@ -927,9 +970,9 @@ interface PaperMetadata {
|
|
|
927
970
|
/** arXiv categories. Omitted if unknown. */
|
|
928
971
|
categories?: string[];
|
|
929
972
|
/** Original creation date string (format varies). Omitted if unknown. */
|
|
930
|
-
|
|
973
|
+
createdDate?: string;
|
|
931
974
|
/** Last-updated date string. Omitted if unknown. */
|
|
932
|
-
|
|
975
|
+
updateDate?: string;
|
|
933
976
|
}
|
|
934
977
|
interface Passage {
|
|
935
978
|
/** In-body passage text (may be markdown, including tables). */
|
|
@@ -938,25 +981,29 @@ interface Passage {
|
|
|
938
981
|
score: number;
|
|
939
982
|
}
|
|
940
983
|
interface SearchPapersResponse {
|
|
984
|
+
success: boolean;
|
|
941
985
|
results: PaperResult[];
|
|
942
986
|
}
|
|
943
987
|
interface PaperMetadataResponse {
|
|
988
|
+
success: boolean;
|
|
944
989
|
paper: PaperMetadata;
|
|
945
990
|
}
|
|
946
991
|
interface ReadPaperResponse {
|
|
992
|
+
success: boolean;
|
|
947
993
|
paper: PaperMetadata;
|
|
948
994
|
/** Resolved canonical paper id (empty string if not found via id-key). */
|
|
949
|
-
|
|
995
|
+
paperId: string;
|
|
950
996
|
/** Echo of the read query. */
|
|
951
997
|
query: string;
|
|
952
998
|
/** Top matching in-body passages. */
|
|
953
999
|
passages: Passage[];
|
|
954
1000
|
}
|
|
955
1001
|
interface SimilarPapersResponse {
|
|
1002
|
+
success: boolean;
|
|
956
1003
|
/** Ranked related papers; each carries `signals`. */
|
|
957
1004
|
results: PaperResult[];
|
|
958
1005
|
/** Number of resolved candidates considered before truncation to `k`. */
|
|
959
|
-
|
|
1006
|
+
poolSize: number;
|
|
960
1007
|
/** True if more resolved candidates existed than were returned. */
|
|
961
1008
|
truncated: boolean;
|
|
962
1009
|
/** Human-readable note when no results are produced. */
|
|
@@ -968,10 +1015,11 @@ interface GitHubScoreBreakdown {
|
|
|
968
1015
|
semantic?: number;
|
|
969
1016
|
lexical?: number;
|
|
970
1017
|
fusion?: number;
|
|
1018
|
+
rerank?: number;
|
|
971
1019
|
}
|
|
972
1020
|
interface GitHubSearchItem {
|
|
973
|
-
resultType: "github_history" | "repo_readme";
|
|
974
|
-
/** `owner/name
|
|
1021
|
+
resultType: "github_history" | "repo_readme" | "web";
|
|
1022
|
+
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
975
1023
|
repo: string;
|
|
976
1024
|
url: string;
|
|
977
1025
|
/** History page type (e.g. `issue`, `pull`). Omitted for readmes. */
|
|
@@ -982,6 +1030,8 @@ interface GitHubSearchItem {
|
|
|
982
1030
|
segmentCount?: number;
|
|
983
1031
|
/** Readme URL (readme results). Omitted otherwise. */
|
|
984
1032
|
readmeUrl?: string;
|
|
1033
|
+
/** SERP page title. Only set on web results. */
|
|
1034
|
+
title?: string;
|
|
985
1035
|
/** Short matched excerpt. */
|
|
986
1036
|
snippet: string;
|
|
987
1037
|
/** Full matched content in markdown. Omitted unless available. */
|
|
@@ -989,6 +1039,7 @@ interface GitHubSearchItem {
|
|
|
989
1039
|
scores: GitHubScoreBreakdown;
|
|
990
1040
|
}
|
|
991
1041
|
interface GitHubSearchResponse {
|
|
1042
|
+
success: boolean;
|
|
992
1043
|
results: GitHubSearchItem[];
|
|
993
1044
|
}
|
|
994
1045
|
/** Options for `research.searchPapers`. */
|
|
@@ -1271,6 +1322,19 @@ declare class FirecrawlClient {
|
|
|
1271
1322
|
* @returns Structured search results.
|
|
1272
1323
|
*/
|
|
1273
1324
|
search(query: string, req?: Omit<SearchRequest, "query">): Promise<SearchData>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Submit feedback for a v2 job.
|
|
1327
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
1328
|
+
* @returns Feedback record and refund details.
|
|
1329
|
+
*/
|
|
1330
|
+
feedback(request: EndpointFeedbackRequest): Promise<FeedbackResponse>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Submit feedback for a search job.
|
|
1333
|
+
* @param jobId Search job id returned by search.
|
|
1334
|
+
* @param request Search feedback payload.
|
|
1335
|
+
* @returns Feedback record and refund details.
|
|
1336
|
+
*/
|
|
1337
|
+
searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse>;
|
|
1274
1338
|
/**
|
|
1275
1339
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
|
1276
1340
|
* Example: `firecrawl.research.searchPapers("diffusion models")`.
|
|
@@ -2439,4 +2503,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2439
2503
|
get v1(): FirecrawlApp;
|
|
2440
2504
|
}
|
|
2441
2505
|
|
|
2442
|
-
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
|
2506
|
+
export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentStatusResponse, type AgentWebhookConfig, type AgentWebhookEvent, type AttributesFormat, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorSummary, type MonitorTarget, type MonitorWebhookConfig, type PDFAction, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PressAction, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WZCSDWB2.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -688,13 +688,52 @@ async function map(http, url, options) {
|
|
|
688
688
|
description: item.description
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
|
-
return { links };
|
|
691
|
+
return { id: res.data.id, links };
|
|
692
692
|
} catch (err) {
|
|
693
693
|
if (err?.isAxiosError) return normalizeAxiosError(err, "map");
|
|
694
694
|
throw err;
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
+
// src/v2/methods/feedback.ts
|
|
699
|
+
function validateRating(rating) {
|
|
700
|
+
if (!["good", "partial", "bad"].includes(rating)) {
|
|
701
|
+
throw new Error("rating must be one of: good, partial, bad");
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
async function feedback(http, request) {
|
|
705
|
+
if (!request.endpoint) throw new Error("endpoint is required");
|
|
706
|
+
if (!request.jobId) throw new Error("jobId is required");
|
|
707
|
+
validateRating(request.rating);
|
|
708
|
+
try {
|
|
709
|
+
const res = await http.post("/v2/feedback", request);
|
|
710
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
711
|
+
throwForBadResponse(res, "feedback");
|
|
712
|
+
}
|
|
713
|
+
return res.data;
|
|
714
|
+
} catch (err) {
|
|
715
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "feedback");
|
|
716
|
+
throw err;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
async function searchFeedback(http, jobId, request) {
|
|
720
|
+
if (!jobId) throw new Error("jobId is required");
|
|
721
|
+
validateRating(request.rating);
|
|
722
|
+
try {
|
|
723
|
+
const res = await http.post(
|
|
724
|
+
`/v2/search/${encodeURIComponent(jobId)}/feedback`,
|
|
725
|
+
request
|
|
726
|
+
);
|
|
727
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
728
|
+
throwForBadResponse(res, "searchFeedback");
|
|
729
|
+
}
|
|
730
|
+
return res.data;
|
|
731
|
+
} catch (err) {
|
|
732
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "searchFeedback");
|
|
733
|
+
throw err;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
698
737
|
// src/v2/utils/pagination.ts
|
|
699
738
|
async function fetchAllPages(http, nextUrl, initial, pagination) {
|
|
700
739
|
const docs = initial.slice();
|
|
@@ -1305,7 +1344,7 @@ async function getTokenUsageHistorical(http, byApiKey) {
|
|
|
1305
1344
|
}
|
|
1306
1345
|
|
|
1307
1346
|
// src/v2/methods/research.ts
|
|
1308
|
-
var BASE = "/v2/research";
|
|
1347
|
+
var BASE = "/v2/search/research";
|
|
1309
1348
|
function appendParam(params, key, value) {
|
|
1310
1349
|
if (value == null) return;
|
|
1311
1350
|
if (Array.isArray(value)) {
|
|
@@ -1876,6 +1915,23 @@ var FirecrawlClient = class {
|
|
|
1876
1915
|
async search(query, req = {}) {
|
|
1877
1916
|
return search(this.http, { query, ...req });
|
|
1878
1917
|
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Submit feedback for a v2 job.
|
|
1920
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
1921
|
+
* @returns Feedback record and refund details.
|
|
1922
|
+
*/
|
|
1923
|
+
async feedback(request) {
|
|
1924
|
+
return feedback(this.http, request);
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Submit feedback for a search job.
|
|
1928
|
+
* @param jobId Search job id returned by search.
|
|
1929
|
+
* @param request Search feedback payload.
|
|
1930
|
+
* @returns Feedback record and refund details.
|
|
1931
|
+
*/
|
|
1932
|
+
async searchFeedback(jobId, request) {
|
|
1933
|
+
return searchFeedback(this.http, jobId, request);
|
|
1934
|
+
}
|
|
1879
1935
|
// Research
|
|
1880
1936
|
/**
|
|
1881
1937
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
|
@@ -2244,7 +2300,7 @@ var FirecrawlApp = class {
|
|
|
2244
2300
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
2245
2301
|
return process.env.npm_package_version;
|
|
2246
2302
|
}
|
|
2247
|
-
const packageJson = await import("./package-
|
|
2303
|
+
const packageJson = await import("./package-ASYTUOW4.js");
|
|
2248
2304
|
return packageJson.default.version;
|
|
2249
2305
|
} catch (error) {
|
|
2250
2306
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ describe("research.searchPapers", () => {
|
|
|
39
39
|
to: "2024-12-31",
|
|
40
40
|
});
|
|
41
41
|
const url = calls[0];
|
|
42
|
-
expect(url.startsWith("/v2/research/papers?")).toBe(true);
|
|
42
|
+
expect(url.startsWith("/v2/search/research/papers?")).toBe(true);
|
|
43
43
|
const qs = new URLSearchParams(url.split("?")[1]);
|
|
44
44
|
expect(qs.get("query")).toBe("diffusion models");
|
|
45
45
|
expect(qs.get("k")).toBe("10");
|
|
@@ -67,7 +67,7 @@ describe("research.searchPapers", () => {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
test("returns the response body verbatim", async () => {
|
|
70
|
-
const payload = { results: [{
|
|
70
|
+
const payload = { results: [{ paperId: "1", title: "t", abstract: "a", score: 0.1 }] };
|
|
71
71
|
const { client } = makeClient(() => ({ status: 200, data: payload }));
|
|
72
72
|
await expect(client.searchPapers("q")).resolves.toEqual(payload);
|
|
73
73
|
});
|
|
@@ -77,17 +77,17 @@ describe("research.getPaper", () => {
|
|
|
77
77
|
test("detail mode encodes the id and sends no query params", async () => {
|
|
78
78
|
const { client, calls } = makeClient(() => ({ status: 200, data: { paper: {} } }));
|
|
79
79
|
await client.getPaper("arxiv:2105.05233");
|
|
80
|
-
expect(calls[0]).toBe("/v2/research/papers/arxiv%3A2105.05233");
|
|
80
|
+
expect(calls[0]).toBe("/v2/search/research/papers/arxiv%3A2105.05233");
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
test("read mode adds query and k", async () => {
|
|
84
84
|
const { client, calls } = makeClient(() => ({
|
|
85
85
|
status: 200,
|
|
86
|
-
data: { paper: {},
|
|
86
|
+
data: { paper: {}, paperId: "1", query: "q", passages: [] },
|
|
87
87
|
}));
|
|
88
88
|
await client.getPaper("123", { query: "noise schedule", k: 4 });
|
|
89
89
|
const [path, query] = calls[0].split("?");
|
|
90
|
-
expect(path).toBe("/v2/research/papers/123");
|
|
90
|
+
expect(path).toBe("/v2/search/research/papers/123");
|
|
91
91
|
const qs = new URLSearchParams(query);
|
|
92
92
|
expect(qs.get("query")).toBe("noise schedule");
|
|
93
93
|
expect(qs.get("k")).toBe("4");
|
|
@@ -112,7 +112,7 @@ describe("research.similarPapers", () => {
|
|
|
112
112
|
test("builds path and query with repeated anchors and rerank", async () => {
|
|
113
113
|
const { client, calls } = makeClient(() => ({
|
|
114
114
|
status: 200,
|
|
115
|
-
data: { results: [],
|
|
115
|
+
data: { results: [], poolSize: 0, truncated: false },
|
|
116
116
|
}));
|
|
117
117
|
await client.similarPapers("2105.05233", {
|
|
118
118
|
intent: "diffusion image synthesis",
|
|
@@ -122,7 +122,7 @@ describe("research.similarPapers", () => {
|
|
|
122
122
|
anchor: ["arxiv:2006.11239", "1503.03585"],
|
|
123
123
|
});
|
|
124
124
|
const [path, query] = calls[0].split("?");
|
|
125
|
-
expect(path).toBe("/v2/research/papers/2105.05233/similar");
|
|
125
|
+
expect(path).toBe("/v2/search/research/papers/2105.05233/similar");
|
|
126
126
|
const qs = new URLSearchParams(query);
|
|
127
127
|
expect(qs.get("intent")).toBe("diffusion image synthesis");
|
|
128
128
|
expect(qs.get("mode")).toBe("citers");
|
|
@@ -137,7 +137,7 @@ describe("research.searchGithub", () => {
|
|
|
137
137
|
const { client, calls } = makeClient(() => ({ status: 200, data: { results: [] } }));
|
|
138
138
|
await client.searchGithub("milvus hybrid search", { k: 10 });
|
|
139
139
|
const qs = new URLSearchParams(calls[0].split("?")[1]);
|
|
140
|
-
expect(calls[0].startsWith("/v2/research/github?")).toBe(true);
|
|
140
|
+
expect(calls[0].startsWith("/v2/search/research/github?")).toBe(true);
|
|
141
141
|
expect(qs.get("query")).toBe("milvus hybrid search");
|
|
142
142
|
expect(qs.get("k")).toBe("10");
|
|
143
143
|
});
|
|
@@ -33,6 +33,7 @@ describe("JS SDK v2 scrape-browser methods", () => {
|
|
|
33
33
|
data: {
|
|
34
34
|
success: true,
|
|
35
35
|
output: "Clicked the button",
|
|
36
|
+
cdpUrl: "wss://browser.example.com/cdp",
|
|
36
37
|
liveViewUrl: "https://live.example.com/view",
|
|
37
38
|
interactiveLiveViewUrl: "https://live.example.com/interactive",
|
|
38
39
|
stdout: "",
|
|
@@ -52,6 +53,7 @@ describe("JS SDK v2 scrape-browser methods", () => {
|
|
|
52
53
|
);
|
|
53
54
|
expect(response.success).toBe(true);
|
|
54
55
|
expect(response.output).toBe("Clicked the button");
|
|
56
|
+
expect(response.cdpUrl).toBe("wss://browser.example.com/cdp");
|
|
55
57
|
expect(response.liveViewUrl).toBe("https://live.example.com/view");
|
|
56
58
|
expect(response.interactiveLiveViewUrl).toBe(
|
|
57
59
|
"https://live.example.com/interactive",
|
package/src/v2/client.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { parse as parseMethod } from "./methods/parse";
|
|
8
8
|
import { search } from "./methods/search";
|
|
9
9
|
import { map as mapMethod } from "./methods/map";
|
|
10
|
+
import { feedback as feedbackMethod, searchFeedback as searchFeedbackMethod } from "./methods/feedback";
|
|
10
11
|
import {
|
|
11
12
|
startCrawl,
|
|
12
13
|
getCrawlStatus,
|
|
@@ -50,6 +51,9 @@ import type {
|
|
|
50
51
|
ScrapeOptions,
|
|
51
52
|
SearchData,
|
|
52
53
|
SearchRequest,
|
|
54
|
+
EndpointFeedbackRequest,
|
|
55
|
+
FeedbackResponse,
|
|
56
|
+
SearchFeedbackRequest,
|
|
53
57
|
MapData,
|
|
54
58
|
MapOptions,
|
|
55
59
|
CrawlResponse,
|
|
@@ -236,6 +240,25 @@ export class FirecrawlClient {
|
|
|
236
240
|
return search(this.http, { query, ...req });
|
|
237
241
|
}
|
|
238
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Submit feedback for a v2 job.
|
|
245
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
246
|
+
* @returns Feedback record and refund details.
|
|
247
|
+
*/
|
|
248
|
+
async feedback(request: EndpointFeedbackRequest): Promise<FeedbackResponse> {
|
|
249
|
+
return feedbackMethod(this.http, request);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Submit feedback for a search job.
|
|
254
|
+
* @param jobId Search job id returned by search.
|
|
255
|
+
* @param request Search feedback payload.
|
|
256
|
+
* @returns Feedback record and refund details.
|
|
257
|
+
*/
|
|
258
|
+
async searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse> {
|
|
259
|
+
return searchFeedbackMethod(this.http, jobId, request);
|
|
260
|
+
}
|
|
261
|
+
|
|
239
262
|
// Research
|
|
240
263
|
/**
|
|
241
264
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
|
@@ -618,4 +641,3 @@ export class FirecrawlClient {
|
|
|
618
641
|
}
|
|
619
642
|
|
|
620
643
|
export default FirecrawlClient;
|
|
621
|
-
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type EndpointFeedbackRequest,
|
|
3
|
+
type FeedbackResponse,
|
|
4
|
+
type SearchFeedbackRequest,
|
|
5
|
+
} from "../types";
|
|
6
|
+
import { HttpClient } from "../utils/httpClient";
|
|
7
|
+
import {
|
|
8
|
+
normalizeAxiosError,
|
|
9
|
+
throwForBadResponse,
|
|
10
|
+
} from "../utils/errorHandler";
|
|
11
|
+
|
|
12
|
+
function validateRating(rating: string): void {
|
|
13
|
+
if (!["good", "partial", "bad"].includes(rating)) {
|
|
14
|
+
throw new Error("rating must be one of: good, partial, bad");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function feedback(
|
|
19
|
+
http: HttpClient,
|
|
20
|
+
request: EndpointFeedbackRequest,
|
|
21
|
+
): Promise<FeedbackResponse> {
|
|
22
|
+
if (!request.endpoint) throw new Error("endpoint is required");
|
|
23
|
+
if (!request.jobId) throw new Error("jobId is required");
|
|
24
|
+
validateRating(request.rating);
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const res = await http.post<FeedbackResponse>("/v2/feedback", request);
|
|
28
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
29
|
+
throwForBadResponse(res, "feedback");
|
|
30
|
+
}
|
|
31
|
+
return res.data;
|
|
32
|
+
} catch (err: any) {
|
|
33
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "feedback");
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function searchFeedback(
|
|
39
|
+
http: HttpClient,
|
|
40
|
+
jobId: string,
|
|
41
|
+
request: SearchFeedbackRequest,
|
|
42
|
+
): Promise<FeedbackResponse> {
|
|
43
|
+
if (!jobId) throw new Error("jobId is required");
|
|
44
|
+
validateRating(request.rating);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const res = await http.post<FeedbackResponse>(
|
|
48
|
+
`/v2/search/${encodeURIComponent(jobId)}/feedback`,
|
|
49
|
+
request,
|
|
50
|
+
);
|
|
51
|
+
if (res.status !== 200 || !res.data?.success) {
|
|
52
|
+
throwForBadResponse(res, "searchFeedback");
|
|
53
|
+
}
|
|
54
|
+
return res.data;
|
|
55
|
+
} catch (err: any) {
|
|
56
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "searchFeedback");
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/v2/methods/map.ts
CHANGED
|
@@ -37,6 +37,7 @@ export async function map(
|
|
|
37
37
|
try {
|
|
38
38
|
const res = await http.post<{
|
|
39
39
|
success: boolean;
|
|
40
|
+
id?: string;
|
|
40
41
|
error?: string;
|
|
41
42
|
links?: Array<string | SearchResultWeb>;
|
|
42
43
|
}>(
|
|
@@ -60,7 +61,7 @@ export async function map(
|
|
|
60
61
|
description: (item as any).description,
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
return { links };
|
|
64
|
+
return { id: res.data.id, links };
|
|
64
65
|
} catch (err: any) {
|
|
65
66
|
if (err?.isAxiosError) return normalizeAxiosError(err, "map");
|
|
66
67
|
throw err;
|
|
@@ -13,7 +13,7 @@ import { SdkError } from "../types";
|
|
|
13
13
|
import { HttpClient } from "../utils/httpClient";
|
|
14
14
|
import { throwForBadResponse } from "../utils/errorHandler";
|
|
15
15
|
|
|
16
|
-
const BASE = "/v2/research";
|
|
16
|
+
const BASE = "/v2/search/research";
|
|
17
17
|
|
|
18
18
|
/** Append a value (or repeated array values) to a URLSearchParams instance. */
|
|
19
19
|
function appendParam(
|
package/src/v2/types.ts
CHANGED
|
@@ -647,6 +647,7 @@ export interface BatchScrapeJob {
|
|
|
647
647
|
}
|
|
648
648
|
|
|
649
649
|
export interface MapData {
|
|
650
|
+
id?: string;
|
|
650
651
|
links: SearchResultWeb[];
|
|
651
652
|
}
|
|
652
653
|
|
|
@@ -662,6 +663,51 @@ export interface MapOptions {
|
|
|
662
663
|
location?: LocationConfig;
|
|
663
664
|
}
|
|
664
665
|
|
|
666
|
+
export type FeedbackRating = "good" | "partial" | "bad";
|
|
667
|
+
export type EndpointFeedbackEndpoint = "search" | "scrape" | "parse" | "map";
|
|
668
|
+
|
|
669
|
+
export interface FeedbackValuableSource {
|
|
670
|
+
url: string;
|
|
671
|
+
reason?: string;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export interface FeedbackMissingContent {
|
|
675
|
+
topic: string;
|
|
676
|
+
description?: string;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export interface SearchFeedbackRequest {
|
|
680
|
+
rating: FeedbackRating;
|
|
681
|
+
valuableSources?: FeedbackValuableSource[];
|
|
682
|
+
missingContent?: FeedbackMissingContent[];
|
|
683
|
+
querySuggestions?: string;
|
|
684
|
+
integration?: string | null;
|
|
685
|
+
origin?: string;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export interface EndpointFeedbackRequest extends SearchFeedbackRequest {
|
|
689
|
+
endpoint: EndpointFeedbackEndpoint;
|
|
690
|
+
jobId: string;
|
|
691
|
+
issues?: string[];
|
|
692
|
+
tags?: string[];
|
|
693
|
+
note?: string;
|
|
694
|
+
url?: string;
|
|
695
|
+
pageNumbers?: number[];
|
|
696
|
+
/** Small endpoint-specific metadata object. Must be 8KB or smaller. */
|
|
697
|
+
metadata?: Record<string, unknown>;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export interface FeedbackResponse {
|
|
701
|
+
success: true;
|
|
702
|
+
feedbackId: string;
|
|
703
|
+
creditsRefunded: number;
|
|
704
|
+
alreadySubmitted?: boolean;
|
|
705
|
+
dailyCapReached?: boolean;
|
|
706
|
+
creditsRefundedToday?: number;
|
|
707
|
+
dailyRefundCap?: number;
|
|
708
|
+
warning?: string;
|
|
709
|
+
}
|
|
710
|
+
|
|
665
711
|
/**
|
|
666
712
|
* Schedule for a monitor.
|
|
667
713
|
*
|
|
@@ -1069,6 +1115,7 @@ export interface BrowserCreateResponse {
|
|
|
1069
1115
|
|
|
1070
1116
|
export interface BrowserExecuteResponse {
|
|
1071
1117
|
success: boolean;
|
|
1118
|
+
cdpUrl?: string;
|
|
1072
1119
|
liveViewUrl?: string;
|
|
1073
1120
|
interactiveLiveViewUrl?: string;
|
|
1074
1121
|
output?: string;
|
|
@@ -1129,16 +1176,18 @@ export interface PaperSignals {
|
|
|
1129
1176
|
structural: number;
|
|
1130
1177
|
/** Semantic score from the intent abstract search (0 if absent). */
|
|
1131
1178
|
semantic: number;
|
|
1132
|
-
/** Citation-graph
|
|
1133
|
-
|
|
1179
|
+
/** Citation-graph article-rank score of the candidate. */
|
|
1180
|
+
articleRank: number;
|
|
1134
1181
|
/** Number of distinct seeds connected to this candidate. */
|
|
1135
|
-
|
|
1182
|
+
seedOverlap: number;
|
|
1136
1183
|
}
|
|
1137
1184
|
|
|
1138
|
-
/** A ranked paper. `
|
|
1185
|
+
/** A ranked paper. `paperId` is canonical; arXiv lives in `ids`. */
|
|
1139
1186
|
export interface PaperResult {
|
|
1140
1187
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
1141
|
-
|
|
1188
|
+
paperId: string;
|
|
1189
|
+
/** Preferred cite/fetch identifier such as `arxiv:<id>`, `pmid:<id>`, or `doi:<id>`. */
|
|
1190
|
+
primaryId: string;
|
|
1142
1191
|
ids?: IdMap;
|
|
1143
1192
|
title: string;
|
|
1144
1193
|
abstract: string;
|
|
@@ -1149,7 +1198,7 @@ export interface PaperResult {
|
|
|
1149
1198
|
}
|
|
1150
1199
|
|
|
1151
1200
|
export interface PaperMetadata {
|
|
1152
|
-
|
|
1201
|
+
paperId: string;
|
|
1153
1202
|
ids?: IdMap;
|
|
1154
1203
|
title: string;
|
|
1155
1204
|
abstract: string;
|
|
@@ -1158,9 +1207,9 @@ export interface PaperMetadata {
|
|
|
1158
1207
|
/** arXiv categories. Omitted if unknown. */
|
|
1159
1208
|
categories?: string[];
|
|
1160
1209
|
/** Original creation date string (format varies). Omitted if unknown. */
|
|
1161
|
-
|
|
1210
|
+
createdDate?: string;
|
|
1162
1211
|
/** Last-updated date string. Omitted if unknown. */
|
|
1163
|
-
|
|
1212
|
+
updateDate?: string;
|
|
1164
1213
|
}
|
|
1165
1214
|
|
|
1166
1215
|
export interface Passage {
|
|
@@ -1171,17 +1220,20 @@ export interface Passage {
|
|
|
1171
1220
|
}
|
|
1172
1221
|
|
|
1173
1222
|
export interface SearchPapersResponse {
|
|
1223
|
+
success: boolean;
|
|
1174
1224
|
results: PaperResult[];
|
|
1175
1225
|
}
|
|
1176
1226
|
|
|
1177
1227
|
export interface PaperMetadataResponse {
|
|
1228
|
+
success: boolean;
|
|
1178
1229
|
paper: PaperMetadata;
|
|
1179
1230
|
}
|
|
1180
1231
|
|
|
1181
1232
|
export interface ReadPaperResponse {
|
|
1233
|
+
success: boolean;
|
|
1182
1234
|
paper: PaperMetadata;
|
|
1183
1235
|
/** Resolved canonical paper id (empty string if not found via id-key). */
|
|
1184
|
-
|
|
1236
|
+
paperId: string;
|
|
1185
1237
|
/** Echo of the read query. */
|
|
1186
1238
|
query: string;
|
|
1187
1239
|
/** Top matching in-body passages. */
|
|
@@ -1189,10 +1241,11 @@ export interface ReadPaperResponse {
|
|
|
1189
1241
|
}
|
|
1190
1242
|
|
|
1191
1243
|
export interface SimilarPapersResponse {
|
|
1244
|
+
success: boolean;
|
|
1192
1245
|
/** Ranked related papers; each carries `signals`. */
|
|
1193
1246
|
results: PaperResult[];
|
|
1194
1247
|
/** Number of resolved candidates considered before truncation to `k`. */
|
|
1195
|
-
|
|
1248
|
+
poolSize: number;
|
|
1196
1249
|
/** True if more resolved candidates existed than were returned. */
|
|
1197
1250
|
truncated: boolean;
|
|
1198
1251
|
/** Human-readable note when no results are produced. */
|
|
@@ -1205,11 +1258,12 @@ export interface GitHubScoreBreakdown {
|
|
|
1205
1258
|
semantic?: number;
|
|
1206
1259
|
lexical?: number;
|
|
1207
1260
|
fusion?: number;
|
|
1261
|
+
rerank?: number;
|
|
1208
1262
|
}
|
|
1209
1263
|
|
|
1210
1264
|
export interface GitHubSearchItem {
|
|
1211
|
-
resultType: "github_history" | "repo_readme";
|
|
1212
|
-
/** `owner/name
|
|
1265
|
+
resultType: "github_history" | "repo_readme" | "web";
|
|
1266
|
+
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
1213
1267
|
repo: string;
|
|
1214
1268
|
url: string;
|
|
1215
1269
|
/** History page type (e.g. `issue`, `pull`). Omitted for readmes. */
|
|
@@ -1220,6 +1274,8 @@ export interface GitHubSearchItem {
|
|
|
1220
1274
|
segmentCount?: number;
|
|
1221
1275
|
/** Readme URL (readme results). Omitted otherwise. */
|
|
1222
1276
|
readmeUrl?: string;
|
|
1277
|
+
/** SERP page title. Only set on web results. */
|
|
1278
|
+
title?: string;
|
|
1223
1279
|
/** Short matched excerpt. */
|
|
1224
1280
|
snippet: string;
|
|
1225
1281
|
/** Full matched content in markdown. Omitted unless available. */
|
|
@@ -1228,6 +1284,7 @@ export interface GitHubSearchItem {
|
|
|
1228
1284
|
}
|
|
1229
1285
|
|
|
1230
1286
|
export interface GitHubSearchResponse {
|
|
1287
|
+
success: boolean;
|
|
1231
1288
|
results: GitHubSearchItem[];
|
|
1232
1289
|
}
|
|
1233
1290
|
|