mirror of
https://github.com/Cinnamon/kotaemon.git
synced 2025-12-16 11:47:48 +01:00
fix: update test case
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from openai.types.create_embedding_response import CreateEmbeddingResponse
|
||||
|
||||
@@ -159,18 +159,14 @@ def test_fastembed_embeddings():
|
||||
assert_embedding_result(output)
|
||||
|
||||
|
||||
voyage_output_mock = Mock()
|
||||
voyage_output_mock.embeddings = [[1.0, 2.1, 3.2]]
|
||||
|
||||
|
||||
@skip_when_voyageai_not_installed
|
||||
@patch(
|
||||
"voyageai.Client.embed",
|
||||
side_effect=lambda *args, **kwargs: [[1.0, 2.1, 3.2]],
|
||||
)
|
||||
@patch(
|
||||
"voyageai.AsyncClient.embed",
|
||||
side_effect=lambda *args, **kwargs: [[1.0, 2.1, 3.2]],
|
||||
)
|
||||
def test_voyageai_embeddings():
|
||||
model = VoyageAIEmbeddings()
|
||||
@patch("voyageai.Client.embed", return_value=voyage_output_mock)
|
||||
@patch("voyageai.AsyncClient.embed", return_value=voyage_output_mock)
|
||||
def test_voyageai_embeddings(sync_call, async_call):
|
||||
model = VoyageAIEmbeddings(api_key="test")
|
||||
output = model("Hello, world!")
|
||||
assert isinstance(output, list) and all(
|
||||
isinstance(doc, DocumentWithEmbedding) for doc in output
|
||||
)
|
||||
assert all(isinstance(doc, DocumentWithEmbedding) for doc in output)
|
||||
|
||||
Reference in New Issue
Block a user