Nick: improvements
This commit is contained in:
parent
cbd9e88b77
commit
3c7030dbb1
@ -34,9 +34,9 @@ export async function generateCompletions(
|
|||||||
if (!validate(completionResult.llm_extraction)) {
|
if (!validate(completionResult.llm_extraction)) {
|
||||||
//TODO: add Custom Error handling middleware that bubbles this up with proper Error code, etc.
|
//TODO: add Custom Error handling middleware that bubbles this up with proper Error code, etc.
|
||||||
throw new Error(
|
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)
|
?.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.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@ function prepareOpenAIDoc(
|
|||||||
): OpenAI.Chat.Completions.ChatCompletionContentPart[] {
|
): OpenAI.Chat.Completions.ChatCompletionContentPart[] {
|
||||||
// Check if the markdown content exists in the document
|
// Check if the markdown content exists in the document
|
||||||
if (!document.markdown) {
|
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 }];
|
return [{ type: "text", text: document.markdown }];
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
export type ScraperLoadOptions = {
|
|
||||||
mode?: 'html' | 'text' | 'markdown' | 'image'
|
|
||||||
closeOnFinish?: boolean
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user