lollms-client 0.20.9__py3-none-any.whl → 0.21.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.
- examples/console_discussion.py +207 -0
- examples/gradio_lollms_chat.py +259 -0
- examples/lollms_discussions_test.py +155 -0
- lollms_client/__init__.py +3 -3
- lollms_client/llm_bindings/ollama/__init__.py +1 -1
- lollms_client/lollms_core.py +83 -1
- lollms_client/lollms_discussion.py +578 -357
- lollms_client/lollms_types.py +19 -16
- lollms_client/lollms_utilities.py +71 -57
- lollms_client/mcp_bindings/remote_mcp/__init__.py +2 -1
- {lollms_client-0.20.9.dist-info → lollms_client-0.21.0.dist-info}/METADATA +1 -1
- {lollms_client-0.20.9.dist-info → lollms_client-0.21.0.dist-info}/RECORD +15 -15
- examples/personality_test/chat_test.py +0 -37
- examples/personality_test/chat_with_aristotle.py +0 -42
- examples/personality_test/tesks_test.py +0 -62
- {lollms_client-0.20.9.dist-info → lollms_client-0.21.0.dist-info}/WHEEL +0 -0
- {lollms_client-0.20.9.dist-info → lollms_client-0.21.0.dist-info}/licenses/LICENSE +0 -0
- {lollms_client-0.20.9.dist-info → lollms_client-0.21.0.dist-info}/top_level.txt +0 -0
lollms_client/lollms_core.py
CHANGED
|
@@ -260,6 +260,81 @@ class LollmsClient():
|
|
|
260
260
|
self.end_ai_header_id_template =": "
|
|
261
261
|
self.end_ai_message_id_template =""
|
|
262
262
|
|
|
263
|
+
#
|
|
264
|
+
def update_llm_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
265
|
+
"""Update the LLM binding with a new configuration."""
|
|
266
|
+
self.binding = self.binding_manager.create_binding(
|
|
267
|
+
binding_name=binding_name,
|
|
268
|
+
host_address=self.host_address,
|
|
269
|
+
models_path=self.models_path,
|
|
270
|
+
model_name=self.binding.model_name, # Keep the same model name
|
|
271
|
+
service_key=self.service_key,
|
|
272
|
+
verify_ssl_certificate=self.verify_ssl_certificate,
|
|
273
|
+
**(config or {})
|
|
274
|
+
)
|
|
275
|
+
if self.binding is None:
|
|
276
|
+
available = self.binding_manager.get_available_bindings()
|
|
277
|
+
raise ValueError(f"Failed to update LLM binding: {binding_name}. Available: {available}")
|
|
278
|
+
|
|
279
|
+
def update_tts_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
280
|
+
"""Update the TTS binding with a new configuration."""
|
|
281
|
+
self.tts = self.tts_binding_manager.create_binding(
|
|
282
|
+
binding_name=binding_name,
|
|
283
|
+
**(config or {})
|
|
284
|
+
)
|
|
285
|
+
if self.tts is None:
|
|
286
|
+
available = self.tts_binding_manager.get_available_bindings()
|
|
287
|
+
raise ValueError(f"Failed to update TTS binding: {binding_name}. Available: {available}")
|
|
288
|
+
|
|
289
|
+
def update_tti_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
290
|
+
"""Update the TTI binding with a new configuration."""
|
|
291
|
+
self.tti = self.tti_binding_manager.create_binding(
|
|
292
|
+
binding_name=binding_name,
|
|
293
|
+
**(config or {})
|
|
294
|
+
)
|
|
295
|
+
if self.tti is None:
|
|
296
|
+
available = self.tti_binding_manager.get_available_bindings()
|
|
297
|
+
raise ValueError(f"Failed to update TTI binding: {binding_name}. Available: {available}")
|
|
298
|
+
|
|
299
|
+
def update_stt_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
300
|
+
"""Update the STT binding with a new configuration."""
|
|
301
|
+
self.stt = self.stt_binding_manager.create_binding(
|
|
302
|
+
binding_name=binding_name,
|
|
303
|
+
**(config or {})
|
|
304
|
+
)
|
|
305
|
+
if self.stt is None:
|
|
306
|
+
available = self.stt_binding_manager.get_available_bindings()
|
|
307
|
+
raise ValueError(f"Failed to update STT binding: {binding_name}. Available: {available}")
|
|
308
|
+
|
|
309
|
+
def update_ttv_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
310
|
+
"""Update the TTV binding with a new configuration."""
|
|
311
|
+
self.ttv = self.ttv_binding_manager.create_binding(
|
|
312
|
+
binding_name=binding_name,
|
|
313
|
+
**(config or {})
|
|
314
|
+
)
|
|
315
|
+
if self.ttv is None:
|
|
316
|
+
available = self.ttv_binding_manager.get_available_bindings()
|
|
317
|
+
raise ValueError(f"Failed to update TTV binding: {binding_name}. Available: {available}")
|
|
318
|
+
|
|
319
|
+
def update_ttm_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
320
|
+
"""Update the TTM binding with a new configuration."""
|
|
321
|
+
self.ttm = self.ttm_binding_manager.create_binding(
|
|
322
|
+
binding_name=binding_name,
|
|
323
|
+
**(config or {})
|
|
324
|
+
)
|
|
325
|
+
if self.ttm is None:
|
|
326
|
+
available = self.ttm_binding_manager.get_available_bindings()
|
|
327
|
+
raise ValueError(f"Failed to update TTM binding: {binding_name}. Available: {available}")
|
|
328
|
+
|
|
329
|
+
def update_mcp_binding(self, binding_name: str, config: Optional[Dict[str, Any]] = None):
|
|
330
|
+
"""Update the MCP binding with a new configuration."""
|
|
331
|
+
self.mcp = self.mcp_binding_manager.create_binding(
|
|
332
|
+
binding_name=binding_name,
|
|
333
|
+
**(config or {})
|
|
334
|
+
)
|
|
335
|
+
if self.mcp is None:
|
|
336
|
+
available = self.mcp_binding_manager.get_available_bindings()
|
|
337
|
+
raise ValueError(f"Failed to update MCP binding: {binding_name}. Available: {available}")
|
|
263
338
|
|
|
264
339
|
# --- Prompt Formatting Properties ---
|
|
265
340
|
@property
|
|
@@ -777,10 +852,17 @@ Don't forget encapsulate the code inside a html code tag. This is mandatory.
|
|
|
777
852
|
f'"{conversation_context}"'
|
|
778
853
|
)
|
|
779
854
|
initial_plan_gen = self.generate_text(prompt=obj_prompt, system_prompt=objective_extraction_system_prompt, temperature=0.0, stream=False)
|
|
855
|
+
if type(initial_plan_gen)!=str:
|
|
856
|
+
if "error" in initial_plan_gen:
|
|
857
|
+
ASCIIColors.error(initial_plan_gen["error"])
|
|
858
|
+
raise Exception(initial_plan_gen["error"])
|
|
859
|
+
else:
|
|
860
|
+
raise Exception("generate text failed. Make sure you are connected to the binding server if you are using remote one")
|
|
780
861
|
current_plan = self.remove_thinking_blocks(initial_plan_gen).strip()
|
|
781
862
|
|
|
782
863
|
if streaming_callback:
|
|
783
|
-
streaming_callback(
|
|
864
|
+
streaming_callback("Building initial plan...", MSG_TYPE.MSG_TYPE_STEP_END, {"id": "plan_extraction"}, turn_history)
|
|
865
|
+
streaming_callback(f"Current plan:\n{current_plan}", MSG_TYPE.MSG_TYPE_STEP, {"id": "plan"}, turn_history)
|
|
784
866
|
turn_history.append({"type": "initial_plan", "content": current_plan})
|
|
785
867
|
|
|
786
868
|
tool_calls_made_this_turn = []
|