Skip to content

Commit 29944ad

Browse files
authored
Vertexai fixes (#988)
* vertexai updates * lint * fix test * more obvious version placeholder in test
1 parent 3f6e5e4 commit 29944ad

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

plugins/vertexai/modelgauge/suts/vertexai_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _build_endpoint_url(self) -> str:
5757
project_fragment = f"projects/{self.project_id}"
5858
location_fragment = f"locations/{self.region}"
5959
specifier = "streamRawPredict" if self.streaming else "rawPredict"
60-
model_fragment = f"publishers/{self.publisher}/models/{self.model_name}@{self.model_version}"
60+
model_fragment = f"publishers/{self.publisher}/models/{self.model_name}-{self.model_version}"
6161
url = f"{base_url}{'/'.join([project_fragment, location_fragment, model_fragment])}:{specifier}"
6262
return url
6363

plugins/vertexai/modelgauge/suts/vertexai_mistral_sut.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ def client(self) -> VertexAIClient:
7474
return self._client
7575

7676
def translate_text_prompt(self, prompt: TextPrompt, options: SUTOptions) -> VertexAIMistralRequest:
77-
args = {"model": self.model_name, "messages": [{"role": _USER_ROLE, "content": prompt.text}]}
77+
args = {
78+
"model": f"{self.model_name}-{self.model_version}",
79+
"messages": [{"role": _USER_ROLE, "content": prompt.text}],
80+
}
7881
if options.temperature is not None:
7982
args["temperature"] = options.temperature
8083
if options.max_tokens is not None:
@@ -97,7 +100,7 @@ def translate_response(self, request: VertexAIMistralRequest, response: VertexAI
97100
VERTEX_REGION = InjectSecret(VertexAIRegion)
98101

99102
model_name = "mistral-large"
100-
model_version = "2407"
103+
model_version = "2411" # 2407 is no longer available.
101104
model_uid = f"vertexai-{model_name}-{model_version}"
102105
# If you prefer to use MistralAI, please see plugins/mistral
103106
# Authentication required using https://cloud.google.com/docs/authentication/application-default-credentials

plugins/vertexai/tests/test_vertexai_mistral_sut.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
VertexAIMistralResponse,
88
)
99

10+
VERSION = "1234"
11+
1012

1113
@pytest.fixture
1214
def req():
1315
return {
14-
"model": "mistral-large",
16+
"model": f"mistral-large-{VERSION}",
1517
"stream": False,
1618
"messages": [{"role": "user", "content": "Why did the chicken cross the road?"}],
1719
"safe_prompt": True,
@@ -46,9 +48,9 @@ def response():
4648
@pytest.fixture
4749
def sut():
4850
return VertexAIMistralAISut(
49-
"vertexai-mistral-large-2407",
51+
f"vertexai-mistral-large-{VERSION}",
5052
"mistral-large",
51-
"2407",
53+
VERSION,
5254
project_id=VertexAIProjectId("fake"),
5355
region=VertexAIRegion("us-central1"),
5456
)

0 commit comments

Comments
 (0)