neuralcad / tests /test_llm_adapter.py
CallMeDaniel's picture
feat: complete LLM adapter — enable function calling, add vision support
46a70e8
"""Tests for agents/llm_adapter.py."""
from agents.llm_adapter import NeuralCADLLMAdapter
class FakeBackend:
def generate(self, messages):
return "test response"
class FakeVisionBackend:
def generate(self, messages):
return "test response"
def generate_with_image(self, messages, image_path):
return "vision response"
class TestNeuralCADLLMAdapter:
def test_call_with_messages(self):
adapter = NeuralCADLLMAdapter(FakeBackend())
result = adapter.call([{"role": "user", "content": "hello"}])
assert result == "test response"
def test_call_with_string(self):
adapter = NeuralCADLLMAdapter(FakeBackend())
result = adapter.call("hello")
assert result == "test response"
def test_supports_function_calling(self):
adapter = NeuralCADLLMAdapter(FakeBackend())
assert adapter.supports_function_calling() is True
def test_supports_stop_words(self):
adapter = NeuralCADLLMAdapter(FakeBackend())
assert adapter.supports_stop_words() is False
def test_supports_vision_false(self):
adapter = NeuralCADLLMAdapter(FakeBackend())
assert adapter.supports_vision() is False
def test_supports_vision_true(self):
adapter = NeuralCADLLMAdapter(FakeVisionBackend())
assert adapter.supports_vision() is True