test_create_chat_result() — langchain Function Reference
Architecture documentation for the test_create_chat_result() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 4dc8644e_8055_ea48_403f_c80244861c16["test_create_chat_result()"] ab3fd66d_3ad7_be56_7427_66f2c1a9d0a8["test_chat_models.py"] 4dc8644e_8055_ea48_403f_c80244861c16 -->|defined in| ab3fd66d_3ad7_be56_7427_66f2c1a9d0a8 style 4dc8644e_8055_ea48_403f_c80244861c16 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/huggingface/tests/unit_tests/test_chat_models.py lines 48–66
def test_create_chat_result(chat_hugging_face: Any) -> None:
mock_response = {
"choices": [
{
"message": {"role": "assistant", "content": "test message"},
"finish_reason": "test finish reason",
}
],
"usage": {"tokens": 420},
}
result = chat_hugging_face._create_chat_result(mock_response)
assert isinstance(result, ChatResult)
assert result.generations[0].message.content == "test message"
assert (
result.generations[0].generation_info["finish_reason"] == "test finish reason" # type: ignore[index]
)
assert result.llm_output["token_usage"]["tokens"] == 420 # type: ignore[index]
assert result.llm_output["model_name"] == chat_hugging_face.model_id # type: ignore[index]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_create_chat_result() do?
test_create_chat_result() is a function in the langchain codebase, defined in libs/partners/huggingface/tests/unit_tests/test_chat_models.py.
Where is test_create_chat_result() defined?
test_create_chat_result() is defined in libs/partners/huggingface/tests/unit_tests/test_chat_models.py at line 48.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free