File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 11import os
22from dotenv import load_dotenv
3- from extract_thinker import LLM
4- from extract_thinker import DocumentLoaderTesseract
5-
3+ from extract_thinker .document_loader .document_loader_pypdf import DocumentLoaderPyPdf
64from extract_thinker .extractor import Extractor
75from tests .models .invoice import InvoiceContract
86
119
1210
1311def test_extract_with_ollama ():
14-
15- # Arrange
16- tesseract_path = os .getenv ("TESSERACT_PATH" )
17- test_file_path = os .path .join (cwd , "test_images" , "invoice.png" )
12+ test_file_path = os .path .join (cwd , "tests" , "files" , "invoice.pdf" )
1813
1914 extractor = Extractor ()
2015 extractor .load_document_loader (
21- DocumentLoaderTesseract ( tesseract_path )
16+ DocumentLoaderPyPdf ( )
2217 )
2318
24- llm = LLM ( "ollama/phi3" , " http://localhost:11434")
25- extractor .load_llm (llm )
19+ os . environ [ "API_BASE" ] = " http://localhost:11434"
20+ extractor .load_llm ("ollama/phi3.5" )
2621
2722 # Act
2823 result = extractor .extract (test_file_path , InvoiceContract )
2924
3025 # Assert
3126 assert result is not None
32- assert result .invoice_number == "0000001 "
33- assert result .invoice_date == "2014-05-07 "
27+ assert result .invoice_number == "00012 "
28+ assert result .invoice_date == "1/30/23 "
You can’t perform that action at this time.
0 commit comments