langroid 0.58.0__py3-none-any.whl → 0.58.1__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.
@@ -70,48 +70,58 @@ class ExaCrawlerConfig(BaseCrawlerConfig):
70
70
  env_prefix = "EXA_"
71
71
 
72
72
 
73
- def _resolve_crawl4ai_forward_refs(cls: Any) -> Any:
74
- """
75
- A class decorator that resolves forward references for fields in a Pydantic
76
- model that depend on the optional 'crawl4ai' library.
77
- """
78
- try:
79
- from crawl4ai.async_configs import BrowserConfig, CrawlerRunConfig # noqa: F401
80
- from crawl4ai.content_scraping_strategy import ( # noqa: F401
81
- ContentScrapingStrategy,
82
- )
83
- from crawl4ai.deep_crawling import DeepCrawlStrategy # noqa: F401
84
- from crawl4ai.extraction_strategy import ExtractionStrategy # noqa: F401
85
- from crawl4ai.markdown_generation_strategy import ( # noqa: F401
86
- MarkdownGenerationStrategy,
87
- )
88
-
89
- # Create a namespace dictionary from locals() but exclude 'cls'.
90
- # This prevents the TypeError.
91
- namespace = {name: value for name, value in locals().items() if name != "cls"}
92
- cls.update_forward_refs(**namespace)
93
-
94
- except ImportError:
95
- # If crawl4ai is not installed, do nothing.
96
- pass
97
- return cls
98
-
99
-
100
- @_resolve_crawl4ai_forward_refs
101
73
  class Crawl4aiConfig(BaseCrawlerConfig):
102
- """
103
- Configuration for the Crawl4aiCrawler.
104
- """
74
+ """Configuration for the Crawl4aiCrawler."""
105
75
 
106
76
  crawl_mode: Literal["simple", "deep"] = "simple"
107
77
  extraction_strategy: Optional["ExtractionStrategy"] = None
108
78
  markdown_strategy: Optional["MarkdownGenerationStrategy"] = None
109
79
  deep_crawl_strategy: Optional["DeepCrawlStrategy"] = None
110
80
  scraping_strategy: Optional["ContentScrapingStrategy"] = None
111
-
112
81
  browser_config: Optional["BrowserConfig"] = None
113
82
  run_config: Optional["CrawlerRunConfig"] = None
114
83
 
84
+ _refs_resolved: bool = False
85
+
86
+ def __init_subclass__(cls, **kwargs: Any) -> None:
87
+ """Resolve forward references when class is first subclassed or instantiated."""
88
+ super().__init_subclass__(**kwargs)
89
+ cls._resolve_forward_refs()
90
+
91
+ @classmethod
92
+ def _resolve_forward_refs(cls) -> None:
93
+ """Resolve forward references only when needed."""
94
+ if not cls._refs_resolved:
95
+ try:
96
+ from crawl4ai.async_configs import BrowserConfig, CrawlerRunConfig
97
+ from crawl4ai.content_scraping_strategy import ContentScrapingStrategy
98
+ from crawl4ai.deep_crawling import DeepCrawlStrategy
99
+ from crawl4ai.extraction_strategy import ExtractionStrategy
100
+ from crawl4ai.markdown_generation_strategy import (
101
+ MarkdownGenerationStrategy,
102
+ )
103
+
104
+ # Create namespace for update_forward_refs
105
+ namespace = {
106
+ "BrowserConfig": BrowserConfig,
107
+ "CrawlerRunConfig": CrawlerRunConfig,
108
+ "ContentScrapingStrategy": ContentScrapingStrategy,
109
+ "DeepCrawlStrategy": DeepCrawlStrategy,
110
+ "ExtractionStrategy": ExtractionStrategy,
111
+ "MarkdownGenerationStrategy": MarkdownGenerationStrategy,
112
+ }
113
+
114
+ cls.update_forward_refs(**namespace)
115
+ cls._refs_resolved = True
116
+ except ImportError:
117
+ # If crawl4ai is not installed, leave forward refs as strings
118
+ pass
119
+
120
+ def __init__(self, **kwargs: Any) -> None:
121
+ """Initialize and ensure forward refs are resolved."""
122
+ self._resolve_forward_refs()
123
+ super().__init__(**kwargs)
124
+
115
125
  class Config:
116
126
  arbitrary_types_allowed = True
117
127
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.58.0
3
+ Version: 0.58.1
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -347,6 +347,8 @@ teacher_task.run()
347
347
  <summary> <b>Click to expand</b></summary>
348
348
 
349
349
  - **Jul 2025:**
350
+ - [0.58.0](https://github.com/langroid/langroid/releases/tag/0.58.0) Crawl4AI integration -
351
+ browser-based web crawling with Playwright for JavaScript-heavy sites, no API key required (thank you @abab-dev!).
350
352
  - [0.57.0](https://github.com/langroid/langroid/releases/tag/0.57.0) HTML Logger for interactive task visualization -
351
353
  self-contained HTML logs with collapsible entries, auto-refresh, and persistent UI state.
352
354
  - **Jun 2025:**
@@ -102,7 +102,7 @@ langroid/parsing/routing.py,sha256=-FcnlqldzL4ZoxuDwXjQPNHgBe9F9-F4R6q7b_z9CvI,1
102
102
  langroid/parsing/search.py,sha256=0NJ5-Rou_BbrHAD7O9b20bKjZJnbadjObvGm4Zq8Kis,9818
103
103
  langroid/parsing/spider.py,sha256=hAVM6wxh1pQ0EN4tI5wMBtAjIk0T-xnpi-ZUzWybhos,3258
104
104
  langroid/parsing/table_loader.py,sha256=qNM4obT_0Y4tjrxNBCNUYjKQ9oETCZ7FbolKBTcz-GM,3410
105
- langroid/parsing/url_loader.py,sha256=E2PCxlHMKsNjn6HdQYkMgCMLJYaut-ALGVHXVVwyzbU,24721
105
+ langroid/parsing/url_loader.py,sha256=ELLSimgdf0-oscmtnDxXJcL-W9jVdLDNfQ90ouCDfHE,25402
106
106
  langroid/parsing/urls.py,sha256=Tjzr64YsCusiYkY0LEGB5-rSuX8T2P_4DVoOFKAeKuI,8081
107
107
  langroid/parsing/utils.py,sha256=WwqzOhbQRlorbVvddDIZKv9b1KqZCBDm955lgIHDXRw,12828
108
108
  langroid/parsing/web_search.py,sha256=atk8wIpOfiGTvW8yL_26TvjvyY2zD24xIHIi0QjEklI,8599
@@ -139,7 +139,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
139
139
  langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
140
140
  langroid/vector_store/qdrantdb.py,sha256=ZYrT9mxoUCx_67Qzb5xnkWuFG12rfe30yAg4NgG2ueA,19168
141
141
  langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
142
- langroid-0.58.0.dist-info/METADATA,sha256=cG1GUrTBX5XQUKLBT5f-3fnPr3j36xvRAf28K7UDUqM,66056
143
- langroid-0.58.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
144
- langroid-0.58.0.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
145
- langroid-0.58.0.dist-info/RECORD,,
142
+ langroid-0.58.1.dist-info/METADATA,sha256=mkfwCAdL_zIZxy4v12_ikK7AZLMmbHwwEkh_RJNt3QE,66270
143
+ langroid-0.58.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
144
+ langroid-0.58.1.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
145
+ langroid-0.58.1.dist-info/RECORD,,