lollms-client 0.15.1__py3-none-any.whl → 0.16.0__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.

Potentially problematic release.


This version of lollms-client might be problematic. Click here for more details.

@@ -48,6 +48,13 @@ class LollmsClient():
48
48
  ttv_bindings_dir: Path = Path(__file__).parent / "ttv_bindings",
49
49
  ttm_bindings_dir: Path = Path(__file__).parent / "ttm_bindings",
50
50
 
51
+ # Configurations
52
+ tts_binding_config: Optional[Dict[str, any]] = None, # Renamed for clarity
53
+ tti_binding_config: Optional[Dict[str, any]] = None, # Renamed for clarity
54
+ stt_binding_config: Optional[Dict[str, any]] = None, # Renamed for clarity
55
+ ttv_binding_config: Optional[Dict[str, any]] = None, # Renamed for clarity
56
+ ttm_binding_config: Optional[Dict[str, any]] = None, # Renamed for clarity
57
+
51
58
  # General Parameters (mostly defaults for LLM generation)
52
59
  service_key: Optional[str] = None, # Shared service key/client_id
53
60
  verify_ssl_certificate: bool = True,
@@ -84,6 +91,11 @@ class LollmsClient():
84
91
  stt_bindings_dir (Path): Directory for STT bindings.
85
92
  ttv_bindings_dir (Path): Directory for TTV bindings.
86
93
  ttm_bindings_dir (Path): Directory for TTM bindings.
94
+ tts_binding_config (Optional[Dict]): Additional config for the TTS binding.
95
+ tti_binding_config (Optional[Dict]): Additional config for the TTI binding.
96
+ stt_binding_config (Optional[Dict]): Additional config for the STT binding.
97
+ ttv_binding_config (Optional[Dict]): Additional config for the TTV binding.
98
+ ttm_binding_config (Optional[Dict]): Additional config for the TTM binding.
87
99
  service_key (Optional[str]): Shared authentication key or client_id.
88
100
  verify_ssl_certificate (bool): Whether to verify SSL certificates.
89
101
  ctx_size (Optional[int]): Default context size for LLM.
@@ -144,54 +156,62 @@ class LollmsClient():
144
156
  if tts_binding_name:
145
157
  self.tts = self.tts_binding_manager.create_binding(
146
158
  binding_name=tts_binding_name,
147
- host_address=effective_host_address,
148
- service_key=self.service_key,
149
- verify_ssl_certificate=self.verify_ssl_certificate
159
+ **tts_binding_config
150
160
  )
151
161
  if self.tts is None:
152
162
  ASCIIColors.warning(f"Failed to create TTS binding: {tts_binding_name}. Available: {self.tts_binding_manager.get_available_bindings()}")
153
163
 
154
164
  if tti_binding_name:
155
- self.tti = self.tti_binding_manager.create_binding(
156
- binding_name=tti_binding_name,
157
- host_address=effective_host_address,
158
- service_key=self.service_key, # Passed as service_key, used as client_id by lollms TTI binding
159
- verify_ssl_certificate=self.verify_ssl_certificate
160
- )
165
+ if tti_binding_config:
166
+ self.tti = self.tti_binding_manager.create_binding(
167
+ binding_name=tti_binding_name,
168
+ **tti_binding_config
169
+ )
170
+ else:
171
+ self.tti = self.tti_binding_manager.create_binding(
172
+ binding_name=tti_binding_name
173
+ )
161
174
  if self.tti is None:
162
175
  ASCIIColors.warning(f"Failed to create TTI binding: {tti_binding_name}. Available: {self.tti_binding_manager.get_available_bindings()}")
163
176
 
164
177
  if stt_binding_name:
165
- self.stt = self.stt_binding_manager.create_binding(
166
- binding_name=stt_binding_name,
167
- host_address=effective_host_address,
168
- service_key=self.service_key,
169
- verify_ssl_certificate=self.verify_ssl_certificate
170
- )
178
+ if stt_binding_config:
179
+ self.stt = self.stt_binding_manager.create_binding(
180
+ binding_name=stt_binding_name,
181
+ **stt_binding_config
182
+ )
183
+ else:
184
+ self.stt = self.stt_binding_manager.create_binding(
185
+ binding_name=stt_binding_name,
186
+ )
171
187
  if self.stt is None:
172
188
  ASCIIColors.warning(f"Failed to create STT binding: {stt_binding_name}. Available: {self.stt_binding_manager.get_available_bindings()}")
173
-
174
189
  if ttv_binding_name:
175
- self.ttv = self.ttv_binding_manager.create_binding(
176
- binding_name=ttv_binding_name,
177
- host_address=effective_host_address,
178
- service_key=self.service_key,
179
- verify_ssl_certificate=self.verify_ssl_certificate
180
- )
190
+ if ttv_binding_config:
191
+ self.ttv = self.ttv_binding_manager.create_binding(
192
+ binding_name=ttv_binding_name,
193
+ **ttv_binding_config
194
+ )
195
+ else:
196
+ self.ttv = self.ttv_binding_manager.create_binding(
197
+ binding_name=ttv_binding_name
198
+ )
181
199
  if self.ttv is None:
182
200
  ASCIIColors.warning(f"Failed to create TTV binding: {ttv_binding_name}. Available: {self.ttv_binding_manager.get_available_bindings()}")
183
201
 
184
202
  if ttm_binding_name:
185
- self.ttm = self.ttm_binding_manager.create_binding(
186
- binding_name=ttm_binding_name,
187
- host_address=effective_host_address,
188
- service_key=self.service_key,
189
- verify_ssl_certificate=self.verify_ssl_certificate
190
- )
203
+ if ttm_binding_config:
204
+ self.ttm = self.ttm_binding_manager.create_binding(
205
+ binding_name=ttm_binding_name,
206
+ **ttm_binding_config
207
+ )
208
+ else:
209
+ self.ttm = self.ttm_binding_manager.create_binding(
210
+ binding_name=ttm_binding_name
211
+ )
191
212
  if self.ttm is None:
192
213
  ASCIIColors.warning(f"Failed to create TTM binding: {ttm_binding_name}. Available: {self.ttm_binding_manager.get_available_bindings()}")
193
214
 
194
-
195
215
  # --- Store Default Generation Parameters ---
196
216
  self.default_ctx_size = ctx_size
197
217
  self.default_n_predict = n_predict
@@ -9,26 +9,14 @@ class LollmsSTTBinding(ABC):
9
9
  """Abstract base class for all LOLLMS Speech-to-Text bindings."""
10
10
 
11
11
  def __init__(self,
12
- host_address: Optional[str] = None,
13
- model_name: Optional[str] = None, # Can represent a default model
14
- service_key: Optional[str] = None,
15
- verify_ssl_certificate: bool = True):
12
+ binding_name:str="unknown"):
16
13
  """
17
14
  Initialize the LollmsSTTBinding base class.
18
15
 
19
16
  Args:
20
- host_address (Optional[str]): The host address for the STT service.
21
- model_name (Optional[str]): A default identifier for the STT model.
22
- service_key (Optional[str]): Authentication key for the service.
23
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
17
+ binding_name (Optional[str]): The binding name
24
18
  """
25
- if host_address is not None:
26
- self.host_address = host_address.rstrip('/')
27
- else:
28
- self.host_address = None
29
- self.model_name = model_name
30
- self.service_key = service_key
31
- self.verify_ssl_certificate = verify_ssl_certificate
19
+ self.binding_name = binding_name
32
20
 
33
21
  @abstractmethod
34
22
  def transcribe_audio(self, audio_path: Union[str, Path], model: Optional[str] = None, **kwargs) -> str:
@@ -9,26 +9,14 @@ class LollmsTTIBinding(ABC):
9
9
  """Abstract base class for all LOLLMS Text-to-Image bindings."""
10
10
 
11
11
  def __init__(self,
12
- host_address: Optional[str] = None,
13
- model_name: Optional[str] = None, # Can represent a default service/model
14
- service_key: Optional[str] = None,
15
- verify_ssl_certificate: bool = True):
12
+ binding_name:str="unknown"):
16
13
  """
17
14
  Initialize the LollmsTTIBinding base class.
18
15
 
19
16
  Args:
20
- host_address (Optional[str]): The host address for the TTI service.
21
- model_name (Optional[str]): A default identifier (e.g., service or model name).
22
- service_key (Optional[str]): Authentication key for the service.
23
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
24
- """
25
- if host_address is not None:
26
- self.host_address = host_address.rstrip('/')
27
- else:
28
- self.host_address = None
29
- self.model_name = model_name
30
- self.service_key = service_key
31
- self.verify_ssl_certificate = verify_ssl_certificate
17
+ binding_name (Optional[str]): The binding name
18
+ """
19
+ self.binding_name = binding_name
32
20
 
33
21
  @abstractmethod
34
22
  def generate_image(self,
@@ -128,20 +116,12 @@ class LollmsTTIBindingManager:
128
116
 
129
117
  def create_binding(self,
130
118
  binding_name: str,
131
- host_address: Optional[str] = None,
132
- model_name: Optional[str] = None,
133
- service_key: Optional[str] = None,
134
- verify_ssl_certificate: bool = True,
135
119
  **kwargs) -> Optional[LollmsTTIBinding]:
136
120
  """
137
121
  Create an instance of a specific TTI binding.
138
122
 
139
123
  Args:
140
124
  binding_name (str): Name of the TTI binding to create.
141
- host_address (Optional[str]): Host address for the service.
142
- model_name (Optional[str]): Default model/service identifier.
143
- service_key (Optional[str]): Authentication key for the service.
144
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
145
125
  **kwargs: Additional parameters specific to the binding's __init__.
146
126
 
147
127
  Returns:
@@ -153,11 +133,7 @@ class LollmsTTIBindingManager:
153
133
  binding_class = self.available_bindings.get(binding_name)
154
134
  if binding_class:
155
135
  try:
156
- return binding_class(host_address=host_address,
157
- model_name=model_name,
158
- service_key=service_key,
159
- verify_ssl_certificate=verify_ssl_certificate,
160
- **kwargs)
136
+ return binding_class(**kwargs)
161
137
  except Exception as e:
162
138
  trace_exception(e)
163
139
  print(f"Failed to instantiate TTI binding {binding_name}: {str(e)}")
@@ -9,26 +9,15 @@ class LollmsTTMBinding(ABC):
9
9
  """Abstract base class for all LOLLMS Text-to-Music bindings."""
10
10
 
11
11
  def __init__(self,
12
- host_address: Optional[str] = None,
13
- model_name: Optional[str] = None, # Can represent a default model/service
14
- service_key: Optional[str] = None,
15
- verify_ssl_certificate: bool = True):
12
+ binding_name:str="unknown"):
16
13
  """
17
14
  Initialize the LollmsTTMBinding base class.
18
15
 
19
16
  Args:
20
- host_address (Optional[str]): The host address for the TTM service.
21
- model_name (Optional[str]): A default identifier (e.g., service or model name).
22
- service_key (Optional[str]): Authentication key for the service.
23
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
17
+ binding_name (Optional[str]): The binding name
24
18
  """
25
- if host_address is not None:
26
- self.host_address = host_address.rstrip('/')
27
- else:
28
- self.host_address = None
29
- self.model_name = model_name
30
- self.service_key = service_key
31
- self.verify_ssl_certificate = verify_ssl_certificate
19
+ self.binding_name = binding_name
20
+
32
21
 
33
22
  @abstractmethod
34
23
  def generate_music(self, prompt: str, **kwargs) -> bytes:
@@ -88,20 +77,12 @@ class LollmsTTMBindingManager:
88
77
 
89
78
  def create_binding(self,
90
79
  binding_name: str,
91
- host_address: Optional[str] = None,
92
- model_name: Optional[str] = None,
93
- service_key: Optional[str] = None,
94
- verify_ssl_certificate: bool = True,
95
80
  **kwargs) -> Optional[LollmsTTMBinding]:
96
81
  """
97
82
  Create an instance of a specific TTM binding.
98
83
 
99
84
  Args:
100
85
  binding_name (str): Name of the TTM binding to create.
101
- host_address (Optional[str]): Host address for the service.
102
- model_name (Optional[str]): Default model/service identifier.
103
- service_key (Optional[str]): Authentication key for the service.
104
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
105
86
  **kwargs: Additional parameters specific to the binding's __init__.
106
87
 
107
88
  Returns:
@@ -113,11 +94,7 @@ class LollmsTTMBindingManager:
113
94
  binding_class = self.available_bindings.get(binding_name)
114
95
  if binding_class:
115
96
  try:
116
- return binding_class(host_address=host_address,
117
- model_name=model_name,
118
- service_key=service_key,
119
- verify_ssl_certificate=verify_ssl_certificate,
120
- **kwargs)
97
+ return binding_class(**kwargs)
121
98
  except Exception as e:
122
99
  trace_exception(e)
123
100
  print(f"Failed to instantiate TTM binding {binding_name}: {str(e)}")
@@ -9,26 +9,14 @@ class LollmsTTSBinding(ABC):
9
9
  """Abstract base class for all LOLLMS Text-to-Speech bindings."""
10
10
 
11
11
  def __init__(self,
12
- host_address: Optional[str] = None,
13
- model_name: Optional[str] = None, # Can represent a default voice or model
14
- service_key: Optional[str] = None,
15
- verify_ssl_certificate: bool = True):
12
+ binding_name:str="unknown"):
16
13
  """
17
14
  Initialize the LollmsTTSBinding base class.
18
15
 
19
16
  Args:
20
- host_address (Optional[str]): The host address for the TTS service.
21
- model_name (Optional[str]): A default identifier (e.g., voice or model name).
22
- service_key (Optional[str]): Authentication key for the service.
23
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
17
+ binding_name (Optional[str]): The binding name
24
18
  """
25
- if host_address is not None:
26
- self.host_address = host_address.rstrip('/')
27
- else:
28
- self.host_address = None
29
- self.model_name = model_name
30
- self.service_key = service_key
31
- self.verify_ssl_certificate = verify_ssl_certificate
19
+ self.binding_name = binding_name
32
20
 
33
21
  @abstractmethod
34
22
  def generate_audio(self, text: str, voice: Optional[str] = None, **kwargs) -> bytes:
@@ -91,20 +79,12 @@ class LollmsTTSBindingManager:
91
79
 
92
80
  def create_binding(self,
93
81
  binding_name: str,
94
- host_address: Optional[str] = None,
95
- model_name: Optional[str] = None,
96
- service_key: Optional[str] = None,
97
- verify_ssl_certificate: bool = True,
98
82
  **kwargs) -> Optional[LollmsTTSBinding]:
99
83
  """
100
84
  Create an instance of a specific TTS binding.
101
85
 
102
86
  Args:
103
87
  binding_name (str): Name of the TTS binding to create.
104
- host_address (Optional[str]): Host address for the service.
105
- model_name (Optional[str]): Default model/voice identifier.
106
- service_key (Optional[str]): Authentication key for the service.
107
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
108
88
  **kwargs: Additional parameters specific to the binding's __init__.
109
89
 
110
90
  Returns:
@@ -116,11 +96,7 @@ class LollmsTTSBindingManager:
116
96
  binding_class = self.available_bindings.get(binding_name)
117
97
  if binding_class:
118
98
  try:
119
- return binding_class(host_address=host_address,
120
- model_name=model_name,
121
- service_key=service_key,
122
- verify_ssl_certificate=verify_ssl_certificate,
123
- **kwargs)
99
+ return binding_class(**kwargs)
124
100
  except Exception as e:
125
101
  trace_exception(e)
126
102
  print(f"Failed to instantiate TTS binding {binding_name}: {str(e)}")
@@ -9,26 +9,14 @@ class LollmsTTVBinding(ABC):
9
9
  """Abstract base class for all LOLLMS Text-to-Video bindings."""
10
10
 
11
11
  def __init__(self,
12
- host_address: Optional[str] = None,
13
- model_name: Optional[str] = None, # Can represent a default model/service
14
- service_key: Optional[str] = None,
15
- verify_ssl_certificate: bool = True):
12
+ binding_name:str="unknown"):
16
13
  """
17
14
  Initialize the LollmsTTVBinding base class.
18
15
 
19
16
  Args:
20
- host_address (Optional[str]): The host address for the TTV service.
21
- model_name (Optional[str]): A default identifier (e.g., service or model name).
22
- service_key (Optional[str]): Authentication key for the service.
23
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
17
+ binding_name (Optional[str]): The binding name
24
18
  """
25
- if host_address is not None:
26
- self.host_address = host_address.rstrip('/')
27
- else:
28
- self.host_address = None
29
- self.model_name = model_name
30
- self.service_key = service_key
31
- self.verify_ssl_certificate = verify_ssl_certificate
19
+ self.binding_name = binding_name
32
20
 
33
21
  @abstractmethod
34
22
  def generate_video(self, prompt: str, **kwargs) -> bytes:
@@ -88,20 +76,12 @@ class LollmsTTVBindingManager:
88
76
 
89
77
  def create_binding(self,
90
78
  binding_name: str,
91
- host_address: Optional[str] = None,
92
- model_name: Optional[str] = None,
93
- service_key: Optional[str] = None,
94
- verify_ssl_certificate: bool = True,
95
79
  **kwargs) -> Optional[LollmsTTVBinding]:
96
80
  """
97
81
  Create an instance of a specific TTV binding.
98
82
 
99
83
  Args:
100
84
  binding_name (str): Name of the TTV binding to create.
101
- host_address (Optional[str]): Host address for the service.
102
- model_name (Optional[str]): Default model/service identifier.
103
- service_key (Optional[str]): Authentication key for the service.
104
- verify_ssl_certificate (bool): Whether to verify SSL certificates.
105
85
  **kwargs: Additional parameters specific to the binding's __init__.
106
86
 
107
87
  Returns:
@@ -113,11 +93,7 @@ class LollmsTTVBindingManager:
113
93
  binding_class = self.available_bindings.get(binding_name)
114
94
  if binding_class:
115
95
  try:
116
- return binding_class(host_address=host_address,
117
- model_name=model_name,
118
- service_key=service_key,
119
- verify_ssl_certificate=verify_ssl_certificate,
120
- **kwargs)
96
+ return binding_class(**kwargs)
121
97
  except Exception as e:
122
98
  trace_exception(e)
123
99
  print(f"Failed to instantiate TTV binding {binding_name}: {str(e)}")
@@ -27,10 +27,11 @@ class LollmsSTTBinding_Impl(LollmsSTTBinding):
27
27
  service_key (Optional[str]): Authentication key (currently unused by default LOLLMS STT).
28
28
  verify_ssl_certificate (bool): Whether to verify SSL certificates.
29
29
  """
30
- super().__init__(host_address=host_address,
31
- model_name=model_name,
32
- service_key=service_key,
33
- verify_ssl_certificate=verify_ssl_certificate)
30
+ super().__init__("lollms")
31
+ self.host_address=host_address
32
+ self.model_name=model_name
33
+ self.service_key=service_key
34
+ self.verify_ssl_certificate=verify_ssl_certificate
34
35
 
35
36
  def transcribe_audio(self, audio_path: Union[str, Path], model: Optional[str] = None, **kwargs) -> str:
36
37
  """