mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 11:42:24 +08:00
Caleb: converted llm response to json
This commit is contained in:
parent
2ad7a58eb7
commit
667f740315
|
@ -199,7 +199,8 @@ describe("E2E Tests for API Routes with No Authentication", () => {
|
|||
expect(completedResponse.body.data[0]).toHaveProperty("content");
|
||||
expect(completedResponse.body.data[0]).toHaveProperty("markdown");
|
||||
expect(completedResponse.body.data[0]).toHaveProperty("metadata");
|
||||
expect(completedResponse.body.data[0].content).toContain("🔥 FireCrawl");
|
||||
|
||||
|
||||
}, 60000); // 60 seconds
|
||||
});
|
||||
|
||||
|
|
|
@ -289,13 +289,10 @@ describe("E2E Tests for API Routes", () => {
|
|||
let llmExtraction = response.body.data.llm_extraction;
|
||||
|
||||
|
||||
// Check if llm_extraction is a string and parse it if necessary
|
||||
if (typeof llmExtraction === 'string') {
|
||||
llmExtraction = JSON.parse(llmExtraction);
|
||||
}
|
||||
|
||||
|
||||
console.log('llm extraction', llmExtraction);
|
||||
// // Check if llm_extraction is a string and parse it if necessary
|
||||
// if (typeof llmExtraction === 'string') {
|
||||
// llmExtraction = JSON.parse(llmExtraction);
|
||||
// }
|
||||
|
||||
// Print the keys of the response.body for debugging purposes
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import OpenAI from 'openai'
|
||||
import { z } from 'zod'
|
||||
import { ScraperLoadResult } from './types'
|
||||
import { Document, ExtractorOptions } from "../../lib/entities";
|
||||
|
||||
// import {
|
||||
|
@ -76,7 +75,8 @@ export async function generateOpenAICompletions<T>({
|
|||
const c = completion.choices[0].message.tool_calls[0].function.arguments
|
||||
|
||||
// Extract the LLM extraction content from the completion response
|
||||
const llmExtraction = c;
|
||||
const llmExtraction = JSON.parse(c);
|
||||
|
||||
|
||||
// Return the document with the LLM extraction content added
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue
Block a user