abstractcore 2.9.1__py3-none-any.whl → 2.11.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. abstractcore/__init__.py +7 -27
  2. abstractcore/apps/deepsearch.py +9 -4
  3. abstractcore/apps/extractor.py +33 -100
  4. abstractcore/apps/intent.py +19 -0
  5. abstractcore/apps/judge.py +20 -1
  6. abstractcore/apps/summarizer.py +20 -1
  7. abstractcore/architectures/detection.py +34 -1
  8. abstractcore/architectures/response_postprocessing.py +313 -0
  9. abstractcore/assets/architecture_formats.json +38 -8
  10. abstractcore/assets/model_capabilities.json +882 -160
  11. abstractcore/compression/__init__.py +1 -2
  12. abstractcore/compression/glyph_processor.py +6 -4
  13. abstractcore/config/main.py +52 -20
  14. abstractcore/config/manager.py +390 -12
  15. abstractcore/config/vision_config.py +5 -5
  16. abstractcore/core/interface.py +151 -3
  17. abstractcore/core/session.py +16 -10
  18. abstractcore/download.py +1 -1
  19. abstractcore/embeddings/manager.py +20 -6
  20. abstractcore/endpoint/__init__.py +2 -0
  21. abstractcore/endpoint/app.py +458 -0
  22. abstractcore/mcp/client.py +3 -1
  23. abstractcore/media/__init__.py +52 -17
  24. abstractcore/media/auto_handler.py +42 -22
  25. abstractcore/media/base.py +44 -1
  26. abstractcore/media/capabilities.py +12 -33
  27. abstractcore/media/enrichment.py +105 -0
  28. abstractcore/media/handlers/anthropic_handler.py +19 -28
  29. abstractcore/media/handlers/local_handler.py +124 -70
  30. abstractcore/media/handlers/openai_handler.py +19 -31
  31. abstractcore/media/processors/__init__.py +4 -2
  32. abstractcore/media/processors/audio_processor.py +57 -0
  33. abstractcore/media/processors/office_processor.py +8 -3
  34. abstractcore/media/processors/pdf_processor.py +46 -3
  35. abstractcore/media/processors/text_processor.py +22 -24
  36. abstractcore/media/processors/video_processor.py +58 -0
  37. abstractcore/media/types.py +97 -4
  38. abstractcore/media/utils/image_scaler.py +20 -2
  39. abstractcore/media/utils/video_frames.py +219 -0
  40. abstractcore/media/vision_fallback.py +136 -22
  41. abstractcore/processing/__init__.py +32 -3
  42. abstractcore/processing/basic_deepsearch.py +15 -10
  43. abstractcore/processing/basic_intent.py +3 -2
  44. abstractcore/processing/basic_judge.py +3 -2
  45. abstractcore/processing/basic_summarizer.py +1 -1
  46. abstractcore/providers/__init__.py +3 -1
  47. abstractcore/providers/anthropic_provider.py +95 -8
  48. abstractcore/providers/base.py +1516 -81
  49. abstractcore/providers/huggingface_provider.py +546 -69
  50. abstractcore/providers/lmstudio_provider.py +30 -916
  51. abstractcore/providers/mlx_provider.py +382 -35
  52. abstractcore/providers/model_capabilities.py +5 -1
  53. abstractcore/providers/ollama_provider.py +99 -15
  54. abstractcore/providers/openai_compatible_provider.py +406 -180
  55. abstractcore/providers/openai_provider.py +188 -44
  56. abstractcore/providers/openrouter_provider.py +76 -0
  57. abstractcore/providers/registry.py +61 -5
  58. abstractcore/providers/streaming.py +138 -33
  59. abstractcore/providers/vllm_provider.py +92 -817
  60. abstractcore/server/app.py +478 -28
  61. abstractcore/server/audio_endpoints.py +139 -0
  62. abstractcore/server/vision_endpoints.py +1319 -0
  63. abstractcore/structured/handler.py +316 -41
  64. abstractcore/tools/common_tools.py +5501 -2012
  65. abstractcore/tools/comms_tools.py +1641 -0
  66. abstractcore/tools/core.py +37 -7
  67. abstractcore/tools/handler.py +4 -9
  68. abstractcore/tools/parser.py +49 -2
  69. abstractcore/tools/tag_rewriter.py +2 -1
  70. abstractcore/tools/telegram_tdlib.py +407 -0
  71. abstractcore/tools/telegram_tools.py +261 -0
  72. abstractcore/utils/cli.py +1085 -72
  73. abstractcore/utils/structured_logging.py +29 -8
  74. abstractcore/utils/token_utils.py +2 -0
  75. abstractcore/utils/truncation.py +29 -0
  76. abstractcore/utils/version.py +3 -4
  77. abstractcore/utils/vlm_token_calculator.py +12 -2
  78. abstractcore-2.11.4.dist-info/METADATA +562 -0
  79. abstractcore-2.11.4.dist-info/RECORD +133 -0
  80. {abstractcore-2.9.1.dist-info → abstractcore-2.11.4.dist-info}/WHEEL +1 -1
  81. {abstractcore-2.9.1.dist-info → abstractcore-2.11.4.dist-info}/entry_points.txt +1 -0
  82. abstractcore-2.9.1.dist-info/METADATA +0 -1190
  83. abstractcore-2.9.1.dist-info/RECORD +0 -119
  84. {abstractcore-2.9.1.dist-info → abstractcore-2.11.4.dist-info}/licenses/LICENSE +0 -0
  85. {abstractcore-2.9.1.dist-info → abstractcore-2.11.4.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ Glyph visual-text compression system for AbstractCore.
3
3
 
4
4
  This module provides visual-text compression capabilities that transform long textual
5
5
  sequences into optimized images for processing by Vision-Language Models (VLMs),
6
- achieving 3-4x token compression without accuracy loss.
6
+ which can reduce token usage for long inputs (results vary by content/model/settings).
7
7
 
8
8
  Based on the Glyph framework by Z.ai/THU-COAI with AbstractCore-specific enhancements.
9
9
  """
@@ -26,4 +26,3 @@ __all__ = [
26
26
  'CompressionError',
27
27
  'CompressionQualityError'
28
28
  ]
29
-
@@ -1,8 +1,10 @@
1
1
  """
2
2
  Glyph visual-text compression processor for AbstractCore.
3
3
 
4
- Based on the actual Glyph implementation using reportlab for PDF generation
5
- and pdf2image for conversion, with provider-specific optimization.
4
+ Renders long text into images for vision-capable models using a Pillow-based renderer.
5
+
6
+ This is an experimental feature; compression ratios and quality vary significantly by
7
+ content, model, and rendering settings.
6
8
  """
7
9
 
8
10
  import time
@@ -29,7 +31,8 @@ class GlyphProcessor(BaseMediaHandler):
29
31
  Glyph visual-text compression processor for AbstractCore.
30
32
 
31
33
  Transforms long textual sequences into optimized images for processing
32
- by Vision-Language Models (VLMs), achieving 3-4x token compression.
34
+ by Vision-Language Models (VLMs). This can reduce token usage for long inputs,
35
+ but results depend on content/model/OCR behavior.
33
36
  """
34
37
 
35
38
  def __init__(self, config: Optional[GlyphConfig] = None, **kwargs):
@@ -378,4 +381,3 @@ class GlyphProcessor(BaseMediaHandler):
378
381
  },
379
382
  'provider_profiles': list(self.provider_profiles.keys())
380
383
  }
381
-
@@ -265,9 +265,9 @@ def add_arguments(parser: argparse.ArgumentParser):
265
265
  # Timeout configuration group
266
266
  timeout_group = parser.add_argument_group('Timeout Configuration')
267
267
  timeout_group.add_argument("--set-default-timeout", type=float, metavar="SECONDS",
268
- help="Set default HTTP request timeout in seconds (default: 7200 = 2 hours)")
268
+ help="Set default HTTP request timeout in seconds (default: 7200 = 2 hours; 0 = unlimited)")
269
269
  timeout_group.add_argument("--set-tool-timeout", type=float, metavar="SECONDS",
270
- help="Set tool execution timeout in seconds (default: 600 = 10 minutes)")
270
+ help="Set tool execution timeout in seconds (default: 600 = 10 minutes; 0 = unlimited)")
271
271
 
272
272
  def print_status():
273
273
  """Print comprehensive configuration status with improved readability."""
@@ -463,8 +463,8 @@ def print_status():
463
463
  print("│ abstractcore --set-default-cache-dir PATH")
464
464
  print("│")
465
465
  print("│ ⏱️ Performance & Timeouts")
466
- print("│ abstractcore --set-default-timeout SECONDS (HTTP requests, default: 7200)")
467
- print("│ abstractcore --set-tool-timeout SECONDS (Tool execution, default: 600)")
466
+ print("│ abstractcore --set-default-timeout SECONDS (HTTP requests, default: 7200; 0 = unlimited)")
467
+ print("│ abstractcore --set-tool-timeout SECONDS (Tool execution, default: 600; 0 = unlimited)")
468
468
  print("│")
469
469
  print("│ 🎯 Specialized Models")
470
470
  print("│ abstractcore --set-chat-model PROVIDER/MODEL")
@@ -525,12 +525,32 @@ def interactive_configure():
525
525
  print("\n3. API Keys Setup")
526
526
  api_choice = input("Configure API keys? [y/N]: ").lower().strip()
527
527
  if api_choice == 'y':
528
- for provider in ["openai", "anthropic", "google"]:
528
+ for provider in ["openai", "anthropic", "openrouter", "google"]:
529
529
  key = input(f"Enter {provider} API key (or press Enter to skip): ").strip()
530
530
  if key:
531
531
  config_manager.set_api_key(provider, key)
532
532
  print(f"✅ Set {provider} API key")
533
533
 
534
+ # Ask about console log verbosity
535
+ print("\n4. Console Logging Verbosity")
536
+ print("Choose console verbosity level:")
537
+ print(" none | error | warning | info | debug")
538
+ level = input("Console log level [info]: ").strip().lower()
539
+ if not level:
540
+ level = "info"
541
+ level_map = {
542
+ "none": "NONE",
543
+ "error": "ERROR",
544
+ "warning": "WARNING",
545
+ "info": "INFO",
546
+ "debug": "DEBUG",
547
+ }
548
+ if level in level_map:
549
+ config_manager.set_console_log_level(level_map[level])
550
+ print(f"✅ Set console log level to: {level_map[level]}")
551
+ else:
552
+ print("⚠️ Invalid level; keeping existing console log level.")
553
+
534
554
  print("\n✅ Configuration complete! Run 'abstractcore --status' to see current settings.")
535
555
 
536
556
  def handle_commands(args) -> bool:
@@ -727,32 +747,44 @@ def handle_commands(args) -> bool:
727
747
  handled = True
728
748
 
729
749
  # Timeout configuration
730
- if args.set_default_timeout:
750
+ # #[WARNING:TIMEOUT]
751
+ if args.set_default_timeout is not None:
731
752
  try:
732
- config_manager.set_default_timeout(args.set_default_timeout)
753
+ ok = config_manager.set_default_timeout(args.set_default_timeout)
754
+ if not ok:
755
+ raise RuntimeError("Configuration update failed")
733
756
  # Format display (show in minutes if >= 60 seconds)
734
- if args.set_default_timeout >= 60:
757
+ if args.set_default_timeout <= 0:
758
+ display = "unlimited"
759
+ elif args.set_default_timeout >= 60:
735
760
  minutes = args.set_default_timeout / 60
736
761
  display = f"{minutes:.1f} minutes" if minutes != int(minutes) else f"{int(minutes)} minutes"
737
762
  else:
738
763
  display = f"{args.set_default_timeout} seconds"
739
- print(f" Set default HTTP timeout to: {display} ({args.set_default_timeout}s)")
740
- except ValueError as e:
741
- print(f"❌ Error: {e}")
764
+ suffix = "" if args.set_default_timeout <= 0 else f" ({args.set_default_timeout}s)"
765
+ print(f"✅ Set default HTTP timeout to: {display}{suffix}")
766
+ except Exception as e:
767
+ print(f"❌ Failed to set default HTTP timeout: {e}")
742
768
  handled = True
743
769
 
744
- if args.set_tool_timeout:
770
+ # #[WARNING:TIMEOUT]
771
+ if args.set_tool_timeout is not None:
745
772
  try:
746
- config_manager.set_tool_timeout(args.set_tool_timeout)
773
+ ok = config_manager.set_tool_timeout(args.set_tool_timeout)
774
+ if not ok:
775
+ raise RuntimeError("Configuration update failed")
747
776
  # Format display (show in minutes if >= 60 seconds)
748
- if args.set_tool_timeout >= 60:
777
+ if args.set_tool_timeout <= 0:
778
+ display = "unlimited"
779
+ elif args.set_tool_timeout >= 60:
749
780
  minutes = args.set_tool_timeout / 60
750
781
  display = f"{minutes:.1f} minutes" if minutes != int(minutes) else f"{int(minutes)} minutes"
751
782
  else:
752
783
  display = f"{args.set_tool_timeout} seconds"
753
- print(f" Set tool execution timeout to: {display} ({args.set_tool_timeout}s)")
754
- except ValueError as e:
755
- print(f"❌ Error: {e}")
784
+ suffix = "" if args.set_tool_timeout <= 0 else f" ({args.set_tool_timeout}s)"
785
+ print(f"✅ Set tool execution timeout to: {display}{suffix}")
786
+ except Exception as e:
787
+ print(f"❌ Failed to set tool execution timeout: {e}")
756
788
  handled = True
757
789
 
758
790
  return handled
@@ -795,7 +827,7 @@ COMMON TASKS:
795
827
 
796
828
  SPECIALIZED MODELS:
797
829
  abstractcore --set-chat-model openai/gpt-4o-mini # For chat applications
798
- abstractcore --set-code-model anthropic/claude-3-5-sonnet # For coding tasks
830
+ abstractcore --set-code-model anthropic/claude-haiku-4-5 # For coding tasks (cost-effective default)
799
831
 
800
832
  PRIORITY SYSTEM:
801
833
  1. Explicit parameters (highest): summarizer doc.pdf --provider openai --model gpt-4o
@@ -839,5 +871,5 @@ DOCUMENTATION: docs/centralized-config.md
839
871
 
840
872
 
841
873
  if __name__ == "__main__":
842
- logging.basicConfig(level=logging.INFO)
843
- sys.exit(main())
874
+ logging.basicConfig(level=logging.ERROR)
875
+ sys.exit(main())