test_callable_api_key() — langchain Function Reference
Architecture documentation for the test_callable_api_key() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c4cfb93f_1d64_c598_66aa_806bbddf1c25["test_callable_api_key()"] 9bf2a9b0_094e_e5e3_a0fa_faa0fc8514e5["test_base.py"] c4cfb93f_1d64_c598_66aa_806bbddf1c25 -->|defined in| 9bf2a9b0_094e_e5e3_a0fa_faa0fc8514e5 style c4cfb93f_1d64_c598_66aa_806bbddf1c25 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/embeddings/test_base.py lines 75–90
def test_callable_api_key(monkeypatch: pytest.MonkeyPatch) -> None:
original_key = os.environ["OPENAI_API_KEY"]
calls = {"sync": 0}
def get_openai_api_key() -> str:
calls["sync"] += 1
return original_key
monkeypatch.delenv("OPENAI_API_KEY")
model = OpenAIEmbeddings(
model="text-embedding-3-small", dimensions=128, api_key=get_openai_api_key
)
_ = model.embed_query("hello")
assert calls["sync"] == 1
Domain
Subdomains
Source
Frequently Asked Questions
What does test_callable_api_key() do?
test_callable_api_key() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/embeddings/test_base.py.
Where is test_callable_api_key() defined?
test_callable_api_key() is defined in libs/partners/openai/tests/integration_tests/embeddings/test_base.py at line 75.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free