Home / Function/ mock_llm() — langchain Function Reference

mock_llm() — langchain Function Reference

Architecture documentation for the mock_llm() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  37830667_a341_ad95_f182_b0304af134a8["mock_llm()"]
  ab3fd66d_3ad7_be56_7427_66f2c1a9d0a8["test_chat_models.py"]
  37830667_a341_ad95_f182_b0304af134a8 -->|defined in| ab3fd66d_3ad7_be56_7427_66f2c1a9d0a8
  style 37830667_a341_ad95_f182_b0304af134a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/huggingface/tests/unit_tests/test_chat_models.py lines 23–37

def mock_llm() -> Mock:
    llm = Mock(spec=HuggingFaceEndpoint)
    llm.inference_server_url = "test endpoint url"
    llm.temperature = 0.7
    llm.max_new_tokens = 512
    llm.top_p = 0.9
    llm.seed = 42
    llm.streaming = True
    llm.repetition_penalty = 1.1
    llm.stop_sequences = ["</s>", "<|end|>"]
    llm.model_kwargs = {"do_sample": True, "top_k": 50}
    llm.server_kwargs = {"timeout": 120}
    llm.repo_id = "test/model"
    llm.model = "test/model"
    return llm

Domain

Subdomains

Frequently Asked Questions

What does mock_llm() do?
mock_llm() is a function in the langchain codebase, defined in libs/partners/huggingface/tests/unit_tests/test_chat_models.py.
Where is mock_llm() defined?
mock_llm() is defined in libs/partners/huggingface/tests/unit_tests/test_chat_models.py at line 23.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free