Nick: improvements

This commit is contained in:
Nicolas 2024-04-30 16:19:32 -07:00
parent cbd9e88b77
commit 3c7030dbb1
3 changed files with 5 additions and 8 deletions

View File

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

View File

@ -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 help@mendable.ai"
);
}
return [{ type: "text", text: document.markdown }];

View File

@ -1,5 +0,0 @@
export type ScraperLoadOptions = {
mode?: 'html' | 'text' | 'markdown' | 'image'
closeOnFinish?: boolean
}