lollms-client 0.32.1__py3-none-any.whl → 1.0.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.
- lollms_client/__init__.py +1 -1
- lollms_client/llm_bindings/azure_openai/__init__.py +6 -10
- lollms_client/llm_bindings/claude/__init__.py +4 -7
- lollms_client/llm_bindings/gemini/__init__.py +3 -7
- lollms_client/llm_bindings/grok/__init__.py +3 -7
- lollms_client/llm_bindings/groq/__init__.py +4 -7
- lollms_client/llm_bindings/hugging_face_inference_api/__init__.py +4 -6
- lollms_client/llm_bindings/litellm/__init__.py +15 -6
- lollms_client/llm_bindings/llamacpp/__init__.py +214 -388
- lollms_client/llm_bindings/lollms/__init__.py +24 -14
- lollms_client/llm_bindings/lollms_webui/__init__.py +6 -12
- lollms_client/llm_bindings/mistral/__init__.py +58 -29
- lollms_client/llm_bindings/ollama/__init__.py +6 -11
- lollms_client/llm_bindings/open_router/__init__.py +45 -14
- lollms_client/llm_bindings/openai/__init__.py +7 -14
- lollms_client/llm_bindings/openllm/__init__.py +12 -12
- lollms_client/llm_bindings/pythonllamacpp/__init__.py +1 -1
- lollms_client/llm_bindings/tensor_rt/__init__.py +8 -13
- lollms_client/llm_bindings/transformers/__init__.py +14 -6
- lollms_client/llm_bindings/vllm/__init__.py +16 -12
- lollms_client/lollms_core.py +296 -487
- lollms_client/lollms_discussion.py +436 -78
- lollms_client/lollms_llm_binding.py +223 -11
- lollms_client/lollms_mcp_binding.py +33 -2
- lollms_client/mcp_bindings/local_mcp/__init__.py +3 -2
- lollms_client/mcp_bindings/remote_mcp/__init__.py +6 -5
- lollms_client/mcp_bindings/standard_mcp/__init__.py +3 -5
- lollms_client/stt_bindings/lollms/__init__.py +6 -8
- lollms_client/stt_bindings/whisper/__init__.py +2 -4
- lollms_client/stt_bindings/whispercpp/__init__.py +15 -16
- lollms_client/tti_bindings/dalle/__init__.py +29 -28
- lollms_client/tti_bindings/diffusers/__init__.py +25 -21
- lollms_client/tti_bindings/gemini/__init__.py +215 -0
- lollms_client/tti_bindings/lollms/__init__.py +8 -9
- lollms_client-1.0.0.dist-info/METADATA +1214 -0
- lollms_client-1.0.0.dist-info/RECORD +69 -0
- {lollms_client-0.32.1.dist-info → lollms_client-1.0.0.dist-info}/top_level.txt +0 -2
- examples/article_summary/article_summary.py +0 -58
- examples/console_discussion/console_app.py +0 -266
- examples/console_discussion.py +0 -448
- examples/deep_analyze/deep_analyse.py +0 -30
- examples/deep_analyze/deep_analyze_multiple_files.py +0 -32
- examples/function_calling_with_local_custom_mcp.py +0 -250
- examples/generate_a_benchmark_for_safe_store.py +0 -89
- examples/generate_and_speak/generate_and_speak.py +0 -251
- examples/generate_game_sfx/generate_game_fx.py +0 -240
- examples/generate_text_with_multihop_rag_example.py +0 -210
- examples/gradio_chat_app.py +0 -228
- examples/gradio_lollms_chat.py +0 -259
- examples/internet_search_with_rag.py +0 -226
- examples/lollms_chat/calculator.py +0 -59
- examples/lollms_chat/derivative.py +0 -48
- examples/lollms_chat/test_openai_compatible_with_lollms_chat.py +0 -12
- examples/lollms_discussions_test.py +0 -155
- examples/mcp_examples/external_mcp.py +0 -267
- examples/mcp_examples/local_mcp.py +0 -171
- examples/mcp_examples/openai_mcp.py +0 -203
- examples/mcp_examples/run_remote_mcp_example_v2.py +0 -290
- examples/mcp_examples/run_standard_mcp_example.py +0 -204
- examples/simple_text_gen_test.py +0 -173
- examples/simple_text_gen_with_image_test.py +0 -178
- examples/test_local_models/local_chat.py +0 -9
- examples/text_2_audio.py +0 -77
- examples/text_2_image.py +0 -144
- examples/text_2_image_diffusers.py +0 -274
- examples/text_and_image_2_audio.py +0 -59
- examples/text_gen.py +0 -30
- examples/text_gen_system_prompt.py +0 -29
- lollms_client-0.32.1.dist-info/METADATA +0 -854
- lollms_client-0.32.1.dist-info/RECORD +0 -101
- test/test_lollms_discussion.py +0 -368
- {lollms_client-0.32.1.dist-info → lollms_client-1.0.0.dist-info}/WHEEL +0 -0
- {lollms_client-0.32.1.dist-info → lollms_client-1.0.0.dist-info}/licenses/LICENSE +0 -0
lollms_client/__init__.py
CHANGED
|
@@ -8,7 +8,7 @@ from lollms_client.lollms_utilities import PromptReshaper # Keep general utiliti
|
|
|
8
8
|
from lollms_client.lollms_mcp_binding import LollmsMCPBinding, LollmsMCPBindingManager
|
|
9
9
|
from lollms_client.lollms_llm_binding import LollmsLLMBindingManager
|
|
10
10
|
|
|
11
|
-
__version__ = "0.
|
|
11
|
+
__version__ = "1.0.0" # Updated version
|
|
12
12
|
|
|
13
13
|
# Optionally, you could define __all__ if you want to be explicit about exports
|
|
14
14
|
__all__ = [
|
|
@@ -45,10 +45,6 @@ class AzureOpenAIBinding(LollmsLLMBinding):
|
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
47
|
def __init__(self,
|
|
48
|
-
model_name: str, # In Azure, this is the DEPLOYMENT NAME
|
|
49
|
-
azure_api_key: str = None,
|
|
50
|
-
azure_endpoint: str = None,
|
|
51
|
-
azure_api_version: str = "2024-02-01",
|
|
52
48
|
**kwargs
|
|
53
49
|
):
|
|
54
50
|
"""
|
|
@@ -56,15 +52,15 @@ class AzureOpenAIBinding(LollmsLLMBinding):
|
|
|
56
52
|
|
|
57
53
|
Args:
|
|
58
54
|
model_name (str): The name of the Azure OpenAI DEPLOYMENT to use.
|
|
59
|
-
|
|
55
|
+
service_key (str): The API key for the Azure OpenAI service.
|
|
60
56
|
azure_endpoint (str): The endpoint URL for the Azure OpenAI service.
|
|
61
57
|
azure_api_version (str): The API version to use.
|
|
62
58
|
"""
|
|
63
|
-
super().__init__(
|
|
64
|
-
self.model_name = model_name # Here, it's the deployment name
|
|
65
|
-
self.azure_api_key =
|
|
66
|
-
self.azure_endpoint = azure_endpoint or os.getenv("AZURE_OPENAI_ENDPOINT")
|
|
67
|
-
self.azure_api_version = azure_api_version or os.getenv("AZURE_OPENAI_API_VERSION", "2024-02-01")
|
|
59
|
+
super().__init__(BindingName, **kwargs)
|
|
60
|
+
self.model_name = kwargs.get("model_name") # Here, it's the deployment name
|
|
61
|
+
self.azure_api_key = kwargs.get("service_key") or os.getenv("AZURE_OPENAI_API_KEY")
|
|
62
|
+
self.azure_endpoint = kwargs.get("azure_endpoint") or os.getenv("AZURE_OPENAI_ENDPOINT")
|
|
63
|
+
self.azure_api_version = kwargs.get("azure_api_version") or os.getenv("AZURE_OPENAI_API_VERSION", "2024-02-01")
|
|
68
64
|
|
|
69
65
|
if not self.model_name:
|
|
70
66
|
raise ValueError("Azure deployment name ('model_name') is required.")
|
|
@@ -66,10 +66,6 @@ class ClaudeBinding(LollmsLLMBinding):
|
|
|
66
66
|
"""Anthropic Claude-specific binding implementation."""
|
|
67
67
|
|
|
68
68
|
def __init__(self,
|
|
69
|
-
host_address: str = None, # Ignored, for compatibility
|
|
70
|
-
model_name: str = "claude-3-sonnet-20240229",
|
|
71
|
-
service_key: str = None,
|
|
72
|
-
verify_ssl_certificate: bool = True, # Ignored, for compatibility
|
|
73
69
|
**kwargs
|
|
74
70
|
):
|
|
75
71
|
"""
|
|
@@ -79,9 +75,9 @@ class ClaudeBinding(LollmsLLMBinding):
|
|
|
79
75
|
model_name (str): Name of the Claude model to use.
|
|
80
76
|
service_key (str): Anthropic API key.
|
|
81
77
|
"""
|
|
82
|
-
super().__init__(
|
|
83
|
-
self.model_name = model_name
|
|
84
|
-
self.service_key = service_key
|
|
78
|
+
super().__init__(BindingName, **kwargs)
|
|
79
|
+
self.model_name = kwargs.get("model_name")
|
|
80
|
+
self.service_key = kwargs.get("service_key")
|
|
85
81
|
self._cached_models: Optional[List[Dict[str, str]]] = None
|
|
86
82
|
|
|
87
83
|
if not self.service_key:
|
|
@@ -335,6 +331,7 @@ class ClaudeBinding(LollmsLLMBinding):
|
|
|
335
331
|
)
|
|
336
332
|
return response.token_count # Updated to correct response attribute
|
|
337
333
|
except Exception as e:
|
|
334
|
+
trace_exception(e)
|
|
338
335
|
ASCIIColors.error(f"Failed to count tokens with Claude API: {e}")
|
|
339
336
|
return len(self.tokenize(text))
|
|
340
337
|
|
|
@@ -33,10 +33,6 @@ class GeminiBinding(LollmsLLMBinding):
|
|
|
33
33
|
"""Google Gemini-specific binding implementation."""
|
|
34
34
|
|
|
35
35
|
def __init__(self,
|
|
36
|
-
host_address: str = None, # Ignored, for compatibility
|
|
37
|
-
model_name: str = "gemini-1.5-pro-latest",
|
|
38
|
-
service_key: str = None,
|
|
39
|
-
verify_ssl_certificate: bool = True, # Ignored, for compatibility
|
|
40
36
|
**kwargs
|
|
41
37
|
):
|
|
42
38
|
"""
|
|
@@ -46,9 +42,9 @@ class GeminiBinding(LollmsLLMBinding):
|
|
|
46
42
|
model_name (str): Name of the Gemini model to use.
|
|
47
43
|
service_key (str): Google AI Studio API key.
|
|
48
44
|
"""
|
|
49
|
-
super().__init__(
|
|
50
|
-
self.model_name = model_name
|
|
51
|
-
self.service_key = service_key
|
|
45
|
+
super().__init__(BindingName, **kwargs)
|
|
46
|
+
self.model_name = kwargs.get("model_name", None)
|
|
47
|
+
self.service_key = kwargs.get("service_key", None)
|
|
52
48
|
|
|
53
49
|
if not self.service_key:
|
|
54
50
|
self.service_key = os.getenv("GOOGLE_API_KEY")
|
|
@@ -60,10 +60,6 @@ class GrokBinding(LollmsLLMBinding):
|
|
|
60
60
|
"""xAI Grok-specific binding implementation."""
|
|
61
61
|
|
|
62
62
|
def __init__(self,
|
|
63
|
-
host_address: str = None, # Ignored, for compatibility
|
|
64
|
-
model_name: str = "grok-1.5-vision-preview",
|
|
65
|
-
service_key: str = None,
|
|
66
|
-
verify_ssl_certificate: bool = True, # Ignored, for compatibility
|
|
67
63
|
**kwargs
|
|
68
64
|
):
|
|
69
65
|
"""
|
|
@@ -73,9 +69,9 @@ class GrokBinding(LollmsLLMBinding):
|
|
|
73
69
|
model_name (str): Name of the Grok model to use.
|
|
74
70
|
service_key (str): xAI API key.
|
|
75
71
|
"""
|
|
76
|
-
super().__init__(
|
|
77
|
-
self.model_name = model_name
|
|
78
|
-
self.service_key = service_key
|
|
72
|
+
super().__init__(BindingName, **kwargs)
|
|
73
|
+
self.model_name = kwargs.get("model_name", "grok-1.5-vision-preview")
|
|
74
|
+
self.service_key = kwargs.get("service_key")
|
|
79
75
|
self.base_url = kwargs.get("base_url", GROK_API_BASE_URL)
|
|
80
76
|
self._cached_models: Optional[List[Dict[str, str]]] = None
|
|
81
77
|
|
|
@@ -29,8 +29,6 @@ class GroqBinding(LollmsLLMBinding):
|
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
31
|
def __init__(self,
|
|
32
|
-
model_name: str = "llama3-8b-8192",
|
|
33
|
-
groq_api_key: str = None,
|
|
34
32
|
**kwargs
|
|
35
33
|
):
|
|
36
34
|
"""
|
|
@@ -38,11 +36,11 @@ class GroqBinding(LollmsLLMBinding):
|
|
|
38
36
|
|
|
39
37
|
Args:
|
|
40
38
|
model_name (str): The name of the Groq model to use.
|
|
41
|
-
|
|
39
|
+
service_key (str): The API key for the Groq service.
|
|
42
40
|
"""
|
|
43
|
-
super().__init__(
|
|
44
|
-
self.model_name = model_name
|
|
45
|
-
self.groq_api_key =
|
|
41
|
+
super().__init__(BindingName, **kwargs)
|
|
42
|
+
self.model_name = kwargs.get("model_name", "llama3-8b-8192")
|
|
43
|
+
self.groq_api_key = kwargs.get("service_key") or os.getenv("GROQ_API_KEY")
|
|
46
44
|
|
|
47
45
|
if not self.groq_api_key:
|
|
48
46
|
raise ValueError("Groq API key is required. Set it via 'groq_api_key' or GROQ_API_KEY env var.")
|
|
@@ -258,7 +256,6 @@ if __name__ == '__main__':
|
|
|
258
256
|
ASCIIColors.cyan("\n--- Text Generation (Streaming) ---")
|
|
259
257
|
full_streamed_text = ""
|
|
260
258
|
def stream_callback(chunk: str, msg_type: int):
|
|
261
|
-
nonlocal full_streamed_text
|
|
262
259
|
ASCIIColors.green(chunk, end="", flush=True)
|
|
263
260
|
full_streamed_text += chunk
|
|
264
261
|
return True
|
|
@@ -25,8 +25,6 @@ class HuggingFaceInferenceAPIBinding(LollmsLLMBinding):
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
def __init__(self,
|
|
28
|
-
model_name: str = "mistralai/Mistral-7B-Instruct-v0.2",
|
|
29
|
-
hf_api_key: str = None,
|
|
30
28
|
**kwargs
|
|
31
29
|
):
|
|
32
30
|
"""
|
|
@@ -34,11 +32,11 @@ class HuggingFaceInferenceAPIBinding(LollmsLLMBinding):
|
|
|
34
32
|
|
|
35
33
|
Args:
|
|
36
34
|
model_name (str): The repository ID of the model on the Hugging Face Hub.
|
|
37
|
-
|
|
35
|
+
service_key (str): The Hugging Face API key.
|
|
38
36
|
"""
|
|
39
|
-
super().__init__(
|
|
40
|
-
self.model_name = model_name
|
|
41
|
-
self.hf_api_key =
|
|
37
|
+
super().__init__(BindingName, **kwargs)
|
|
38
|
+
self.model_name = kwargs.get("model_name")
|
|
39
|
+
self.hf_api_key = kwargs.get("service_key") or os.getenv("HUGGING_FACE_HUB_TOKEN")
|
|
42
40
|
|
|
43
41
|
if not self.hf_api_key:
|
|
44
42
|
raise ValueError("Hugging Face API key is required. Set it via 'hf_api_key' or HUGGING_FACE_HUB_TOKEN env var.")
|
|
@@ -36,12 +36,21 @@ class LiteLLMBinding(LollmsLLMBinding):
|
|
|
36
36
|
and correct payload formatting for both streaming and non-streaming modes.
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
-
def __init__(self,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
def __init__(self,
|
|
40
|
+
**kwargs):
|
|
41
|
+
""" Initializes the LiteLLM binding with the provided parameters.
|
|
42
|
+
Args:
|
|
43
|
+
host_address (str): The base URL of the LiteLLM server.
|
|
44
|
+
model_name (str): The name of the model to use.
|
|
45
|
+
service_key (str): The API key for authentication.
|
|
46
|
+
verify_ssl_certificate (bool): Whether to verify SSL certificates.
|
|
47
|
+
"""
|
|
48
|
+
super().__init__(BindingName, **kwargs)
|
|
49
|
+
self.host_address = kwargs.get("host_address")
|
|
50
|
+
if self.host_address: self.host_address = self.host_address.rstrip('/')
|
|
51
|
+
self.model_name = kwargs.get("model_name")
|
|
52
|
+
self.service_key = kwargs.get("service_key")
|
|
53
|
+
self.verify_ssl_certificate = kwargs.get("verify_ssl_certificate")
|
|
45
54
|
|
|
46
55
|
def _perform_generation(self, messages: List[Dict], n_predict: Optional[int], stream: bool, temperature: float, top_p: float, repeat_penalty: float, seed: Optional[int], streaming_callback: Optional[Callable[[str, MSG_TYPE], None]]) -> Union[str, dict]:
|
|
47
56
|
url = f'{self.host_address}/v1/chat/completions'
|