Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Nick: improvements

Nicolas3c7030dbb14d
diff --git a/apps/api/src/lib/LLM-extraction/index.ts b/apps/api/src/lib/LLM-extraction/index.ts
index 0f156d2ca..86e2f90f0 100644
--- a/apps/api/src/lib/LLM-extraction/index.ts
+++ b/apps/api/src/lib/LLM-extraction/index.ts
@@ -34,9 +34,9 @@ export async function generateCompletions(
if (!validate(completionResult.llm_extraction)) {
//TODO: add Custom Error handling middleware that bubbles this up with proper Error code, etc.
throw new Error(
- `LLM extraction did not match the extraction schema you provided. This could be because of a model hallucination, or an Error on our side. Try adjusting your prompt, and if it doesn't work reach out to support. JSON parsing error(s): ${validate.errors
+ `JSON parsing error(s): ${validate.errors
?.map((err) => err.message)
- .join(", ")}`
+ .join(", ")}\n\nLLM extraction did not match the extraction schema you provided. This could be because of a model hallucination, or an Error on our side. Try adjusting your prompt, and if it doesn't work reach out to support.`
);
}
diff --git a/apps/api/src/lib/LLM-extraction/models.ts b/apps/api/src/lib/LLM-extraction/models.ts
index d60979e02..ec8a7106f 100644
--- a/apps/api/src/lib/LLM-extraction/models.ts
+++ b/apps/api/src/lib/LLM-extraction/models.ts
@@ -14,7 +14,9 @@ function prepareOpenAIDoc(
): OpenAI.Chat.Completions.ChatCompletionContentPart[] {
// Check if the markdown content exists in the document
if (!document.markdown) {
- throw new Error("Markdown content is missing in the document.");
+ throw new Error(
+ "Markdown content is missing in the document. This is likely due to an error in the scraping process. Please try again or reach out to [email protected]"
+ );
}
return [{ type: "text", text: document.markdown }];
diff --git a/apps/api/src/lib/LLM-extraction/types.ts b/apps/api/src/lib/LLM-extraction/types.ts
deleted file mode 100644
index 211218914..000000000
--- a/apps/api/src/lib/LLM-extraction/types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export type ScraperLoadOptions = {
- mode?: 'html' | 'text' | 'markdown' | 'image'
- closeOnFinish?: boolean
-}
-