Refactor: Move backend files to backend/ directory and split .gitignore

This commit is contained in:
Yunxiao Xu
2026-02-11 17:40:44 -08:00
parent 48924affa0
commit 7a69133e26
96 changed files with 144 additions and 176 deletions

View File

@@ -0,0 +1,19 @@
import pytest
from langchain_openai import ChatOpenAI
from ea_chatbot.config import LLMConfig
from ea_chatbot.utils.llm_factory import get_llm_model
from langchain_core.callbacks import BaseCallbackHandler
class MockHandler(BaseCallbackHandler):
pass
def test_get_llm_model_with_callbacks(monkeypatch):
"""Test that callbacks are passed to the model."""
monkeypatch.setenv("OPENAI_API_KEY", "dummy")
config = LLMConfig(provider="openai", model="gpt-4o")
handler = MockHandler()
model = get_llm_model(config, callbacks=[handler])
assert isinstance(model, ChatOpenAI)
assert handler in model.callbacks