You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
## Next
4
4
5
+
### Added
6
+
7
+
- Added automatic rate limiting with retry logic and exponential backoff for all Embedding providers using tenacity. The `RateLimitHandler` interface allows for custom rate limiting strategies, including the ability to disable rate limiting entirely.
Copy file name to clipboardExpand all lines: docs/source/user_guide_rag.rst
+33-2Lines changed: 33 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -327,7 +327,7 @@ Rate limiting is enabled by default for all LLM instances with the following con
327
327
.. code:: python
328
328
329
329
from neo4j_graphrag.llm import OpenAILLM
330
-
from neo4j_graphrag.llm.rate_limit import RetryRateLimitHandler
330
+
from neo4j_graphrag.utils.rate_limit import RetryRateLimitHandler
331
331
332
332
# Customize rate limiting parameters
333
333
llm = OpenAILLM(
@@ -348,7 +348,7 @@ You can customize the rate limiting behavior by creating your own rate limit han
348
348
.. code:: python
349
349
350
350
from neo4j_graphrag.llm import AnthropicLLM
351
-
from neo4j_graphrag.llm.rate_limit import RateLimitHandler
351
+
from neo4j_graphrag.utils.rate_limit import RateLimitHandler
352
352
353
353
classCustomRateLimitHandler(RateLimitHandler):
354
354
"""Implement your custom rate limiting strategy."""
@@ -528,6 +528,37 @@ The `OpenAIEmbeddings` was illustrated previously. Here is how to use the `Sente
528
528
529
529
If another embedder is desired, a custom embedder can be created, using the `Embedder` interface.
530
530
531
+
Embedder Rate Limiting
532
+
----------------------
533
+
534
+
All embedder implementations include automatic rate limiting that uses retry logic with exponential backoff by default, similar to LLM implementations. This feature helps handle API rate limits from embedding providers gracefully.
535
+
536
+
.. code:: python
537
+
538
+
from neo4j_graphrag.embeddings import OpenAIEmbeddings
539
+
from neo4j_graphrag.utils.rate_limit import RetryRateLimitHandler, NoOpRateLimitHandler
The rate limiting configuration works the same way as for LLMs. See the :ref:`Rate Limit Handling <Rate Limit Handling>` section above for more details on customization options.
0 commit comments