From e89277199d9a98e03767335eccc4a0b5ea6a754b Mon Sep 17 00:00:00 2001 From: Logan Markewich Date: Fri, 1 Nov 2024 09:58:38 -0600 Subject: [PATCH] nit -- lets using asyncio_run --- llama_parse/base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llama_parse/base.py b/llama_parse/base.py index 4dd3e20..4f7fa59 100644 --- a/llama_parse/base.py +++ b/llama_parse/base.py @@ -12,7 +12,7 @@ from fsspec import AbstractFileSystem from fsspec.spec import AbstractBufferedFile -from llama_index.core.async_utils import run_jobs +from llama_index.core.async_utils import asyncio_run, run_jobs from llama_index.core.bridge.pydantic import Field, field_validator from llama_index.core.constants import DEFAULT_BASE_URL from llama_index.core.readers.base import BasePydanticReader @@ -473,7 +473,7 @@ def load_data( ) -> List[Document]: """Load data from the input path.""" try: - return asyncio.run(self.aload_data(file_path, extra_info, fs=fs)) + return asyncio_run(self.aload_data(file_path, extra_info, fs=fs)) except RuntimeError as e: if nest_asyncio_err in str(e): raise RuntimeError(nest_asyncio_msg) @@ -540,7 +540,7 @@ def get_json_result( ) -> List[dict]: """Parse the input path.""" try: - return asyncio.run(self.aget_json(file_path, extra_info)) + return asyncio_run(self.aget_json(file_path, extra_info)) except RuntimeError as e: if nest_asyncio_err in str(e): raise RuntimeError(nest_asyncio_msg) @@ -603,7 +603,7 @@ async def aget_images( def get_images(self, json_result: List[dict], download_path: str) -> List[dict]: """Download images from the parsed result.""" try: - return asyncio.run(self.aget_images(json_result, download_path)) + return asyncio_run(self.aget_images(json_result, download_path)) except RuntimeError as e: if nest_asyncio_err in str(e): raise RuntimeError(nest_asyncio_msg) @@ -657,7 +657,7 @@ async def aget_xlsx( def get_xlsx(self, json_result: List[dict], download_path: str) -> List[dict]: """Download xlsx from the parsed result.""" try: - return asyncio.run(self.aget_xlsx(json_result, download_path)) + return asyncio_run(self.aget_xlsx(json_result, download_path)) except RuntimeError as e: if nest_asyncio_err in str(e): raise RuntimeError(nest_asyncio_msg)