Nick: extract urls to extract

This commit is contained in:
Nicolas 2024-11-19 13:49:23 -08:00
parent 2fb8a3c8dc
commit d02a8bcb82
4 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ const main = async () => {
links: z.array(z.string())
});
const extractResult = await app.extractUrls(['https://firecrawl.dev'], {
const extractResult = await app.extract(['https://firecrawl.dev'], {
prompt: "Extract the title, description, and links from the website",
schema: extractSchema
});

View File

@ -699,12 +699,12 @@ export default class FirecrawlApp {
}
/**
* Extracts information from a URL using the Firecrawl API.
* Extracts information from URLs using the Firecrawl API.
* @param url - The URL to extract information from.
* @param params - Additional parameters for the extract request.
* @returns The response from the extract operation.
*/
async extractUrls(urls: string[], params?: ExtractParams): Promise<ExtractResponse | ErrorResponse> {
async extract(urls: string[], params?: ExtractParams): Promise<ExtractResponse | ErrorResponse> {
const headers = this.prepareHeaders();
if (!params?.prompt) {

View File

@ -124,7 +124,7 @@ class ExtractSchema(BaseModel):
extract_schema = ExtractSchema.schema()
# Perform the extraction
extract_result = app.extract_urls(['https://firecrawl.dev'], {
extract_result = app.extract(['https://firecrawl.dev'], {
'prompt': "Extract the title, description, and links from the website",
'schema': extract_schema
})

View File

@ -460,7 +460,7 @@ class FirecrawlApp:
self._handle_error(response, 'check batch scrape status')
def extract_urls(self, urls: List[str], params: Optional[ExtractParams] = None) -> Union[ExtractResponse, ErrorResponse]:
def extract(self, urls: List[str], params: Optional[ExtractParams] = None) -> Union[ExtractResponse, ErrorResponse]:
"""
Extracts information from a URL using the Firecrawl API.