Home / Function/ mock_completion() — langchain Function Reference

mock_completion() — langchain Function Reference

Architecture documentation for the mock_completion() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  84ea93df_9e53_aa6e_f555_f5d7c50e451b["mock_completion()"]
  6395ab08_3ae5_72d1_1c6a_5b74f14238f7["test_base.py"]
  84ea93df_9e53_aa6e_f555_f5d7c50e451b -->|defined in| 6395ab08_3ae5_72d1_1c6a_5b74f14238f7
  style 84ea93df_9e53_aa6e_f555_f5d7c50e451b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/llms/test_base.py lines 52–62

def mock_completion() -> dict:
    return {
        "id": "cmpl-3evkmQda5Hu7fcZavknQda3SQ",
        "object": "text_completion",
        "created": 1689989000,
        "model": "text-davinci-003",
        "choices": [
            {"text": "Bar Baz", "index": 0, "logprobs": None, "finish_reason": "length"}
        ],
        "usage": {"prompt_tokens": 1, "completion_tokens": 2, "total_tokens": 3},
    }

Domain

Subdomains

Frequently Asked Questions

What does mock_completion() do?
mock_completion() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/llms/test_base.py.
Where is mock_completion() defined?
mock_completion() is defined in libs/partners/openai/tests/unit_tests/llms/test_base.py at line 52.

Analyze Your Own Codebase

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

Try Supermodel Free