# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
# Issues & docs: https://github.com/kreuzberg-dev/alef

"""E2e tests for category: embeddings."""

import pytest  # noqa: F401
from kreuzberg import embed_texts, get_embedding_preset, list_embedding_presets, ExtractionConfig


def _alef_e2e_text(value: object) -> str:
    return "" if value is None else str(value)


def _alef_e2e_item_texts(item: object) -> tuple[str, ...]:
    raw_items = getattr(item, "items", None)
    items_text = " ".join(str(value) for value in raw_items) if isinstance(raw_items, list) else ""
    return (
        _alef_e2e_text(item),
        _alef_e2e_text(getattr(item, "kind", None)),
        _alef_e2e_text(getattr(item, "name", None)),
        _alef_e2e_text(getattr(item, "source", None)),
        _alef_e2e_text(getattr(item, "alias", None)),
        _alef_e2e_text(getattr(item, "text", None)),
        _alef_e2e_text(getattr(item, "signature", None)),
        items_text,
    )


def test_embed_texts_different_preset() -> None:
    """embed_texts: multilingual preset."""
    texts = ["Hello world", "Test"]
    config = ExtractionConfig(model={"name": "multilingual", "type": "preset"})

    result = embed_texts(texts, config)
    assert len(result) >= 2  # noqa: S101


def test_get_embedding_preset_known() -> None:
    """get_embedding_preset: known preset."""
    name = "balanced"

    _ = get_embedding_preset(name)


def test_get_embedding_preset_nominal() -> None:
    """get_embedding_preset: nominal case."""
    name = "balanced"

    _ = get_embedding_preset(name)


def test_get_embedding_preset_unknown() -> None:
    """get_embedding_preset: unknown preset fails."""
    name = "nonexistent-xyz"

    result = get_embedding_preset(name)
    assert not result  # noqa: S101


def test_list_embedding_presets_sanity() -> None:
    """list_embedding_presets: returns at least one."""
    result = list_embedding_presets()
    assert result  # noqa: S101
