mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-22 03:13:00 +03:00
add fallback on llamaparse (#3374)
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code
This commit is contained in:
parent
ee9425737e
commit
a15c9ec88f
@ -334,9 +334,15 @@ class PDFConverter:
|
||||
and file_path.stat().st_size > 100
|
||||
and self.strategy == "fast"
|
||||
):
|
||||
logger.info(f"Switching to auto strategy for {file_path.name}")
|
||||
self.strategy = "auto"
|
||||
return await self.convert(file_path, model, gpt4o_cleaner=gpt4o_cleaner)
|
||||
if os.environ.get("LLAMA_PARSE_API_KEY"):
|
||||
logger.info(f"Switching to llama parse strategy for {file_path.name}")
|
||||
self.method = PdfParser.LLAMA_PARSE
|
||||
self.llama_parse_api_key = os.environ.get("LLAMA_PARSE_API_KEY")
|
||||
return await self.convert(file_path, model, gpt4o_cleaner=gpt4o_cleaner)
|
||||
else:
|
||||
logger.info(
|
||||
f"Unable to switch to llama parse strategy for {file_path.name}"
|
||||
)
|
||||
|
||||
return LangChainDocument(
|
||||
page_content=parsed_md,
|
||||
|
Loading…
Reference in New Issue
Block a user