knowledge-platform/tests/unit/test_index_profile.py

23 lines
662 B
Python

"""Tests for versioned index profile validation."""
import pytest
from ekp_domain import IndexProfile
def test_index_profile_accepts_demo_binding() -> None:
profile = IndexProfile(
profile_id="demo-bge-large-zh-structure-v1",
chunk_strategy_version="structure_v1",
embedding_model="bge-large-zh",
vector_dimension=1024,
)
assert profile.vector_dimension == 1024
@pytest.mark.parametrize("profile_id", ["", "bad profile", "bad'filter"])
def test_index_profile_rejects_unsafe_ids(profile_id: str) -> None:
with pytest.raises(ValueError):
IndexProfile(profile_id, "structure_v1", "bge-large-zh", 1024)