Skip to content

The agent engineering platform.

together: Add rate limiter to integration tests (#24714)

Eugene Yurtsev03d62a737a80
diff --git a/libs/partners/together/tests/integration_tests/test_chat_models_standard.py b/libs/partners/together/tests/integration_tests/test_chat_models_standard.py
index 4397725837..2250873f4b 100644
--- a/libs/partners/together/tests/integration_tests/test_chat_models_standard.py
+++ b/libs/partners/together/tests/integration_tests/test_chat_models_standard.py
@@ -4,12 +4,17 @@ from typing import Type
import pytest
from langchain_core.language_models import BaseChatModel
-from langchain_standard_tests.integration_tests import ( # type: ignore[import-not-found]
- ChatModelIntegrationTests, # type: ignore[import-not-found]
-)
+from langchain_core.rate_limiters import InMemoryRateLimiter
+from langchain_standard_tests.integration_tests import ChatModelIntegrationTests
from langchain_together import ChatTogether
+# Initialize the rate limiter in global scope, so it can be re-used
+# across tests.
+rate_limiter = InMemoryRateLimiter(
+ requests_per_second=0.5,
+)
+
class TestTogetherStandard(ChatModelIntegrationTests):
@property
@@ -18,7 +23,10 @@ class TestTogetherStandard(ChatModelIntegrationTests):
@property
def chat_model_params(self) -> dict:
- return {"model": "mistralai/Mistral-7B-Instruct-v0.1"}
+ return {
+ "model": "mistralai/Mistral-7B-Instruct-v0.1",
+ "rate_limiter": rate_limiter,
+ }
@pytest.mark.xfail(reason=("May not call a tool."))
def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None: