"""Tests for FeatherlessClient (Phase 4.5+). Phase 4.5 adds an ``embed()`` method to the LLMClient Protocol (T112). Featherless does not expose an OpenAI-compatible ``/v1/embeddings`` endpoint, so its implementation deliberately raises ``NotImplementedError`` to surface the gap clearly. The ``generate_embedding`` wrapper catches this and degrades to the zero-vector fallback (the existing T107 warning path). If/when Featherless ships embeddings, swap the body for a real call to ``/v1/embeddings`` and update this test to mock the HTTP layer. """ from __future__ import annotations import pytest from chat.llm.featherless import FeatherlessClient @pytest.mark.asyncio async def test_featherless_embed_raises_not_implemented(): """Featherless does not expose ``/v1/embeddings`` — embed() must raise ``NotImplementedError`` so callers (``generate_embedding``) can degrade to the fallback zero vector + warning rather than silently producing useless output.""" client = FeatherlessClient(api_key="test-key") with pytest.raises(NotImplementedError) as excinfo: await client.embed("hello world", model="bge-small-en-v1.5") # Message should hint at the cause so operators see why their # real-model swap fell back. assert "embeddings" in str(excinfo.value).lower()