lollmsbot 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from lollms_client import LollmsClient # from lollms-client package[web:21][web:41]
6
+
7
+ from .config import LollmsSettings
8
+
9
+
10
+ def build_lollms_client(settings: LollmsSettings | None = None) -> LollmsClient:
11
+ """
12
+ Build a LollmsClient either in 'LoLLMS server' mode or 'direct binding' mode
13
+ depending on env settings.
14
+ """
15
+ if settings is None:
16
+ settings = LollmsSettings.from_env()
17
+
18
+ # Basic shared kwargs
19
+ client_kwargs: dict[str, Any] = {}
20
+
21
+ if settings.host_address:
22
+ client_kwargs["host_address"] = settings.host_address
23
+
24
+ # Some lollms_client versions support verify_ssl; if not, this can be removed
25
+ if settings.verify_ssl is False:
26
+ client_kwargs["verify_ssl"] = False
27
+
28
+ # Direct binding mode
29
+ return LollmsClient(
30
+ llm_binding_name= settings.binding_name or "lollms",
31
+ llm_binding_config={
32
+ "host_address":settings.host_address,
33
+ "model_name":settings.model_name,
34
+ "service_key":settings.api_key,
35
+ "ctx_size":settings.context_size,
36
+ },
37
+ )