Skip to content

Commit

Permalink
vertexai[patch]: Release 2.0.7 (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan authored Oct 31, 2024
2 parents 845d0a0 + 1c4fcca commit a568e65
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 208 deletions.
348 changes: 169 additions & 179 deletions libs/vertexai/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions libs/vertexai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langchain-google-vertexai"
version = "2.0.6"
version = "2.0.7"
description = "An integration package connecting Google VertexAI and LangChain"
authors = []
readme = "README.md"
Expand All @@ -12,7 +12,7 @@ license = "MIT"

[tool.poetry.dependencies]
python = ">=3.9,<4.0"
langchain-core = ">=0.3.13,<0.4"
langchain-core = ">=0.3.15,<0.4"
google-cloud-aiplatform = "^1.70.0"
google-cloud-storage = "^2.18.0"
# optional dependencies
Expand Down
13 changes: 0 additions & 13 deletions libs/vertexai/tests/integration_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import base64

import pytest
from _pytest.tmpdir import TempPathFactory
from vertexai.vision_models import Image # type: ignore

_DEFAULT_MODEL_NAME = "gemini-1.0-pro-001"

Expand Down Expand Up @@ -30,12 +26,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)
12 changes: 0 additions & 12 deletions libs/vertexai/tests/integration_tests/test_chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io
import json
import os
import tempfile
from typing import List, Literal, Optional, cast

import pytest
Expand Down Expand Up @@ -1088,17 +1087,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
1 change: 1 addition & 0 deletions libs/vertexai/tests/unit_tests/test_function_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def search(question: str) -> str:
description="Search tool",
properties={"question": gapic.Schema(type=gapic.Type.STRING, title="Question")},
required=["question"],
property_ordering=["question"],
),
)

Expand Down

0 comments on commit a568e65

Please sign in to comment.