use json.dump

move test to integration tests (since it requires huggingface_hub)
This commit is contained in:
Harrison Chase
2022-11-27 13:03:09 -08:00
committed by GitHub
parent ae72cf84b8
commit b94244eb12
4 changed files with 10 additions and 13 deletions

View File

@@ -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")