mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +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
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user