import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool, searchTool, mapTool, crawlTool } from 'firecrawl-aisdk';
// Scrape a page
const { text } = await generateText({
model: openai('gpt-4o'),
prompt: 'Scrape https://firecrawl.dev and summarize what it does',
tools: { scrape: scrapeTool },
});
// Search the web
const { text: searchResult } = await generateText({
model: openai('gpt-4o'),
prompt: 'Search for Firecrawl and summarize what you find',
tools: { search: searchTool },
});
// Map a site
const { text: mapResult } = await generateText({
model: openai('gpt-4o'),
prompt: 'Map https://docs.firecrawl.dev and list the main sections',
tools: { map: mapTool },
});