feat: LLMClient protocol with Featherless and mock implementations

This commit is contained in:
Joseph Doherty
2026-04-26 11:35:57 -04:00
parent 67517926aa
commit e627356168
5 changed files with 80 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import pytest
from chat.llm.mock import MockLLMClient
from chat.llm.client import Message
@pytest.mark.asyncio
async def test_mock_returns_canned_response():
client = MockLLMClient(canned=["Hello, world."])
msgs = [Message(role="user", content="hi")]
out = await client.generate(msgs, model="any")
assert out == "Hello, world."
@pytest.mark.asyncio
async def test_mock_streams_tokens():
client = MockLLMClient(canned=["abcd"])
msgs = [Message(role="user", content="hi")]
chunks = []
async for chunk in client.stream(msgs, model="any"):
chunks.append(chunk)
assert "".join(chunks) == "abcd"