test_secrets.py — langchain Source File
Architecture documentation for test_secrets.py, a python file in the langchain codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 075c4495_3b5d_c137_572d_fa98635f6b23["test_secrets.py"] 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 075c4495_3b5d_c137_572d_fa98635f6b23 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 075c4495_3b5d_c137_572d_fa98635f6b23 --> 120e2591_3e15_b895_72b6_cb26195e40a6 36cce5da_d805_04c3_7e86_e1b4dd49b497["langchain_core.load"] 075c4495_3b5d_c137_572d_fa98635f6b23 --> 36cce5da_d805_04c3_7e86_e1b4dd49b497 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"] 075c4495_3b5d_c137_572d_fa98635f6b23 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7 0b28cff6_d823_1571_d2bb_ec61508cc89c["langchain_openai"] 075c4495_3b5d_c137_572d_fa98635f6b23 --> 0b28cff6_d823_1571_d2bb_ec61508cc89c style 075c4495_3b5d_c137_572d_fa98635f6b23 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import cast
import pytest
from langchain_core.load import dumpd
from pydantic import SecretStr
from pytest import CaptureFixture, MonkeyPatch
from langchain_openai import (
AzureChatOpenAI,
AzureOpenAI,
AzureOpenAIEmbeddings,
ChatOpenAI,
OpenAI,
OpenAIEmbeddings,
)
AZURE_AD_TOKEN = "secret-api-key" # noqa: S105
def test_chat_openai_secrets() -> None:
o = ChatOpenAI(openai_api_key="foo") # type: ignore[call-arg]
s = str(o)
assert "foo" not in s
def test_openai_secrets() -> None:
o = OpenAI(openai_api_key="foo") # type: ignore[call-arg]
s = str(o)
assert "foo" not in s
def test_openai_embeddings_secrets() -> None:
o = OpenAIEmbeddings(openai_api_key="foo") # type: ignore[call-arg]
s = str(o)
assert "foo" not in s
def test_azure_chat_openai_secrets() -> None:
o = AzureChatOpenAI( # type: ignore[call-arg]
openai_api_key="foo1",
azure_endpoint="endpoint",
azure_ad_token=AZURE_AD_TOKEN, # type: ignore[arg-type]
api_version="version",
)
s = str(o)
assert "foo1" not in s
assert "foo2" not in s
def test_azure_openai_secrets() -> None:
o = AzureOpenAI( # type: ignore[call-arg]
openai_api_key="foo1",
azure_endpoint="endpoint",
azure_ad_token=AZURE_AD_TOKEN, # type: ignore[arg-type]
api_version="version",
)
s = str(o)
assert "foo1" not in s
assert "foo2" not in s
// ... (156 more lines)
Domain
Subdomains
Functions
- test_azure_chat_openai_secrets()
- test_azure_openai_api_key_is_secret_string()
- test_azure_openai_api_key_masked_when_passed_from_env()
- test_azure_openai_api_key_masked_when_passed_via_constructor()
- test_azure_openai_embeddings_secrets()
- test_azure_openai_secrets()
- test_azure_openai_uses_actual_secret_value_from_secretstr()
- test_azure_serialized_secrets()
- test_chat_openai_secrets()
- test_openai_api_key_accepts_callable()
- test_openai_api_key_is_secret_string()
- test_openai_api_key_masked_when_passed_from_env()
- test_openai_api_key_masked_when_passed_via_constructor()
- test_openai_embeddings_secrets()
- test_openai_secrets()
- test_openai_uses_actual_secret_value_from_secretstr()
Dependencies
- langchain_core.load
- langchain_openai
- pydantic
- pytest
- typing
Source
Frequently Asked Questions
What does test_secrets.py do?
test_secrets.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in test_secrets.py?
test_secrets.py defines 16 function(s): test_azure_chat_openai_secrets, test_azure_openai_api_key_is_secret_string, test_azure_openai_api_key_masked_when_passed_from_env, test_azure_openai_api_key_masked_when_passed_via_constructor, test_azure_openai_embeddings_secrets, test_azure_openai_secrets, test_azure_openai_uses_actual_secret_value_from_secretstr, test_azure_serialized_secrets, test_chat_openai_secrets, test_openai_api_key_accepts_callable, and 6 more.
What does test_secrets.py depend on?
test_secrets.py imports 5 module(s): langchain_core.load, langchain_openai, pydantic, pytest, typing.
Where is test_secrets.py in the architecture?
test_secrets.py is located at libs/partners/openai/tests/unit_tests/test_secrets.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/partners/openai/tests/unit_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free