Merge pull request #685 from garylin2099/llm_mock

Reduce test time with a global LLM mock
This commit is contained in:
geekan 2024-01-05 17:11:25 +08:00 committed by GitHub
commit 230192f5e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 289 additions and 217 deletions

View file

@ -88,6 +88,8 @@ class InvoiceOCR(Action):
async def _ocr(invoice_file_path: Path):
ocr = PaddleOCR(use_angle_cls=True, lang="ch", page_num=1)
ocr_result = ocr.ocr(str(invoice_file_path), cls=True)
for result in ocr_result[0]:
result[1] = (result[1][0], round(result[1][1], 2)) # round long confidence scores to reduce token costs
return ocr_result
async def run(self, file_path: Path, *args, **kwargs) -> list: