|
19 | 19 | wait_exponential, |
20 | 20 | ) |
21 | 21 |
|
22 | | -from .settings import get_plugin_settings |
| 22 | +from .settings import ChatbotSettings, get_plugin_settings |
23 | 23 |
|
24 | 24 | _logger = logging.getLogger(__name__) |
25 | 25 |
|
@@ -61,9 +61,10 @@ def _chatbot_retry(): |
61 | 61 |
|
62 | 62 |
|
63 | 63 | class ChatbotRestClient: |
64 | | - def __init__(self, base_url: str) -> None: |
| 64 | + def __init__(self, base_url: str, chatbot_settings: ChatbotSettings) -> None: |
65 | 65 | self._client = httpx.AsyncClient() |
66 | 66 | self._base_url = base_url |
| 67 | + self._chatbot_settings = chatbot_settings |
67 | 68 |
|
68 | 69 | async def get_settings(self) -> dict[str, Any]: |
69 | 70 | """Fetches chatbot settings""" |
@@ -94,8 +95,8 @@ async def _request() -> httpx.Response: |
94 | 95 | url, |
95 | 96 | json={ |
96 | 97 | "question": question, |
97 | | - "llm": "gpt-3.5-turbo", |
98 | | - "embedding_model": "openai/text-embedding-3-large", |
| 98 | + "llm": self._chatbot_settings.CHATBOT_LLM_MODEL, |
| 99 | + "embedding_model": self._chatbot_settings.CHATBOT_EMBEDDING_MODEL, |
99 | 100 | }, |
100 | 101 | headers={ |
101 | 102 | "Content-Type": _JSON_CONTENT_TYPE, |
@@ -129,7 +130,10 @@ async def __aexit__(self, exc_type, exc_val, exc_tb): |
129 | 130 | async def setup_chatbot_rest_client(app: web.Application) -> None: |
130 | 131 | chatbot_settings = get_plugin_settings(app) |
131 | 132 |
|
132 | | - client = ChatbotRestClient(base_url=chatbot_settings.base_url) |
| 133 | + client = ChatbotRestClient( |
| 134 | + base_url=chatbot_settings.base_url, |
| 135 | + chatbot_settings=chatbot_settings, |
| 136 | + ) |
133 | 137 |
|
134 | 138 | app[_APPKEY] = client |
135 | 139 |
|
|
0 commit comments