test_chat_models.py — langchain Source File
Architecture documentation for test_chat_models.py, a python file in the langchain codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR af57ae60_607e_c138_9ab0_fb8bb1c5916a["test_chat_models.py"] 9d14ea65_8b2e_6721_a947_acc89905651f["json"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> 9d14ea65_8b2e_6721_a947_acc89905651f feec1ec4_6917_867b_d228_b134d0ff8099["typing"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> feec1ec4_6917_867b_d228_b134d0ff8099 f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 09a7199c_6809_d2b2_24c9_76fda6ada2c0["groq"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> 09a7199c_6809_d2b2_24c9_76fda6ada2c0 9444498b_8066_55c7_b3a2_1d90c4162a32["langchain_core.messages"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> 9444498b_8066_55c7_b3a2_1d90c4162a32 4382dc25_6fba_324a_49e2_e9742d579385["langchain_core.outputs"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> 4382dc25_6fba_324a_49e2_e9742d579385 dd5e7909_a646_84f1_497b_cae69735550e["pydantic"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> dd5e7909_a646_84f1_497b_cae69735550e 2e128b5f_0a0c_044b_0292_0c258c8459b6["langchain_groq"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> 2e128b5f_0a0c_044b_0292_0c258c8459b6 251bfb01_1c7e_1133_a3e7_d13a513891ea["tests.unit_tests.fake.callbacks"] af57ae60_607e_c138_9ab0_fb8bb1c5916a --> 251bfb01_1c7e_1133_a3e7_d13a513891ea style af57ae60_607e_c138_9ab0_fb8bb1c5916a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Test ChatGroq chat model."""
from __future__ import annotations
import json
from typing import Any, cast
import pytest
from groq import BadRequestError
from langchain_core.messages import (
AIMessage,
AIMessageChunk,
BaseMessage,
BaseMessageChunk,
HumanMessage,
SystemMessage,
)
from langchain_core.outputs import ChatGeneration, LLMResult
from pydantic import BaseModel, Field
from langchain_groq import ChatGroq
from tests.unit_tests.fake.callbacks import (
FakeCallbackHandler,
FakeCallbackHandlerWithChatStart,
)
DEFAULT_MODEL_NAME = "openai/gpt-oss-20b"
# gpt-oss doesn't support `reasoning_effort`
REASONING_MODEL_NAME = "qwen/qwen3-32b"
#
# Smoke test Runnable interface
#
@pytest.mark.scheduled
def test_invoke() -> None:
"""Test Chat wrapper."""
chat = ChatGroq(
model=DEFAULT_MODEL_NAME,
temperature=0.7,
base_url=None,
groq_proxy=None,
timeout=10.0,
max_retries=3,
http_client=None,
n=1,
max_tokens=10,
default_headers=None,
default_query=None,
)
message = HumanMessage(content="Welcome to the Groqetship")
response = chat.invoke([message])
assert isinstance(response, BaseMessage)
assert isinstance(response.content, str)
@pytest.mark.scheduled
async def test_ainvoke() -> None:
"""Test ainvoke tokens from ChatGroq."""
// ... (762 more lines)
Domain
Subdomains
Functions
- test_abatch()
- test_agenerate()
- test_agenerate_streaming()
- test_ainvoke()
- test_astream()
- test_astreaming_tool_call()
- test_batch()
- test_code_interpreter()
- test_code_interpreter_v1()
- test_generate()
- test_invoke()
- test_invoke_streaming()
- test_json_mode_structured_output()
- test_reasoning_effort_invoke_override()
- test_reasoning_effort_invoke_override_different_level()
- test_reasoning_effort_levels()
- test_reasoning_effort_none()
- test_reasoning_effort_streaming()
- test_reasoning_output_invoke()
- test_reasoning_output_stream()
- test_setting_service_tier_class()
- test_setting_service_tier_request()
- test_setting_service_tier_request_async()
- test_setting_service_tier_streaming()
- test_stream()
- test_streaming_generation_info()
- test_streaming_tool_call()
- test_system_message()
- test_tool_choice()
- test_tool_choice_bool()
- test_web_search()
- test_web_search_v1()
Classes
Dependencies
- groq
- json
- langchain_core.messages
- langchain_core.outputs
- langchain_groq
- pydantic
- pytest
- tests.unit_tests.fake.callbacks
- typing
Source
Frequently Asked Questions
What does test_chat_models.py do?
test_chat_models.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.py?
test_chat_models.py defines 32 function(s): test_abatch, test_agenerate, test_agenerate_streaming, test_ainvoke, test_astream, test_astreaming_tool_call, test_batch, test_code_interpreter, test_code_interpreter_v1, test_generate, and 22 more.
What does test_chat_models.py depend on?
test_chat_models.py imports 9 module(s): groq, json, langchain_core.messages, langchain_core.outputs, langchain_groq, pydantic, pytest, tests.unit_tests.fake.callbacks, and 1 more.
Where is test_chat_models.py in the architecture?
test_chat_models.py is located at libs/partners/groq/tests/integration_tests/test_chat_models.py (domain: LangChainCore, subdomain: LanguageModelBase, directory: libs/partners/groq/tests/integration_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free