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
  d02a85f7_0fde_b060_acea_db41314bde71["mock_completion()"]
  2edc9f83_2189_a9c8_70f5_10e2e98e8272["test_base.py"]
  d02a85f7_0fde_b060_acea_db41314bde71 -->|defined in| 2edc9f83_2189_a9c8_70f5_10e2e98e8272
  style d02a85f7_0fde_b060_acea_db41314bde71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/llms/test_base.py lines 262–272

def mock_completion() -> dict:
    return {
        "id": "cmpl-3evkmQda5Hu7fcZavknQda3SQ",
        "object": "text_completion",
        "created": 1689989000,
        "model": "gpt-3.5-turbo-instruct",
        "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/integration_tests/llms/test_base.py.
Where is mock_completion() defined?
mock_completion() is defined in libs/partners/openai/tests/integration_tests/llms/test_base.py at line 262.

Analyze Your Own Codebase

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

Try Supermodel Free