v2.18.0 (#843)
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:
parent
725d3a56ce
commit
e607ccbb00
242 changed files with 7372 additions and 1974 deletions
|
|
@ -2,8 +2,15 @@ from __future__ import annotations
|
|||
|
||||
from pathlib import Path
|
||||
|
||||
import keyring
|
||||
import pytest
|
||||
|
||||
from vibe.core.config import (
|
||||
DEFAULT_THEME,
|
||||
MissingAPIKeyError,
|
||||
ModelConfig,
|
||||
ProviderConfig,
|
||||
)
|
||||
from vibe.core.config._settings import VibeConfig
|
||||
from vibe.core.config.vibe_schema import VibeConfigSchema
|
||||
|
||||
|
|
@ -47,7 +54,7 @@ provider = "mistral"
|
|||
class VibeConfig(VibeConfigSchema):
|
||||
pass
|
||||
|
||||
layer = UserConfigLayer(path=toml_path, name="user-toml")
|
||||
layer = UserConfigLayer(path=toml_path)
|
||||
orchestrator = await ConfigOrchestrator[VibeConfig].create(
|
||||
schema=VibeConfig, layers=[layer]
|
||||
)
|
||||
|
|
@ -62,3 +69,43 @@ provider = "mistral"
|
|||
assert config.default_agent == "plan"
|
||||
assert "search" in config.enabled_skills
|
||||
assert config.enable_otel is True
|
||||
|
||||
|
||||
def test_duplicate_model_alias_raises() -> None:
|
||||
with pytest.raises(ValueError, match="Duplicate alias"):
|
||||
VibeConfigSchema(
|
||||
models=[
|
||||
ModelConfig(name="model-a", provider="mistral", alias="same"),
|
||||
ModelConfig(name="model-b", provider="mistral", alias="same"),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def test_compaction_model_provider_must_match_active() -> None:
|
||||
providers = [
|
||||
ProviderConfig(
|
||||
name="mistral",
|
||||
api_base="https://api.mistral.ai/v1",
|
||||
api_key_env_var="MISTRAL_API_KEY",
|
||||
),
|
||||
ProviderConfig(
|
||||
name="other",
|
||||
api_base="https://other.ai/v1",
|
||||
api_key_env_var="MISTRAL_API_KEY",
|
||||
),
|
||||
]
|
||||
compaction = ModelConfig(name="compact-model", provider="other", alias="compact")
|
||||
with pytest.raises(ValueError, match="must share the same provider"):
|
||||
VibeConfigSchema(compaction_model=compaction, providers=providers)
|
||||
|
||||
|
||||
def test_check_api_key_raises_when_missing(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.delenv("MISTRAL_API_KEY", raising=False)
|
||||
monkeypatch.setattr(keyring, "get_password", lambda service, username: None)
|
||||
with pytest.raises(MissingAPIKeyError):
|
||||
VibeConfigSchema()
|
||||
|
||||
|
||||
def test_unknown_theme_falls_back_to_default() -> None:
|
||||
config = VibeConfigSchema(theme="totally-unknown-theme")
|
||||
assert config.theme == DEFAULT_THEME
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue