plg4-dev-server / backend /tests /test_llm_service.py
Jesse Johnson
New commit for backend deployment: 2025-09-25_13-24-03
c59d808
raw
history blame contribute delete
823 Bytes
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)