Skip to content

Commit

Permalink
fix integration tests (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuligin authored Oct 29, 2024
1 parent 9a14132 commit 78f9643
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions libs/vertexai/tests/integration_tests/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)

_EMBEDDING_MODELS = [
("textembedding-gecko@004", 768),
("text-embedding-004", 768),
("multimodalembedding@001", 1408),
]

Expand All @@ -24,11 +24,11 @@ def test_initialization() -> None:
"""Test embedding model initialization."""
for embeddings in [
VertexAIEmbeddings(
model_name="textembedding-gecko",
model_name="text-embedding-004",
),
VertexAIEmbeddings(model="textembedding-gecko"),
VertexAIEmbeddings(model="text-embedding-004"),
]:
assert embeddings.model_name == "textembedding-gecko"
assert embeddings.model_name == "text-embedding-004"


@pytest.mark.release
Expand Down Expand Up @@ -65,22 +65,6 @@ def test_langchain_google_vertexai_embedding_query(model_name, embeddings_dim) -
assert len(output) == embeddings_dim


@pytest.mark.release
def test_langchain_google_vertexai_large_batches() -> None:
batch_size = 32
documents = ["foo bar" for _ in range(batch_size)]
model_uscentral1 = VertexAIEmbeddings(
model_name="textembedding-gecko@001", location="us-central1"
)
# model_asianortheast1 = VertexAIEmbeddings(
# model_name="textembedding-gecko@001", location="asia-northeast1"
# )
model_uscentral1.embed_documents(documents)
# model_asianortheast1.embed_documents(documents)
assert model_uscentral1.instance["batch_size"] >= batch_size
# assert model_asianortheast1.instance["batch_size"] < 50


@pytest.mark.release
@pytest.mark.parametrize(
"dim, expected_dim",
Expand All @@ -100,7 +84,7 @@ def test_langchain_google_vertexai_image_embeddings(

@pytest.mark.release
def test_langchain_google_vertexai_text_model() -> None:
embeddings_model = VertexAIEmbeddings(model_name="textembedding-gecko@004")
embeddings_model = VertexAIEmbeddings(model_name="text-embedding-004")
assert isinstance(embeddings_model.client, TextEmbeddingModel)
assert embeddings_model.model_type == GoogleEmbeddingModelType.TEXT

Expand Down

0 comments on commit 78f9643

Please sign in to comment.