spiderforce4ai 2.5.3__py3-none-any.whl → 2.5.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -889,7 +889,9 @@ class SpiderForce4AI:
889
889
  # Apply transformation if provided
890
890
  if config.post_agent_transformer_function:
891
891
  try:
892
+ logger.info(f"Starting transformer function execution for {result.url}")
892
893
  result.extraction_result = config.post_agent_transformer_function(llm_response)
894
+ logger.info(f"Successfully executed transformer function for {result.url}")
893
895
  except KeyError as e:
894
896
  # Log missing field but continue with transformation
895
897
  missing_field = str(e).strip("'")
@@ -897,7 +899,9 @@ class SpiderForce4AI:
897
899
  # Add missing field with empty value
898
900
  llm_response[missing_field] = ""
899
901
  # Retry transformation with added field
902
+ logger.info(f"Retrying transformer function for {result.url} after adding missing field")
900
903
  result.extraction_result = config.post_agent_transformer_function(llm_response)
904
+ logger.info(f"Successfully executed transformer function on retry for {result.url}")
901
905
  except Exception as e:
902
906
  logger.error(f"Transformer error for {result.url}: {str(e)}")
903
907
  result.extraction_result = llm_response # Use original response if transform fails
@@ -298,12 +298,21 @@ class PostExtractionAgent:
298
298
  try:
299
299
  # Add URL to result before transformation
300
300
  result['url'] = url
301
+
302
+ # Check for required fields and set to None if missing
303
+ required_fields = ['ContactInformation', 'CallToAction', 'KeyPoints', 'Title', 'Description', 'CanonicalUrl']
304
+ for field in required_fields:
305
+ if field not in result:
306
+ logger.warning(f"Missing field '{field}' in LLM response for {url}, setting to None")
307
+ result[field] = None
308
+
309
+ logger.info(f"Executing custom transformer function for {url}")
301
310
  result = self.config.custom_transform_function(result)
302
- logger.info(f"Applied custom transformation for {url}")
311
+ logger.info(f"Successfully applied custom transformation for {url}")
303
312
  except Exception as e:
304
- error_msg = f"Error in custom transform for {url}: {str(e)}"
305
- logger.error(error_msg)
306
- console.print(f"[red]{error_msg}[/red]")
313
+ error_msg = f"Warning: Issue in custom transform for {url}: {str(e)}"
314
+ logger.warning(error_msg)
315
+ console.print(f"[yellow]{error_msg}[/yellow]")
307
316
 
308
317
  # Save result synchronously
309
318
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: spiderforce4ai
3
- Version: 2.5.3
3
+ Version: 2.5.5
4
4
  Summary: Python wrapper for SpiderForce4AI HTML-to-Markdown conversion service with LLM post-processing
5
5
  Home-page: https://petertam.pro
6
6
  Author: Piotr Tamulewicz
@@ -0,0 +1,7 @@
1
+ spiderforce4ai/__init__.py,sha256=Pk1rZXjAWxAaKAFu0pa-lB-020U4vxXP8p9-sFhPDb8,44584
2
+ spiderforce4ai/post_extraction_agent.py,sha256=6Bq8hVMnOarvOKpRHd5ncWV9G0fwwWJ63wZM0IJHXm8,16160
3
+ spiderforce4ai-2.5.5.dist-info/METADATA,sha256=KSkwhmJ2E9y4shyahGPMszdCMGHw0RGba1wh64111BY,9012
4
+ spiderforce4ai-2.5.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
5
+ spiderforce4ai-2.5.5.dist-info/entry_points.txt,sha256=ibARQxOlDiL1ho12zbDZt4Uq5RKSIk_qk159ZlZ46hc,59
6
+ spiderforce4ai-2.5.5.dist-info/top_level.txt,sha256=Kth7A21Js7DCp0j5XBBi-FE45SCLouZkeNZU__Yr9Yk,15
7
+ spiderforce4ai-2.5.5.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- spiderforce4ai/__init__.py,sha256=YgzX9AKw_q2Jp_jZq17UgOuoeJeBRfWz9I73TOBerSs,44100
2
- spiderforce4ai/post_extraction_agent.py,sha256=r8xRq_uwwTxAM-1FVxYRlJMg7CIwQs710plw_10P7eg,15502
3
- spiderforce4ai-2.5.3.dist-info/METADATA,sha256=yULQF7kxyO0Oe8JUPWiz31FPl5b2Pbri2BY_5LzeEbE,9012
4
- spiderforce4ai-2.5.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
5
- spiderforce4ai-2.5.3.dist-info/entry_points.txt,sha256=ibARQxOlDiL1ho12zbDZt4Uq5RKSIk_qk159ZlZ46hc,59
6
- spiderforce4ai-2.5.3.dist-info/top_level.txt,sha256=Kth7A21Js7DCp0j5XBBi-FE45SCLouZkeNZU__Yr9Yk,15
7
- spiderforce4ai-2.5.3.dist-info/RECORD,,