mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 05:43:55 +00:00
Add support for calling HuggingFace embedding models using the HuggingFaceHub Inference API. New class mirrors the existing HuggingFaceHub LLM implementation. Currently only supports 'sentence-transformers' models. Closes #86
12 lines
392 B
Python
12 lines
392 B
Python
"""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")
|