mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
community[minor]: Add support for OVHcloud AI Endpoints Embedding (#22667)
**Description:** Add support for [OVHcloud AI Endpoints](https://endpoints.ai.cloud.ovh.net/) Embedding models. Inspired by: https://gist.github.com/gmasse/e1f99339e161f4830df6be5d0095349a Signed-off-by: Joffref <mariusjoffre@gmail.com>
This commit is contained in:
@@ -60,6 +60,7 @@ EXPECTED_ALL = [
|
||||
"JavelinAIGatewayEmbeddings",
|
||||
"OllamaEmbeddings",
|
||||
"OracleEmbeddings",
|
||||
"OVHCloudEmbeddings",
|
||||
"QianfanEmbeddingsEndpoint",
|
||||
"JohnSnowLabsEmbeddings",
|
||||
"VoyageEmbeddings",
|
||||
|
32
libs/community/tests/unit_tests/embeddings/test_ovhcloud.py
Normal file
32
libs/community/tests/unit_tests/embeddings/test_ovhcloud.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import pytest
|
||||
|
||||
from langchain_community.embeddings.ovhcloud import OVHCloudEmbeddings
|
||||
|
||||
|
||||
def test_ovhcloud_correct_instantiation() -> None:
|
||||
llm = OVHCloudEmbeddings(model_name="multilingual-e5-base")
|
||||
assert isinstance(llm, OVHCloudEmbeddings)
|
||||
|
||||
|
||||
def test_ovhcloud_empty_model_name_should_raise_error() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
OVHCloudEmbeddings(model_name="")
|
||||
|
||||
|
||||
def test_ovhcloud_empty_region_should_raise_error() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
OVHCloudEmbeddings(model_name="multilingual-e5-base", region="")
|
||||
|
||||
|
||||
def test_ovhcloud_empty_access_token_should_not_raise_error() -> None:
|
||||
llm = OVHCloudEmbeddings(
|
||||
model_name="multilingual-e5-base", region="kepler", access_token=""
|
||||
)
|
||||
assert isinstance(llm, OVHCloudEmbeddings)
|
||||
|
||||
|
||||
def test_ovhcloud_embed_documents() -> None:
|
||||
llm = OVHCloudEmbeddings(model_name="multilingual-e5-base")
|
||||
docs = ["Hello", "World"]
|
||||
output = llm.embed_documents(docs)
|
||||
assert len(output) == len(docs)
|
Reference in New Issue
Block a user