44from typing import Dict
55
66from .base_client import BaseClient , AsyncBaseClient
7- from . import MdResponse
7+ from . import ParseResponse
88
99
1010class Axiomatic (BaseClient ):
@@ -24,18 +24,18 @@ class DocumentHelper:
2424 def __init__ (self , ax_client : Axiomatic ):
2525 self ._ax_client = ax_client
2626
27- def pdf_from_url (self , url : str ) -> MdResponse :
27+ def pdf_from_url (self , url : str ) -> ParseResponse :
2828 """Download a PDF document from a URL and parse it into a Markdown response."""
2929 file = requests .get (url )
3030 response = self ._ax_client .document .parse (file = file .content )
31- return response . content
31+ return response
3232
33- def pdf_from_file (self , path : str ) -> MdResponse :
33+ def pdf_from_file (self , path : str ) -> ParseResponse :
3434 """Open a PDF document from a file path and parse it into a Markdown response."""
3535 with open (path , "rb" ) as f :
3636 file = f .read ()
3737 response = self ._ax_client .document .parse (file = file )
38- return response . content
38+ return response
3939
4040 def plot_b64_images (self , images : Dict [str , str ]):
4141 """Plot a dictionary of base64 images."""
@@ -65,7 +65,7 @@ def navigate_image(change):
6565 display (layout )
6666 display_base64_image (current_index [0 ])
6767
68- def save_parsed_pdf (self , response : MdResponse , path : str ):
68+ def save_parsed_pdf (self , response : ParseResponse , path : str ):
6969 """Save a parsed PDF response to a file."""
7070 os .makedirs (path , exist_ok = True )
7171 for img_name , img in response .images .items ():
@@ -75,7 +75,7 @@ def save_parsed_pdf(self, response: MdResponse, path: str):
7575 with open (os .path .join (path , "text.md" ), "w" ) as f :
7676 f .write (response .markdown )
7777
78- def load_parsed_pdf (self , path : str ) -> MdResponse :
78+ def load_parsed_pdf (self , path : str ) -> ParseResponse :
7979 """Load a parsed PDF response from a file."""
8080 with open (os .path .join (path , "text.md" ), "r" ) as f :
8181 markdown = f .read ()
@@ -86,7 +86,7 @@ def load_parsed_pdf(self, path: str) -> MdResponse:
8686 with open (os .path .join (path , img_name ), "rb" ) as img_file :
8787 images [img_name ] = base64 .b64encode (img_file .read ()).decode ("utf-8" )
8888
89- return MdResponse (markdown = markdown , images = images )
89+ return ParseResponse (markdown = markdown , images = images )
9090
9191
9292class AsyncAxiomatic (AsyncBaseClient ): ...
0 commit comments