firecrawl 4.26.0 → 4.27.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-TVFWAIIZ.js} +1 -1
- package/dist/index.cjs +59 -3
- package/dist/index.d.cts +76 -13
- package/dist/index.d.ts +76 -13
- package/dist/index.js +60 -4
- package/dist/{package-VYUXJRD4.js → package-JE2ZVGM4.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/v2/research.test.ts +8 -8
- 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 +68 -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.27.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.27.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
|
*
|
|
@@ -900,15 +940,17 @@ interface PaperSignals {
|
|
|
900
940
|
structural: number;
|
|
901
941
|
/** Semantic score from the intent abstract search (0 if absent). */
|
|
902
942
|
semantic: number;
|
|
903
|
-
/** Citation-graph
|
|
904
|
-
|
|
943
|
+
/** Citation-graph article-rank score of the candidate. */
|
|
944
|
+
articleRank: number;
|
|
905
945
|
/** Number of distinct seeds connected to this candidate. */
|
|
906
|
-
|
|
946
|
+
seedOverlap: number;
|
|
907
947
|
}
|
|
908
|
-
/** A ranked paper. `
|
|
948
|
+
/** A ranked paper. `paperId` is canonical; arXiv lives in `ids`. */
|
|
909
949
|
interface PaperResult {
|
|
910
950
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
911
|
-
|
|
951
|
+
paperId: string;
|
|
952
|
+
/** Preferred cite/fetch identifier such as `arxiv:<id>`, `pmid:<id>`, or `doi:<id>`. */
|
|
953
|
+
primaryId: string;
|
|
912
954
|
ids?: IdMap;
|
|
913
955
|
title: string;
|
|
914
956
|
abstract: string;
|
|
@@ -918,7 +960,7 @@ interface PaperResult {
|
|
|
918
960
|
signals?: PaperSignals;
|
|
919
961
|
}
|
|
920
962
|
interface PaperMetadata {
|
|
921
|
-
|
|
963
|
+
paperId: string;
|
|
922
964
|
ids?: IdMap;
|
|
923
965
|
title: string;
|
|
924
966
|
abstract: string;
|
|
@@ -927,9 +969,9 @@ interface PaperMetadata {
|
|
|
927
969
|
/** arXiv categories. Omitted if unknown. */
|
|
928
970
|
categories?: string[];
|
|
929
971
|
/** Original creation date string (format varies). Omitted if unknown. */
|
|
930
|
-
|
|
972
|
+
createdDate?: string;
|
|
931
973
|
/** Last-updated date string. Omitted if unknown. */
|
|
932
|
-
|
|
974
|
+
updateDate?: string;
|
|
933
975
|
}
|
|
934
976
|
interface Passage {
|
|
935
977
|
/** In-body passage text (may be markdown, including tables). */
|
|
@@ -938,25 +980,29 @@ interface Passage {
|
|
|
938
980
|
score: number;
|
|
939
981
|
}
|
|
940
982
|
interface SearchPapersResponse {
|
|
983
|
+
success: boolean;
|
|
941
984
|
results: PaperResult[];
|
|
942
985
|
}
|
|
943
986
|
interface PaperMetadataResponse {
|
|
987
|
+
success: boolean;
|
|
944
988
|
paper: PaperMetadata;
|
|
945
989
|
}
|
|
946
990
|
interface ReadPaperResponse {
|
|
991
|
+
success: boolean;
|
|
947
992
|
paper: PaperMetadata;
|
|
948
993
|
/** Resolved canonical paper id (empty string if not found via id-key). */
|
|
949
|
-
|
|
994
|
+
paperId: string;
|
|
950
995
|
/** Echo of the read query. */
|
|
951
996
|
query: string;
|
|
952
997
|
/** Top matching in-body passages. */
|
|
953
998
|
passages: Passage[];
|
|
954
999
|
}
|
|
955
1000
|
interface SimilarPapersResponse {
|
|
1001
|
+
success: boolean;
|
|
956
1002
|
/** Ranked related papers; each carries `signals`. */
|
|
957
1003
|
results: PaperResult[];
|
|
958
1004
|
/** Number of resolved candidates considered before truncation to `k`. */
|
|
959
|
-
|
|
1005
|
+
poolSize: number;
|
|
960
1006
|
/** True if more resolved candidates existed than were returned. */
|
|
961
1007
|
truncated: boolean;
|
|
962
1008
|
/** Human-readable note when no results are produced. */
|
|
@@ -968,10 +1014,11 @@ interface GitHubScoreBreakdown {
|
|
|
968
1014
|
semantic?: number;
|
|
969
1015
|
lexical?: number;
|
|
970
1016
|
fusion?: number;
|
|
1017
|
+
rerank?: number;
|
|
971
1018
|
}
|
|
972
1019
|
interface GitHubSearchItem {
|
|
973
|
-
resultType: "github_history" | "repo_readme";
|
|
974
|
-
/** `owner/name
|
|
1020
|
+
resultType: "github_history" | "repo_readme" | "web";
|
|
1021
|
+
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
975
1022
|
repo: string;
|
|
976
1023
|
url: string;
|
|
977
1024
|
/** History page type (e.g. `issue`, `pull`). Omitted for readmes. */
|
|
@@ -982,6 +1029,8 @@ interface GitHubSearchItem {
|
|
|
982
1029
|
segmentCount?: number;
|
|
983
1030
|
/** Readme URL (readme results). Omitted otherwise. */
|
|
984
1031
|
readmeUrl?: string;
|
|
1032
|
+
/** SERP page title. Only set on web results. */
|
|
1033
|
+
title?: string;
|
|
985
1034
|
/** Short matched excerpt. */
|
|
986
1035
|
snippet: string;
|
|
987
1036
|
/** Full matched content in markdown. Omitted unless available. */
|
|
@@ -989,6 +1038,7 @@ interface GitHubSearchItem {
|
|
|
989
1038
|
scores: GitHubScoreBreakdown;
|
|
990
1039
|
}
|
|
991
1040
|
interface GitHubSearchResponse {
|
|
1041
|
+
success: boolean;
|
|
992
1042
|
results: GitHubSearchItem[];
|
|
993
1043
|
}
|
|
994
1044
|
/** Options for `research.searchPapers`. */
|
|
@@ -1271,6 +1321,19 @@ declare class FirecrawlClient {
|
|
|
1271
1321
|
* @returns Structured search results.
|
|
1272
1322
|
*/
|
|
1273
1323
|
search(query: string, req?: Omit<SearchRequest, "query">): Promise<SearchData>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Submit feedback for a v2 job.
|
|
1326
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
1327
|
+
* @returns Feedback record and refund details.
|
|
1328
|
+
*/
|
|
1329
|
+
feedback(request: EndpointFeedbackRequest): Promise<FeedbackResponse>;
|
|
1330
|
+
/**
|
|
1331
|
+
* Submit feedback for a search job.
|
|
1332
|
+
* @param jobId Search job id returned by search.
|
|
1333
|
+
* @param request Search feedback payload.
|
|
1334
|
+
* @returns Feedback record and refund details.
|
|
1335
|
+
*/
|
|
1336
|
+
searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse>;
|
|
1274
1337
|
/**
|
|
1275
1338
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
|
1276
1339
|
* Example: `firecrawl.research.searchPapers("diffusion models")`.
|
|
@@ -2439,4 +2502,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2439
2502
|
get v1(): FirecrawlApp;
|
|
2440
2503
|
}
|
|
2441
2504
|
|
|
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 };
|
|
2505
|
+
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
|
*
|
|
@@ -900,15 +940,17 @@ interface PaperSignals {
|
|
|
900
940
|
structural: number;
|
|
901
941
|
/** Semantic score from the intent abstract search (0 if absent). */
|
|
902
942
|
semantic: number;
|
|
903
|
-
/** Citation-graph
|
|
904
|
-
|
|
943
|
+
/** Citation-graph article-rank score of the candidate. */
|
|
944
|
+
articleRank: number;
|
|
905
945
|
/** Number of distinct seeds connected to this candidate. */
|
|
906
|
-
|
|
946
|
+
seedOverlap: number;
|
|
907
947
|
}
|
|
908
|
-
/** A ranked paper. `
|
|
948
|
+
/** A ranked paper. `paperId` is canonical; arXiv lives in `ids`. */
|
|
909
949
|
interface PaperResult {
|
|
910
950
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
911
|
-
|
|
951
|
+
paperId: string;
|
|
952
|
+
/** Preferred cite/fetch identifier such as `arxiv:<id>`, `pmid:<id>`, or `doi:<id>`. */
|
|
953
|
+
primaryId: string;
|
|
912
954
|
ids?: IdMap;
|
|
913
955
|
title: string;
|
|
914
956
|
abstract: string;
|
|
@@ -918,7 +960,7 @@ interface PaperResult {
|
|
|
918
960
|
signals?: PaperSignals;
|
|
919
961
|
}
|
|
920
962
|
interface PaperMetadata {
|
|
921
|
-
|
|
963
|
+
paperId: string;
|
|
922
964
|
ids?: IdMap;
|
|
923
965
|
title: string;
|
|
924
966
|
abstract: string;
|
|
@@ -927,9 +969,9 @@ interface PaperMetadata {
|
|
|
927
969
|
/** arXiv categories. Omitted if unknown. */
|
|
928
970
|
categories?: string[];
|
|
929
971
|
/** Original creation date string (format varies). Omitted if unknown. */
|
|
930
|
-
|
|
972
|
+
createdDate?: string;
|
|
931
973
|
/** Last-updated date string. Omitted if unknown. */
|
|
932
|
-
|
|
974
|
+
updateDate?: string;
|
|
933
975
|
}
|
|
934
976
|
interface Passage {
|
|
935
977
|
/** In-body passage text (may be markdown, including tables). */
|
|
@@ -938,25 +980,29 @@ interface Passage {
|
|
|
938
980
|
score: number;
|
|
939
981
|
}
|
|
940
982
|
interface SearchPapersResponse {
|
|
983
|
+
success: boolean;
|
|
941
984
|
results: PaperResult[];
|
|
942
985
|
}
|
|
943
986
|
interface PaperMetadataResponse {
|
|
987
|
+
success: boolean;
|
|
944
988
|
paper: PaperMetadata;
|
|
945
989
|
}
|
|
946
990
|
interface ReadPaperResponse {
|
|
991
|
+
success: boolean;
|
|
947
992
|
paper: PaperMetadata;
|
|
948
993
|
/** Resolved canonical paper id (empty string if not found via id-key). */
|
|
949
|
-
|
|
994
|
+
paperId: string;
|
|
950
995
|
/** Echo of the read query. */
|
|
951
996
|
query: string;
|
|
952
997
|
/** Top matching in-body passages. */
|
|
953
998
|
passages: Passage[];
|
|
954
999
|
}
|
|
955
1000
|
interface SimilarPapersResponse {
|
|
1001
|
+
success: boolean;
|
|
956
1002
|
/** Ranked related papers; each carries `signals`. */
|
|
957
1003
|
results: PaperResult[];
|
|
958
1004
|
/** Number of resolved candidates considered before truncation to `k`. */
|
|
959
|
-
|
|
1005
|
+
poolSize: number;
|
|
960
1006
|
/** True if more resolved candidates existed than were returned. */
|
|
961
1007
|
truncated: boolean;
|
|
962
1008
|
/** Human-readable note when no results are produced. */
|
|
@@ -968,10 +1014,11 @@ interface GitHubScoreBreakdown {
|
|
|
968
1014
|
semantic?: number;
|
|
969
1015
|
lexical?: number;
|
|
970
1016
|
fusion?: number;
|
|
1017
|
+
rerank?: number;
|
|
971
1018
|
}
|
|
972
1019
|
interface GitHubSearchItem {
|
|
973
|
-
resultType: "github_history" | "repo_readme";
|
|
974
|
-
/** `owner/name
|
|
1020
|
+
resultType: "github_history" | "repo_readme" | "web";
|
|
1021
|
+
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
975
1022
|
repo: string;
|
|
976
1023
|
url: string;
|
|
977
1024
|
/** History page type (e.g. `issue`, `pull`). Omitted for readmes. */
|
|
@@ -982,6 +1029,8 @@ interface GitHubSearchItem {
|
|
|
982
1029
|
segmentCount?: number;
|
|
983
1030
|
/** Readme URL (readme results). Omitted otherwise. */
|
|
984
1031
|
readmeUrl?: string;
|
|
1032
|
+
/** SERP page title. Only set on web results. */
|
|
1033
|
+
title?: string;
|
|
985
1034
|
/** Short matched excerpt. */
|
|
986
1035
|
snippet: string;
|
|
987
1036
|
/** Full matched content in markdown. Omitted unless available. */
|
|
@@ -989,6 +1038,7 @@ interface GitHubSearchItem {
|
|
|
989
1038
|
scores: GitHubScoreBreakdown;
|
|
990
1039
|
}
|
|
991
1040
|
interface GitHubSearchResponse {
|
|
1041
|
+
success: boolean;
|
|
992
1042
|
results: GitHubSearchItem[];
|
|
993
1043
|
}
|
|
994
1044
|
/** Options for `research.searchPapers`. */
|
|
@@ -1271,6 +1321,19 @@ declare class FirecrawlClient {
|
|
|
1271
1321
|
* @returns Structured search results.
|
|
1272
1322
|
*/
|
|
1273
1323
|
search(query: string, req?: Omit<SearchRequest, "query">): Promise<SearchData>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Submit feedback for a v2 job.
|
|
1326
|
+
* @param request Feedback payload with endpoint, job id, rating, and supporting signals.
|
|
1327
|
+
* @returns Feedback record and refund details.
|
|
1328
|
+
*/
|
|
1329
|
+
feedback(request: EndpointFeedbackRequest): Promise<FeedbackResponse>;
|
|
1330
|
+
/**
|
|
1331
|
+
* Submit feedback for a search job.
|
|
1332
|
+
* @param jobId Search job id returned by search.
|
|
1333
|
+
* @param request Search feedback payload.
|
|
1334
|
+
* @returns Feedback record and refund details.
|
|
1335
|
+
*/
|
|
1336
|
+
searchFeedback(jobId: string, request: SearchFeedbackRequest): Promise<FeedbackResponse>;
|
|
1274
1337
|
/**
|
|
1275
1338
|
* Access the v2 research endpoints (arXiv papers + GitHub history/readmes).
|
|
1276
1339
|
* Example: `firecrawl.research.searchPapers("diffusion models")`.
|
|
@@ -2439,4 +2502,4 @@ declare class Firecrawl extends FirecrawlClient {
|
|
|
2439
2502
|
get v1(): FirecrawlApp;
|
|
2440
2503
|
}
|
|
2441
2504
|
|
|
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 };
|
|
2505
|
+
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-TVFWAIIZ.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-JE2ZVGM4.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
|
});
|
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
|
*
|
|
@@ -1129,16 +1175,18 @@ export interface PaperSignals {
|
|
|
1129
1175
|
structural: number;
|
|
1130
1176
|
/** Semantic score from the intent abstract search (0 if absent). */
|
|
1131
1177
|
semantic: number;
|
|
1132
|
-
/** Citation-graph
|
|
1133
|
-
|
|
1178
|
+
/** Citation-graph article-rank score of the candidate. */
|
|
1179
|
+
articleRank: number;
|
|
1134
1180
|
/** Number of distinct seeds connected to this candidate. */
|
|
1135
|
-
|
|
1181
|
+
seedOverlap: number;
|
|
1136
1182
|
}
|
|
1137
1183
|
|
|
1138
|
-
/** A ranked paper. `
|
|
1184
|
+
/** A ranked paper. `paperId` is canonical; arXiv lives in `ids`. */
|
|
1139
1185
|
export interface PaperResult {
|
|
1140
1186
|
/** Canonical paper id — the Milvus INT64 primary key as a decimal string. */
|
|
1141
|
-
|
|
1187
|
+
paperId: string;
|
|
1188
|
+
/** Preferred cite/fetch identifier such as `arxiv:<id>`, `pmid:<id>`, or `doi:<id>`. */
|
|
1189
|
+
primaryId: string;
|
|
1142
1190
|
ids?: IdMap;
|
|
1143
1191
|
title: string;
|
|
1144
1192
|
abstract: string;
|
|
@@ -1149,7 +1197,7 @@ export interface PaperResult {
|
|
|
1149
1197
|
}
|
|
1150
1198
|
|
|
1151
1199
|
export interface PaperMetadata {
|
|
1152
|
-
|
|
1200
|
+
paperId: string;
|
|
1153
1201
|
ids?: IdMap;
|
|
1154
1202
|
title: string;
|
|
1155
1203
|
abstract: string;
|
|
@@ -1158,9 +1206,9 @@ export interface PaperMetadata {
|
|
|
1158
1206
|
/** arXiv categories. Omitted if unknown. */
|
|
1159
1207
|
categories?: string[];
|
|
1160
1208
|
/** Original creation date string (format varies). Omitted if unknown. */
|
|
1161
|
-
|
|
1209
|
+
createdDate?: string;
|
|
1162
1210
|
/** Last-updated date string. Omitted if unknown. */
|
|
1163
|
-
|
|
1211
|
+
updateDate?: string;
|
|
1164
1212
|
}
|
|
1165
1213
|
|
|
1166
1214
|
export interface Passage {
|
|
@@ -1171,17 +1219,20 @@ export interface Passage {
|
|
|
1171
1219
|
}
|
|
1172
1220
|
|
|
1173
1221
|
export interface SearchPapersResponse {
|
|
1222
|
+
success: boolean;
|
|
1174
1223
|
results: PaperResult[];
|
|
1175
1224
|
}
|
|
1176
1225
|
|
|
1177
1226
|
export interface PaperMetadataResponse {
|
|
1227
|
+
success: boolean;
|
|
1178
1228
|
paper: PaperMetadata;
|
|
1179
1229
|
}
|
|
1180
1230
|
|
|
1181
1231
|
export interface ReadPaperResponse {
|
|
1232
|
+
success: boolean;
|
|
1182
1233
|
paper: PaperMetadata;
|
|
1183
1234
|
/** Resolved canonical paper id (empty string if not found via id-key). */
|
|
1184
|
-
|
|
1235
|
+
paperId: string;
|
|
1185
1236
|
/** Echo of the read query. */
|
|
1186
1237
|
query: string;
|
|
1187
1238
|
/** Top matching in-body passages. */
|
|
@@ -1189,10 +1240,11 @@ export interface ReadPaperResponse {
|
|
|
1189
1240
|
}
|
|
1190
1241
|
|
|
1191
1242
|
export interface SimilarPapersResponse {
|
|
1243
|
+
success: boolean;
|
|
1192
1244
|
/** Ranked related papers; each carries `signals`. */
|
|
1193
1245
|
results: PaperResult[];
|
|
1194
1246
|
/** Number of resolved candidates considered before truncation to `k`. */
|
|
1195
|
-
|
|
1247
|
+
poolSize: number;
|
|
1196
1248
|
/** True if more resolved candidates existed than were returned. */
|
|
1197
1249
|
truncated: boolean;
|
|
1198
1250
|
/** Human-readable note when no results are produced. */
|
|
@@ -1205,11 +1257,12 @@ export interface GitHubScoreBreakdown {
|
|
|
1205
1257
|
semantic?: number;
|
|
1206
1258
|
lexical?: number;
|
|
1207
1259
|
fusion?: number;
|
|
1260
|
+
rerank?: number;
|
|
1208
1261
|
}
|
|
1209
1262
|
|
|
1210
1263
|
export interface GitHubSearchItem {
|
|
1211
|
-
resultType: "github_history" | "repo_readme";
|
|
1212
|
-
/** `owner/name
|
|
1264
|
+
resultType: "github_history" | "repo_readme" | "web";
|
|
1265
|
+
/** `owner/name`; empty for web results whose URL is not a repo page. */
|
|
1213
1266
|
repo: string;
|
|
1214
1267
|
url: string;
|
|
1215
1268
|
/** History page type (e.g. `issue`, `pull`). Omitted for readmes. */
|
|
@@ -1220,6 +1273,8 @@ export interface GitHubSearchItem {
|
|
|
1220
1273
|
segmentCount?: number;
|
|
1221
1274
|
/** Readme URL (readme results). Omitted otherwise. */
|
|
1222
1275
|
readmeUrl?: string;
|
|
1276
|
+
/** SERP page title. Only set on web results. */
|
|
1277
|
+
title?: string;
|
|
1223
1278
|
/** Short matched excerpt. */
|
|
1224
1279
|
snippet: string;
|
|
1225
1280
|
/** Full matched content in markdown. Omitted unless available. */
|
|
@@ -1228,6 +1283,7 @@ export interface GitHubSearchItem {
|
|
|
1228
1283
|
}
|
|
1229
1284
|
|
|
1230
1285
|
export interface GitHubSearchResponse {
|
|
1286
|
+
success: boolean;
|
|
1231
1287
|
results: GitHubSearchItem[];
|
|
1232
1288
|
}
|
|
1233
1289
|
|