0

Caleb: converted llm response to json

This commit is contained in:
Caleb Peffer 2024-04-28 19:28:28 -07:00
parent 2ad7a58eb7
commit 667f740315
3 changed files with 8 additions and 10 deletions

View File

@ -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
});

View File

@ -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

View File

@ -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 {