File size: 823 Bytes
c59d808 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import unittest
import os
from unittest.mock import patch
from backend.services.llm_service import llm_service
from backend.config.settings import settings
from backend.config.database import db_settings
class TestLLMService(unittest.TestCase):
@patch.dict(os.environ, {
'VECTOR_STORE_PROVIDER': 'chromadb',
'LLM_PROVIDER': 'google'
, })
def test_chat_completion(self):
"""
Test chat completions work, assuming proper config and API keys
"""
# reinitialize globals instance
settings.__init__()
db_settings.__init__()
llm_service.__init__()
response = llm_service.simple_chat_completion("Hello there 👋🏽")
print(response)
# There should be a better way to test this
self.assertTrue(len(response) > 0)
|