Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Cyprien <courtot.c@gmail.com>
Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com>
Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com>
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: josephine-delas <57808586+josephine-delas@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Laure Hugo 2026-06-25 16:08:45 +02:00 committed by GitHub
parent 725d3a56ce
commit e607ccbb00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
242 changed files with 7372 additions and 1974 deletions

View file

@ -5,6 +5,7 @@ from unittest.mock import MagicMock, PropertyMock, patch
import pytest
from tests import constants as c
from vibe.core.config import ProviderConfig
from vibe.core.llm.backend.vertex import (
VertexAnthropicAdapter,
@ -32,8 +33,8 @@ def provider():
return ProviderConfig(
name="vertex",
api_base="",
project_id="test-project",
region="us-central1",
project_id=c.VERTEX_PROJECT_ID,
region=c.VERTEX_REGION,
api_style="vertex-anthropic",
)
@ -58,8 +59,8 @@ class TestBuildVertexEndpoint:
)
def test_base_url(self):
base = build_vertex_base_url("us-central1")
assert base == "https://us-central1-aiplatform.googleapis.com"
base = build_vertex_base_url(c.VERTEX_REGION)
assert base == c.VERTEX_BASE_URL
def test_global_endpoint(self):
endpoint = build_vertex_endpoint("global", "my-project", "claude-3-5-sonnet")
@ -96,7 +97,7 @@ class TestPrepareRequest:
assert req.headers["anthropic-beta"] == adapter.BETA_FEATURES
assert "rawPredict" in req.endpoint
assert "streamRawPredict" not in req.endpoint
assert req.base_url == "https://us-central1-aiplatform.googleapis.com"
assert req.base_url == c.VERTEX_BASE_URL
def test_streaming_request(self, adapter, provider):
messages = [LLMMessage(role=Role.user, content="Hello")]
@ -182,7 +183,7 @@ class TestPrepareRequest:
provider = ProviderConfig(
name="vertex",
api_base="",
region="us-central1",
region=c.VERTEX_REGION,
api_style="vertex-anthropic",
)
with pytest.raises(ValueError, match="project_id"):
@ -201,7 +202,7 @@ class TestPrepareRequest:
provider = ProviderConfig(
name="vertex",
api_base="",
project_id="test-project",
project_id=c.VERTEX_PROJECT_ID,
api_style="vertex-anthropic",
)
with pytest.raises(ValueError, match="region"):