-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Community[patch]use secret str in Tavily and HuggingFaceInferenceEmbe…
…ddings (#16109) So the api keys don't show up in repr's Still need to do tests
- Loading branch information
Showing
5 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
libs/community/tests/unit_tests/embeddings/test_huggingface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from langchain_community.embeddings.huggingface import HuggingFaceInferenceAPIEmbeddings | ||
|
||
|
||
def test_hugginggface_inferenceapi_embedding_documents_init() -> None: | ||
"""Test huggingface embeddings.""" | ||
embedding = HuggingFaceInferenceAPIEmbeddings(api_key="abcd123") | ||
assert "abcd123" not in repr(embedding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from langchain_community.utilities.tavily_search import TavilySearchAPIWrapper | ||
|
||
|
||
def test_api_wrapper_api_key_not_visible() -> None: | ||
"""Test that an exception is raised if the API key is not present.""" | ||
wrapper = TavilySearchAPIWrapper(tavily_api_key="abcd123") | ||
assert "abcd123" not in repr(wrapper) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters