Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix schema
rafaelmmiller2fb8a3c8dc42
diff --git a/apps/api/requests.http b/apps/api/requests.httpindex 9fe36aa7a..0e3b92066 100644--- a/apps/api/requests.http+++ b/apps/api/requests.http@@ -58,4 +58,20 @@ content-type: application/json{"url": "firecrawl.dev","sitemapOnly": true+}++### Extract+# @name extract+POST {{baseUrl}}/v1/extract HTTP/1.1+Authorization: Bearer {{$dotenv TEST_API_KEY}}+content-type: application/json++{+ "urls": ["firecrawl.dev"],+ "prompt": "What is the title, description and main product of the page?",+ "schema": {+ "title": "string",+ "description": "string",+ "mainProduct": "string"+ }}\ No newline at end of filediff --git a/apps/api/src/scraper/scrapeURL/transformers/llmExtract.ts b/apps/api/src/scraper/scrapeURL/transformers/llmExtract.tsindex 1a5abd66e..ab6194233 100644--- a/apps/api/src/scraper/scrapeURL/transformers/llmExtract.ts+++ b/apps/api/src/scraper/scrapeURL/transformers/llmExtract.ts@@ -108,6 +108,15 @@ export async function generateOpenAICompletions(logger: Logger, options: Extractrequired: ["items"],additionalProperties: false,};+ } else if (schema && typeof schema === 'object' && !schema.type) {+ schema = {+ type: "object",+ properties: Object.fromEntries(+ Object.entries(schema).map(([key, value]) => [key, { type: value }])+ ),+ required: Object.keys(schema),+ additionalProperties: false+ };}schema = normalizeSchema(schema);