Home / Function/ test_openai_api_key_accepts_callable() — langchain Function Reference

test_openai_api_key_accepts_callable() — langchain Function Reference

Architecture documentation for the test_openai_api_key_accepts_callable() function in test_secrets.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d7417f3b_e67d_a86f_e126_7cf918baa759["test_openai_api_key_accepts_callable()"]
  654b0dc2_a4de_700d_ff97_c27a5220678d["test_secrets.py"]
  d7417f3b_e67d_a86f_e126_7cf918baa759 -->|defined in| 654b0dc2_a4de_700d_ff97_c27a5220678d
  style d7417f3b_e67d_a86f_e126_7cf918baa759 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/test_secrets.py lines 191–199

def test_openai_api_key_accepts_callable(model_class: type) -> None:
    """Test that the API key can be passed as a callable."""

    def get_api_key() -> str:
        return "secret-api-key-from-callable"

    model = model_class(openai_api_key=get_api_key)
    assert callable(model.openai_api_key)
    assert model.openai_api_key() == "secret-api-key-from-callable"

Domain

Subdomains

Frequently Asked Questions

What does test_openai_api_key_accepts_callable() do?
test_openai_api_key_accepts_callable() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/test_secrets.py.
Where is test_openai_api_key_accepts_callable() defined?
test_openai_api_key_accepts_callable() is defined in libs/partners/openai/tests/unit_tests/test_secrets.py at line 191.

Analyze Your Own Codebase

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

Try Supermodel Free