Skip to content

Commit 6d7a50b

Browse files
authored
Remove community reports rate limiter (#2056)
* Remove hard-coded community reports rate limiter * Semver * Format * Add memory cache factory
1 parent 2bf7e7c commit 6d7a50b

File tree

4 files changed

+16
-46
lines changed

4 files changed

+16
-46
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "patch",
3+
"description": "Remove hard-coded community rate limiter."
4+
}

graphrag/cache/factory.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,19 @@ def create_cosmosdb_cache(**kwargs) -> PipelineCache:
9797
return JsonPipelineCache(storage)
9898

9999

100+
def create_noop_cache(**_kwargs) -> PipelineCache:
101+
"""Create a no-op cache implementation."""
102+
return NoopPipelineCache()
103+
104+
105+
def create_memory_cache(**kwargs) -> PipelineCache:
106+
"""Create a memory cache implementation."""
107+
return InMemoryCache(**kwargs)
108+
109+
100110
# --- register built-in cache implementations ---
101-
CacheFactory.register(CacheType.none.value, NoopPipelineCache)
102-
CacheFactory.register(CacheType.memory.value, InMemoryCache)
111+
CacheFactory.register(CacheType.none.value, create_noop_cache)
112+
CacheFactory.register(CacheType.memory.value, create_memory_cache)
103113
CacheFactory.register(CacheType.file.value, create_file_cache)
104114
CacheFactory.register(CacheType.blob.value, create_blob_cache)
105115
CacheFactory.register(CacheType.cosmosdb.value, create_cosmosdb_cache)

graphrag/index/operations/summarize_communities/strategies.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
Finding,
1717
StrategyConfig,
1818
)
19-
from graphrag.index.utils.rate_limiter import RateLimiter
2019
from graphrag.language_model.manager import ModelManager
2120
from graphrag.language_model.protocol.base import ChatModel
2221

@@ -51,8 +50,6 @@ async def _run_extractor(
5150
level: int,
5251
args: StrategyConfig,
5352
) -> CommunityReport | None:
54-
# RateLimiter
55-
rate_limiter = RateLimiter(rate=1, per=60)
5653
extractor = CommunityReportsExtractor(
5754
model,
5855
extraction_prompt=args.get("extraction_prompt", None),
@@ -63,7 +60,6 @@ async def _run_extractor(
6360
)
6461

6562
try:
66-
await rate_limiter.acquire()
6763
results = await extractor(input)
6864
report = results.structured_output
6965
if report is None:

graphrag/index/utils/rate_limiter.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)