Skip to content

Commit

Permalink
added more descriptive error log
Browse files Browse the repository at this point in the history
  • Loading branch information
emcf committed Apr 17, 2024
1 parent 8826b79 commit 83bee0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='thepipe_api',
version='0.2.4',
version='0.2.5',
author='Emmett McFarlane',
author_email='[email protected]',
description='Automate information extraction for multimodal LLMs.',
Expand Down
6 changes: 3 additions & 3 deletions thepipe_api/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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'])
Expand Down

0 comments on commit 83bee0c

Please sign in to comment.