Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Oct 31, 2024
1 parent 827764b commit c2e9bd0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
9 changes: 0 additions & 9 deletions libs/vertexai/tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,3 @@ def base64_image() -> str:
"yuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UN"
"z8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII="
)


@pytest.fixture
def tmp_image(tmp_path_factory: TempPathFactory, base64_image) -> str:
img_data = base64.b64decode(base64_image.split(",")[1])
image = Image(image_bytes=img_data)
fn = tmp_path_factory.mktemp("data") / "img.png"
image.save(str(fn))
return str(fn)
11 changes: 0 additions & 11 deletions libs/vertexai/tests/integration_tests/test_chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,17 +1088,6 @@ def test_multimodal_pdf_input_url(multimodal_pdf_chain: RunnableSerializable) ->
assert isinstance(response, AIMessage)


@pytest.mark.release
def test_multimodal_pdf_input_local(multimodal_pdf_chain: RunnableSerializable) -> None:
url = "https://abc.xyz/assets/95/eb/9cef90184e09bac553796896c633/2023q4-alphabet-earnings-release.pdf"
request_response = requests.get(url, allow_redirects=True)

with tempfile.NamedTemporaryFile(suffix=".pdf") as localfile:
localfile.write(request_response.content)
response = multimodal_pdf_chain.invoke(dict(image=localfile.name))
assert isinstance(response, AIMessage)


@pytest.mark.release
def test_multimodal_pdf_input_b64(multimodal_pdf_chain: RunnableSerializable) -> None:
url = "https://abc.xyz/assets/95/eb/9cef90184e09bac553796896c633/2023q4-alphabet-earnings-release.pdf"
Expand Down
4 changes: 2 additions & 2 deletions libs/vertexai/tests/integration_tests/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def test_langchain_google_vertexai_embedding_query(model_name, embeddings_dim) -
[(None, 1408), (512, 512)],
)
def test_langchain_google_vertexai_image_embeddings(
dim, expected_dim, tmp_image
dim, expected_dim, base64_image
) -> None:
model = VertexAIEmbeddings(model_name="multimodalembedding")
kwargs = {}
if dim:
kwargs["dimensions"] = dim
output = model.embed_images([tmp_image for i in range(3)], **kwargs)
output = model.embed_images([base64_image for i in range(3)], **kwargs)
assert len(output) == 3
assert len(output[0]) == expected_dim

Expand Down

0 comments on commit c2e9bd0

Please sign in to comment.