feat(v1/extract) Show sources out of __experimental (#1180)

* Nick:

* Nick:

* Nick:
This commit is contained in:
Nicolas 2025-02-13 12:41:45 -03:00 committed by GitHub
parent 1d9a0b9653
commit 73ecaf74c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 4 deletions

View File

@ -73,7 +73,7 @@ export async function extractController(
status: "processing", status: "processing",
showSteps: req.body.__experimental_streamSteps, showSteps: req.body.__experimental_streamSteps,
showLLMUsage: req.body.__experimental_llmUsage, showLLMUsage: req.body.__experimental_llmUsage,
showSources: req.body.__experimental_showSources, showSources: req.body.__experimental_showSources || req.body.showSources,
}); });
if (Sentry.isInitialized()) { if (Sentry.isInitialized()) {

View File

@ -272,6 +272,7 @@ export const extractV1Options = z
__experimental_streamSteps: z.boolean().default(false), __experimental_streamSteps: z.boolean().default(false),
__experimental_llmUsage: z.boolean().default(false), __experimental_llmUsage: z.boolean().default(false),
__experimental_showSources: z.boolean().default(false), __experimental_showSources: z.boolean().default(false),
showSources: z.boolean().default(false),
__experimental_cacheKey: z.string().optional(), __experimental_cacheKey: z.string().optional(),
__experimental_cacheMode: z.enum(["direct", "save", "load"]).default("direct").optional() __experimental_cacheMode: z.enum(["direct", "save", "load"]).default("direct").optional()
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "@mendable/firecrawl-js", "name": "@mendable/firecrawl-js",
"version": "1.16.0", "version": "1.17.0",
"description": "JavaScript SDK for Firecrawl API", "description": "JavaScript SDK for Firecrawl API",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -262,6 +262,7 @@ export interface ExtractParams<LLMSchema extends zt.ZodSchema = any> {
enableWebSearch?: boolean; enableWebSearch?: boolean;
includeSubdomains?: boolean; includeSubdomains?: boolean;
origin?: string; origin?: string;
showSources?: boolean;
} }
/** /**
@ -273,6 +274,7 @@ export interface ExtractResponse<LLMSchema extends zt.ZodSchema = any> {
data: LLMSchema; data: LLMSchema;
error?: string; error?: string;
warning?: string; warning?: string;
sources?: string[];
} }
/** /**
@ -1041,7 +1043,8 @@ export default class FirecrawlApp {
success: true, success: true,
data: extractStatus.data, data: extractStatus.data,
warning: extractStatus.warning, warning: extractStatus.warning,
error: extractStatus.error error: extractStatus.error,
sources: extractStatus?.sources || undefined,
}; };
} else { } else {
throw new FirecrawlError(`Failed to extract data. Error: ${extractStatus.error}`, statusResponse.status); throw new FirecrawlError(`Failed to extract data. Error: ${extractStatus.error}`, statusResponse.status);

View File

@ -13,7 +13,7 @@ import os
from .firecrawl import FirecrawlApp # noqa from .firecrawl import FirecrawlApp # noqa
__version__ = "1.11.1" __version__ = "1.12.0"
# Define the logger for the Firecrawl project # Define the logger for the Firecrawl project
logger: logging.Logger = logging.getLogger("firecrawl") logger: logging.Logger = logging.getLogger("firecrawl")

View File

@ -54,6 +54,8 @@ class FirecrawlApp:
enable_web_search: Optional[bool] = False enable_web_search: Optional[bool] = False
# Just for backwards compatibility # Just for backwards compatibility
enableWebSearch: Optional[bool] = False enableWebSearch: Optional[bool] = False
show_sources: Optional[bool] = False
@ -631,6 +633,7 @@ class FirecrawlApp:
**jsonData, **jsonData,
'allowExternalLinks': params.get('allow_external_links', params.get('allowExternalLinks', False)), 'allowExternalLinks': params.get('allow_external_links', params.get('allowExternalLinks', False)),
'enableWebSearch': params.get('enable_web_search', params.get('enableWebSearch', False)), 'enableWebSearch': params.get('enable_web_search', params.get('enableWebSearch', False)),
'showSources': params.get('show_sources', params.get('showSources', False)),
'schema': schema, 'schema': schema,
'origin': 'api-sdk' 'origin': 'api-sdk'
} }