Skip to content

The agent engineering platform.

Mask API keys for various LLM/ChatModel Modules (#13885)

Anas Khanb5acb91080d7
diff --git a/libs/community/tests/integration_tests/llms/test_edenai.py b/libs/community/tests/integration_tests/llms/test_edenai.py
index 5fbaa9fd06..3d8e0b9e23 100644
--- a/libs/community/tests/integration_tests/llms/test_edenai.py
+++ b/libs/community/tests/integration_tests/llms/test_edenai.py
@@ -9,6 +9,8 @@ clicking on the 'sandbox' toggle.
You'll then need to set EDENAI_API_KEY environment variable to your api key.
"""
+from langchain_core.pydantic_v1 import SecretStr
+
from langchain_community.llms import EdenAI
@@ -45,3 +47,13 @@ def test_edenai_call_with_old_params() -> None:
assert llm.feature == "text"
assert llm.subfeature == "generation"
assert isinstance(output, str)
+
+
+def test_api_key_is_secret_string() -> None:
+ llm = EdenAI(provider="openai", edenai_api_key="secret-api-key")
+ assert isinstance(llm.edenai_api_key, SecretStr)
+
+
+def test_uses_actual_secret_value() -> None:
+ llm = EdenAI(provider="openai", edenai_api_key="secret-api-key")
+ assert llm.edenai_api_key.get_secret_value() == "secret-api-key"