mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 13:54:48 +00:00
together: Add rate limiter to integration tests (#24714)
Rate limit the integration tests to avoid getting 429s.
This commit is contained in:
parent
e00cc74926
commit
03d62a737a
@ -4,12 +4,17 @@ from typing import Type
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from langchain_core.language_models import BaseChatModel
|
from langchain_core.language_models import BaseChatModel
|
||||||
from langchain_standard_tests.integration_tests import ( # type: ignore[import-not-found]
|
from langchain_core.rate_limiters import InMemoryRateLimiter
|
||||||
ChatModelIntegrationTests, # type: ignore[import-not-found]
|
from langchain_standard_tests.integration_tests import ChatModelIntegrationTests
|
||||||
)
|
|
||||||
|
|
||||||
from langchain_together import ChatTogether
|
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):
|
class TestTogetherStandard(ChatModelIntegrationTests):
|
||||||
@property
|
@property
|
||||||
@ -18,7 +23,10 @@ class TestTogetherStandard(ChatModelIntegrationTests):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def chat_model_params(self) -> dict:
|
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."))
|
@pytest.mark.xfail(reason=("May not call a tool."))
|
||||||
def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:
|
def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user