v2.18.2 (#857)
Co-authored-by: Cyprien <courtot.c@gmail.com> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Laure Hugo <201583486+laure0303@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Peter Evers <peter.evers@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Yousria <yousria.debaud@mistral.ai> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
ed5b7192e6
commit
d50704e694
110 changed files with 1663 additions and 764 deletions
|
|
@ -4,9 +4,16 @@ import pytest
|
|||
|
||||
from tests.constants import ANTHROPIC_BASE_URL
|
||||
from vibe.core.config import OtelSpanExporterConfig, ProviderConfig, VibeConfig
|
||||
from vibe.core.tracing import build_otel_span_exporter_config
|
||||
from vibe.core.types import Backend
|
||||
|
||||
|
||||
def _exporter_config(config: VibeConfig) -> OtelSpanExporterConfig | None:
|
||||
return build_otel_span_exporter_config(
|
||||
config.otel_endpoint, config.get_mistral_provider()
|
||||
)
|
||||
|
||||
|
||||
class TestOtelSpanExporterConfig:
|
||||
def test_derives_endpoint_from_mistral_provider(
|
||||
self, vibe_config: VibeConfig, monkeypatch: pytest.MonkeyPatch
|
||||
|
|
@ -23,7 +30,7 @@ class TestOtelSpanExporterConfig:
|
|||
]
|
||||
}
|
||||
)
|
||||
result = config.otel_span_exporter_config
|
||||
result = _exporter_config(config)
|
||||
assert result is not None
|
||||
assert result.endpoint == "https://customer.mistral.ai/telemetry/v1/traces"
|
||||
assert result.headers == {"Authorization": "Bearer sk-test"}
|
||||
|
|
@ -50,7 +57,7 @@ class TestOtelSpanExporterConfig:
|
|||
]
|
||||
}
|
||||
)
|
||||
result = config.otel_span_exporter_config
|
||||
result = _exporter_config(config)
|
||||
assert result is not None
|
||||
assert result.endpoint == "https://eu.mistral.ai/telemetry/v1/traces"
|
||||
assert result.headers == {"Authorization": "Bearer sk-eu"}
|
||||
|
|
@ -68,7 +75,7 @@ class TestOtelSpanExporterConfig:
|
|||
]
|
||||
}
|
||||
)
|
||||
result = config.otel_span_exporter_config
|
||||
result = _exporter_config(config)
|
||||
assert result is not None
|
||||
assert result.endpoint == "https://api.mistral.ai/telemetry/v1/traces"
|
||||
assert result.headers == {"Authorization": "Bearer sk-fallback"}
|
||||
|
|
@ -77,7 +84,7 @@ class TestOtelSpanExporterConfig:
|
|||
self, vibe_config: VibeConfig, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
monkeypatch.setenv("MISTRAL_API_KEY", "sk-default")
|
||||
result = vibe_config.otel_span_exporter_config
|
||||
result = _exporter_config(vibe_config)
|
||||
assert result is not None
|
||||
assert result.endpoint == "https://api.mistral.ai/telemetry/v1/traces"
|
||||
|
||||
|
|
@ -89,7 +96,7 @@ class TestOtelSpanExporterConfig:
|
|||
monkeypatch.setattr(
|
||||
"keyring.get_password", lambda service, username: "sk-keyring"
|
||||
)
|
||||
result = vibe_config.otel_span_exporter_config
|
||||
result = _exporter_config(vibe_config)
|
||||
assert result is not None
|
||||
assert result.headers == {"Authorization": "Bearer sk-keyring"}
|
||||
|
||||
|
|
@ -101,7 +108,7 @@ class TestOtelSpanExporterConfig:
|
|||
) -> None:
|
||||
monkeypatch.delenv("MISTRAL_API_KEY", raising=False)
|
||||
with caplog.at_level("WARNING"):
|
||||
assert vibe_config.otel_span_exporter_config is None
|
||||
assert _exporter_config(vibe_config) is None
|
||||
assert "OTEL tracing enabled but MISTRAL_API_KEY is not set" in caplog.text
|
||||
|
||||
def test_custom_api_key_env_var(
|
||||
|
|
@ -121,7 +128,7 @@ class TestOtelSpanExporterConfig:
|
|||
]
|
||||
}
|
||||
)
|
||||
result = config.otel_span_exporter_config
|
||||
result = _exporter_config(config)
|
||||
assert result is not None
|
||||
assert result.endpoint == "https://onprem.corp.com/telemetry/v1/traces"
|
||||
assert result.headers == {"Authorization": "Bearer sk-custom"}
|
||||
|
|
@ -132,7 +139,7 @@ class TestOtelSpanExporterConfig:
|
|||
config = vibe_config.model_copy(
|
||||
update={"otel_endpoint": "https://my-collector:4318"}
|
||||
)
|
||||
result = config.otel_span_exporter_config
|
||||
result = _exporter_config(config)
|
||||
assert result is not None
|
||||
assert result == OtelSpanExporterConfig(
|
||||
endpoint="https://my-collector:4318/v1/traces"
|
||||
|
|
@ -145,7 +152,7 @@ class TestOtelSpanExporterConfig:
|
|||
config = vibe_config.model_copy(
|
||||
update={"otel_endpoint": "https://my-collector:4318/api/public/otel"}
|
||||
)
|
||||
result = config.otel_span_exporter_config
|
||||
result = _exporter_config(config)
|
||||
assert result is not None
|
||||
assert result == OtelSpanExporterConfig(
|
||||
endpoint="https://my-collector:4318/api/public/otel/v1/traces"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ async def test_reads_env_vars() -> None:
|
|||
env = {
|
||||
"MISTRAL_API_KEY": "test-key",
|
||||
"VIBE_ACTIVE_MODEL": "mistral-large",
|
||||
"VIBE_VIM_KEYBINDINGS": "true",
|
||||
"VIBE_DISABLE_WELCOME_BANNER_ANIMATION": "true",
|
||||
"VIBE_ENABLE_TELEMETRY": "0",
|
||||
"VIBE_UNKNOWN_VAR": "ignored",
|
||||
"VIBE_SESSION_LOGGING__ENABLED": "false",
|
||||
|
|
@ -27,7 +27,7 @@ async def test_reads_env_vars() -> None:
|
|||
|
||||
assert data.model_dump() == {
|
||||
"active_model": "mistral-large",
|
||||
"vim_keybindings": True,
|
||||
"disable_welcome_banner_animation": True,
|
||||
"enable_telemetry": False,
|
||||
"session_logging": {"enabled": False, "session_prefix": "mysession"},
|
||||
"api_timeout": 0.12,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ async def test_full_toml_to_vibe_config_schema(tmp_path: Path) -> None:
|
|||
toml_path = tmp_path / "config.toml"
|
||||
toml_path.write_text(
|
||||
"""\
|
||||
vim_keybindings = true
|
||||
disable_welcome_banner_animation = true
|
||||
api_timeout = 300.0
|
||||
api_retry_max_elapsed_time = 120.0
|
||||
active_model = "codestral"
|
||||
|
|
@ -60,7 +60,7 @@ provider = "mistral"
|
|||
)
|
||||
config = orchestrator.config
|
||||
|
||||
assert config.vim_keybindings is True
|
||||
assert config.disable_welcome_banner_animation is True
|
||||
assert config.api_timeout == 300.0
|
||||
assert config.api_retry_max_elapsed_time == 120.0
|
||||
assert config.active_model == "codestral"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue