Skip to content

Commit

Permalink
generate and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Dec 5, 2024
1 parent 069e808 commit b87ab01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"""Unit tests configuration module."""

from os import replace
import re
from typing import Any, Mapping, MutableMapping

import pytest
import vertexai
from google.auth.credentials import AnonymousCredentials
from vcr import VCR
from vcr.record_mode import RecordMode
from vcr.request import Request

from opentelemetry import trace
from opentelemetry.instrumentation.vertexai_v2 import VertexAIInstrumentor
Expand All @@ -17,11 +20,6 @@

pytest_plugins = []

import vertexai
from vcr import VCR
from vcr.record_mode import RecordMode
from vcr.request import Request


@pytest.fixture(scope="session")
def exporter():
Expand Down Expand Up @@ -81,7 +79,7 @@ def filter_headers(headers: Mapping[str, str]) -> Mapping[str, str]:
def before_record_cb(request: Request):
request.headers = filter_headers(request.headers)
request.uri = re.sub(
r"/projects/[^/]+/", f"/projects/fake-project/", request.uri
r"/projects/[^/]+/", "/projects/fake-project/", request.uri
)
return request

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@pytest.mark.vcr
def test_vertexai_generate_content(exporter):
multimodal_model = GenerativeModel("gemini-pro-vision")
response = multimodal_model.generate_content(
multimodal_model.generate_content(
[
Part.from_uri(
"gs://generativeai-downloads/images/scones.jpg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"library": "openai >= 1.26.0",
"instrumentation": "opentelemetry-instrumentation-openai-v2==2.1b0.dev",
},
{
"library": "google-cloud-aiplatform >= 1.64",
"instrumentation": "opentelemetry-instrumentation-vertexai-v2==2.1b0.dev",
},
{
"library": "aio_pika >= 7.2.0, < 10.0.0",
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.50b0.dev",
Expand Down

0 comments on commit b87ab01

Please sign in to comment.