test_groq_serialization() — langchain Function Reference
Architecture documentation for the test_groq_serialization() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3371382c_4d20_9b70_da8a_f0cb7ab52264["test_groq_serialization()"] 5bf2e477_37e0_3e98_4042_bc609f2f7f60["test_chat_models.py"] 3371382c_4d20_9b70_da8a_f0cb7ab52264 -->|defined in| 5bf2e477_37e0_3e98_4042_bc609f2f7f60 style 3371382c_4d20_9b70_da8a_f0cb7ab52264 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/groq/tests/unit_tests/test_chat_models.py lines 268–293
def test_groq_serialization() -> None:
"""Test that ChatGroq can be successfully serialized and deserialized."""
api_key1 = "top secret"
api_key2 = "topest secret"
llm = ChatGroq(model="foo", api_key=api_key1, temperature=0.5) # type: ignore[call-arg, arg-type]
dump = lc_load.dumps(llm)
llm2 = lc_load.loads(
dump,
valid_namespaces=["langchain_groq"],
secrets_map={"GROQ_API_KEY": api_key2},
allowed_objects="all",
)
assert type(llm2) is ChatGroq
# Ensure api key wasn't dumped and instead was read from secret map.
assert llm.groq_api_key is not None
assert llm.groq_api_key.get_secret_value() not in dump
assert llm2.groq_api_key is not None
assert llm2.groq_api_key.get_secret_value() == api_key2
# Ensure a non-secret field was preserved
assert llm.temperature == llm2.temperature
# Ensure a None was preserved
assert llm.groq_api_base == llm2.groq_api_base
Domain
Subdomains
Source
Frequently Asked Questions
What does test_groq_serialization() do?
test_groq_serialization() is a function in the langchain codebase, defined in libs/partners/groq/tests/unit_tests/test_chat_models.py.
Where is test_groq_serialization() defined?
test_groq_serialization() is defined in libs/partners/groq/tests/unit_tests/test_chat_models.py at line 268.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free