test_chat_models_standard.py — langchain Source File
Architecture documentation for test_chat_models_standard.py, a python file in the langchain codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6["test_chat_models_standard.py"] feec1ec4_6917_867b_d228_b134d0ff8099["typing"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> feec1ec4_6917_867b_d228_b134d0ff8099 f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 9444498b_8066_55c7_b3a2_1d90c4162a32["langchain_core.messages"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> 9444498b_8066_55c7_b3a2_1d90c4162a32 925d0a3b_d05c_e2d3_1510_b51a9462e17a["langchain_core.rate_limiters"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> 925d0a3b_d05c_e2d3_1510_b51a9462e17a 664afa6c_e6cb_4097_de9a_324d8f19a165["langchain_tests.integration_tests"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> 664afa6c_e6cb_4097_de9a_324d8f19a165 f85fae70_1011_eaec_151c_4083140ae9e5["typing_extensions"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> f85fae70_1011_eaec_151c_4083140ae9e5 9a564311_d7b3_0806_54ee_4cba04694f15["langchain_xai"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> 9a564311_d7b3_0806_54ee_4cba04694f15 e929cf21_6ab8_6ff3_3765_0d35a099a053["langchain_core.language_models"] f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 --> e929cf21_6ab8_6ff3_3765_0d35a099a053 style f4cd98f5_0a66_6c99_2ea5_53b70ad4ecb6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Standard LangChain interface tests"""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from langchain_core.messages import AIMessage
from langchain_core.rate_limiters import InMemoryRateLimiter
from langchain_tests.integration_tests import ( # type: ignore[import-not-found]
ChatModelIntegrationTests, # type: ignore[import-not-found]
)
from typing_extensions import override
from langchain_xai import ChatXAI
if TYPE_CHECKING:
from langchain_core.language_models import BaseChatModel
# Initialize the rate limiter in global scope, so it can be re-used across tests
rate_limiter = InMemoryRateLimiter(
requests_per_second=0.5,
)
MODEL_NAME = "grok-4-fast-reasoning"
class TestXAIStandard(ChatModelIntegrationTests):
@property
def chat_model_class(self) -> type[BaseChatModel]:
return ChatXAI
@property
def chat_model_params(self) -> dict:
return {
"model": MODEL_NAME,
"rate_limiter": rate_limiter,
}
@pytest.mark.xfail(
reason="Default model does not support stop sequences, using grok-3 instead"
)
@override
def test_stop_sequence(self, model: BaseChatModel) -> None:
"""Override to use `grok-3` which supports stop sequences."""
params = {**self.chat_model_params, "model": "grok-3"}
grok3_model = ChatXAI(**params)
result = grok3_model.invoke("hi", stop=["you"])
assert isinstance(result, AIMessage)
custom_model = ChatXAI(
**params,
stop_sequences=["you"],
)
result = custom_model.invoke("hi")
assert isinstance(result, AIMessage)
Domain
Subdomains
Functions
Classes
Dependencies
- langchain_core.language_models
- langchain_core.messages
- langchain_core.rate_limiters
- langchain_tests.integration_tests
- langchain_xai
- pytest
- typing
- typing_extensions
Source
Frequently Asked Questions
What does test_chat_models_standard.py do?
test_chat_models_standard.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, LanguageModelBase subdomain.
What functions are defined in test_chat_models_standard.py?
test_chat_models_standard.py defines 1 function(s): langchain_core.
What does test_chat_models_standard.py depend on?
test_chat_models_standard.py imports 8 module(s): langchain_core.language_models, langchain_core.messages, langchain_core.rate_limiters, langchain_tests.integration_tests, langchain_xai, pytest, typing, typing_extensions.
Where is test_chat_models_standard.py in the architecture?
test_chat_models_standard.py is located at libs/partners/xai/tests/integration_tests/test_chat_models_standard.py (domain: LangChainCore, subdomain: LanguageModelBase, directory: libs/partners/xai/tests/integration_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free