mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-06-23 07:49:20 +08:00
fix schema
This commit is contained in:
parent
53134b7c85
commit
2fb8a3c8dc
@ -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"
|
||||
}
|
||||
}
|
@ -108,6 +108,15 @@ export async function generateOpenAICompletions(logger: Logger, options: Extract
|
||||
required: ["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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user