From 83bee0c3cbcf4a6dfddabd082755282552f695b0 Mon Sep 17 00:00:00 2001 From: Emmett McFaralne Date: Wed, 17 Apr 2024 02:23:49 -0400 Subject: [PATCH] added more descriptive error log --- setup.py | 2 +- thepipe_api/extractor.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 3500190..0f52867 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='thepipe_api', - version='0.2.4', + version='0.2.5', author='Emmett McFarlane', author_email='emmett@thepi.pe', description='Automate information extraction for multimodal LLMs.', diff --git a/thepipe_api/extractor.py b/thepipe_api/extractor.py index 7f97376..57758ef 100644 --- a/thepipe_api/extractor.py +++ b/thepipe_api/extractor.py @@ -54,11 +54,11 @@ def extract_from_file(file_path: str, source_type: str, verbose: bool = False, a data={'api_key': THEPIPE_API_KEY, 'ai_extraction': ai_extraction, 'text_only': text_only} ) except Exception as e: - raise ValueError(f"Failed to extract from {file_path}. Exception: {e}.") + raise ValueError(f"Failed to extract from {file_path}. This may mean our backend couldn't handle this request. Exception: {e}.") try: response = response.json() except json.JSONDecodeError: - raise ValueError(f"Failed to extract from {file_path}. Response: {response}.") + raise ValueError(f"Failed to extract from {file_path}. This may mean our backend couldn't handle this request. Response: {response}.") if 'error' in response: raise ValueError(f"{response['error']}") chunks = create_chunks_from_messages(response['messages']) @@ -254,7 +254,7 @@ def extract_url(url: str, text_only: bool = False, local: bool = True) -> List[C try: response = response.json() except json.JSONDecodeError: - raise ValueError(f"Failed to extract from URL. Response: {response}.") + raise ValueError(f"Failed to extract from URL. This may mean our backend couldn't handle this request. Response: {response}.") if 'error' in response: raise ValueError(f"{response['error']}") chunks = create_chunks_from_messages(response['messages'])