mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
7ce81eb6f4
Co-authored-by: fodizoltan <zoltan@conway.expert> Co-authored-by: Yujie Qian <thomasq0809@gmail.com> Co-authored-by: fzowl <160063452+fzowl@users.noreply.github.com>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""Test embedding model integration."""
|
|
|
|
from langchain_core.embeddings import Embeddings
|
|
|
|
from langchain_voyageai import VoyageAIEmbeddings
|
|
|
|
MODEL = "voyage-2"
|
|
|
|
|
|
def test_initialization_voyage_2() -> None:
|
|
"""Test embedding model initialization."""
|
|
emb = VoyageAIEmbeddings(voyage_api_key="NOT_A_VALID_KEY", model=MODEL)
|
|
assert isinstance(emb, Embeddings)
|
|
assert emb.batch_size == 72
|
|
assert emb.model == MODEL
|
|
assert emb._client is not None
|
|
|
|
|
|
def test_initialization_voyage_1() -> None:
|
|
"""Test embedding model initialization."""
|
|
emb = VoyageAIEmbeddings(voyage_api_key="NOT_A_VALID_KEY", model="voyage-01")
|
|
assert isinstance(emb, Embeddings)
|
|
assert emb.batch_size == 7
|
|
assert emb.model == "voyage-01"
|
|
assert emb._client is not None
|
|
|
|
|
|
def test_initialization_voyage_1_batch_size() -> None:
|
|
"""Test embedding model initialization."""
|
|
emb = VoyageAIEmbeddings(
|
|
voyage_api_key="NOT_A_VALID_KEY", model="voyage-01", batch_size=15
|
|
)
|
|
assert isinstance(emb, Embeddings)
|
|
assert emb.batch_size == 15
|
|
assert emb.model == "voyage-01"
|
|
assert emb._client is not None
|