Skip to content

The agent engineering platform.

nits (#210)

Harrison Chaseb94244eb12d8
diff --git a/langchain/prompts/base.py b/langchain/prompts/base.py
index 5090acc313..26b6cc2311 100644
--- a/langchain/prompts/base.py
+++ b/langchain/prompts/base.py
@@ -94,7 +94,7 @@ class BasePromptTemplate(BaseModel, ABC):
if save_path.suffix == ".json":
with open(file_path, "w") as f:
- f.write(json.dumps(prompt_dict, indent=4))
+ json.dump(prompt_dict, f, indent=4)
elif save_path.suffix == ".yaml":
with open(file_path, "w") as f:
yaml.dump(prompt_dict, f, default_flow_style=False)
diff --git a/tests/integration_tests/embeddings/test_huggingface_hub.py b/tests/integration_tests/embeddings/test_huggingface_hub.py
index ed57bcccd8..42dd55dbe6 100644
--- a/tests/integration_tests/embeddings/test_huggingface_hub.py
+++ b/tests/integration_tests/embeddings/test_huggingface_hub.py
@@ -1,4 +1,6 @@
"""Test HuggingFaceHub embeddings."""
+import pytest
+
from langchain.embeddings import HuggingFaceHubEmbeddings
@@ -17,3 +19,10 @@ def test_huggingfacehub_embedding_query() -> None:
embedding = HuggingFaceHubEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 768
+
+
+def test_huggingfacehub_embedding_invalid_repo() -> None:
+ """Test huggingfacehub embedding repo id validation."""
+ # Only sentence-transformers models are currently supported.
+ with pytest.raises(ValueError):
+ HuggingFaceHubEmbeddings(repo_id="allenai/specter")
diff --git a/tests/unit_tests/embeddings/__init__.py b/tests/unit_tests/embeddings/__init__.py
deleted file mode 100644
index 9aaef73a02..0000000000
--- a/tests/unit_tests/embeddings/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""All unit tests for Embeddings objects."""
diff --git a/tests/unit_tests/embeddings/test_huggingface_hub.py b/tests/unit_tests/embeddings/test_huggingface_hub.py
deleted file mode 100644
index ecc1fbfbe2..0000000000
--- a/tests/unit_tests/embeddings/test_huggingface_hub.py
+++ /dev/null
@@ -1,11 +0,0 @@
-"""Test HuggingFaceHub embeddings."""
-import pytest
-
-from langchain.embeddings import HuggingFaceHubEmbeddings
-
-
-def test_huggingfacehub_embedding_invalid_repo() -> None:
- """Test huggingfacehub embedding repo id validation."""
- # Only sentence-transformers models are currently supported.
- with pytest.raises(ValueError):
- HuggingFaceHubEmbeddings(repo_id="allenai/specter")