lollms-client 0.17.1__py3-none-any.whl → 0.19.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.

Files changed (25) hide show
  1. examples/function_calling_with_local_custom_mcp.py +250 -0
  2. examples/local_mcp.py +171 -0
  3. examples/text_2_image.py +8 -3
  4. examples/text_2_image_diffusers.py +274 -0
  5. lollms_client/__init__.py +7 -6
  6. lollms_client/llm_bindings/llamacpp/__init__.py +8 -8
  7. lollms_client/lollms_core.py +345 -10
  8. lollms_client/lollms_mcp_binding.py +198 -0
  9. lollms_client/mcp_bindings/local_mcp/__init__.py +311 -0
  10. lollms_client/mcp_bindings/local_mcp/default_tools/file_writer/file_writer.py +74 -0
  11. lollms_client/mcp_bindings/local_mcp/default_tools/generate_image_from_prompt/generate_image_from_prompt.py +195 -0
  12. lollms_client/mcp_bindings/local_mcp/default_tools/internet_search/internet_search.py +107 -0
  13. lollms_client/mcp_bindings/local_mcp/default_tools/python_interpreter/python_interpreter.py +141 -0
  14. lollms_client/stt_bindings/whisper/__init__.py +1 -1
  15. lollms_client/tti_bindings/dalle/__init__.py +433 -0
  16. lollms_client/tti_bindings/diffusers/__init__.py +692 -0
  17. lollms_client/tti_bindings/gemini/__init__.py +0 -0
  18. {lollms_client-0.17.1.dist-info → lollms_client-0.19.0.dist-info}/METADATA +1 -1
  19. {lollms_client-0.17.1.dist-info → lollms_client-0.19.0.dist-info}/RECORD +22 -13
  20. examples/function_call/functions_call_with images.py +0 -52
  21. lollms_client/lollms_functions.py +0 -72
  22. lollms_client/lollms_tasks.py +0 -691
  23. {lollms_client-0.17.1.dist-info → lollms_client-0.19.0.dist-info}/WHEEL +0 -0
  24. {lollms_client-0.17.1.dist-info → lollms_client-0.19.0.dist-info}/licenses/LICENSE +0 -0
  25. {lollms_client-0.17.1.dist-info → lollms_client-0.19.0.dist-info}/top_level.txt +0 -0
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lollms_client
3
- Version: 0.17.1
3
+ Version: 0.19.0
4
4
  Summary: A client library for LoLLMs generate endpoint
5
5
  Author-email: ParisNeo <parisneoai@gmail.com>
6
6
  License: Apache Software License
@@ -1,30 +1,31 @@
1
+ examples/function_calling_with_local_custom_mcp.py,sha256=g6wOFRB8-p9Cv7hKmQaGzPvtMX3H77gas01QVNEOduM,12407
2
+ examples/local_mcp.py,sha256=w40dgayvHYe01yvekEE0LjcbkpwKjWwJ-9v4_wGYsUk,9113
1
3
  examples/simple_text_gen_test.py,sha256=RoX9ZKJjGMujeep60wh5WT_GoBn0O9YKJY6WOy-ZmOc,8710
2
4
  examples/simple_text_gen_with_image_test.py,sha256=rR1O5Prcb52UHtJ3c6bv7VuTd1cvbkr5aNZU-v-Rs3Y,9263
3
5
  examples/text_2_audio.py,sha256=MfL4AH_NNwl6m0I0ywl4BXRZJ0b9Y_9fRqDIe6O-Sbw,3523
4
- examples/text_2_image.py,sha256=naBL_wXWbUxDzy0F4hOj6me4tHaR8Aib9XBsj7aiyuc,6372
6
+ examples/text_2_image.py,sha256=CwRdB9K-38Ghsezg3B7_daPtFtsvDcV2hovaMRUjueg,6495
7
+ examples/text_2_image_diffusers.py,sha256=oIVS--ovy3FQ8qwynY3bnoDRkQPDzVXwyozbZnrQ4fc,14398
5
8
  examples/text_and_image_2_audio.py,sha256=QLvSsLff8VZZa7k7K1EFGlPpQWZy07zM4Fnli5btAl0,2074
6
9
  examples/text_gen.py,sha256=pqQz0y_jZZCdxE5u_8d21EYPciX-UZ35zrlDxLGDP5E,1021
7
10
  examples/text_gen_system_prompt.py,sha256=jRQeGe1IVu_zRHX09CFiDYi7WrK9Zd5FlMqC_gnVH-g,1018
8
11
  examples/article_summary/article_summary.py,sha256=CR8mCBNcZEVCR-q34uOmrJyMlG-xk4HkMbsV-TOZEnk,1978
9
12
  examples/deep_analyze/deep_analyse.py,sha256=fZNmDrfEAuxEAfdbjAgJYIh1k6wbiuZ4RvwHRvtyUs8,971
10
13
  examples/deep_analyze/deep_analyze_multiple_files.py,sha256=fOryShA33P4IFxcxUDe-nJ2kW0v9w9yW8KsToS3ETl8,1032
11
- examples/function_call/functions_call_with images.py,sha256=jrNtTF7lAzad25Ob0Yv4pwLs12HSzDamKKR9ORkNWjc,1888
12
14
  examples/generate_and_speak/generate_and_speak.py,sha256=RAlvRwtEKXCh894l9M3iQbADe8CvF5N442jtRurK02I,13908
13
15
  examples/generate_game_sfx/generate_game_fx.py,sha256=MgLNGi4hGBRoyr4bqYuCUdCSqd-ldDVfF0VSDUjgzsg,10467
14
16
  examples/personality_test/chat_test.py,sha256=o2jlpoddFc-T592iqAiA29xk3x27KsdK5DluqxBwHqw,1417
15
17
  examples/personality_test/chat_with_aristotle.py,sha256=4X_fwubMpd0Eq2rCReS2bgVlUoAqJprjkLXk2Jz6pXU,1774
16
18
  examples/personality_test/tesks_test.py,sha256=7LIiwrEbva9WWZOLi34fsmCBN__RZbPpxoUOKA_AtYk,1924
17
19
  examples/test_local_models/local_chat.py,sha256=slakja2zaHOEAUsn2tn_VmI4kLx6luLBrPqAeaNsix8,456
18
- lollms_client/__init__.py,sha256=v0fLw3fxRSVML8auu9wqW8w-93EVhGHvQK06SOb8F4o,823
20
+ lollms_client/__init__.py,sha256=7YwfgI-rPt3hNWyG5_ObEgKMsRGXYBu6QDe97v_Cc0g,910
19
21
  lollms_client/lollms_config.py,sha256=goEseDwDxYJf3WkYJ4IrLXwg3Tfw73CXV2Avg45M_hE,21876
20
- lollms_client/lollms_core.py,sha256=fRHdQ0yWAmMuOLZAzDbdlYfCsx0Rb8rQ-RYl_bKgEHk,80049
22
+ lollms_client/lollms_core.py,sha256=psVTrEtHYhjy9h014rHLotBC4Aj72PvG2OV0UAjLcvw,102496
21
23
  lollms_client/lollms_discussion.py,sha256=9b83m0D894jwpgssWYTQHbVxp1gJoI-J947Ui_dRXII,2073
22
- lollms_client/lollms_functions.py,sha256=p8SFtmEPqvVCsIz2fZ5HxyOHaxjrAo5c12uTzJnb6m8,3594
23
24
  lollms_client/lollms_js_analyzer.py,sha256=01zUvuO2F_lnUe_0NLxe1MF5aHE1hO8RZi48mNPv-aw,8361
24
25
  lollms_client/lollms_llm_binding.py,sha256=bdElz_IBx0zZ-85YTT1fyY_mSoHo46tKIMiHYJlKCkM,9809
26
+ lollms_client/lollms_mcp_binding.py,sha256=0rK9HQCBEGryNc8ApBmtOlhKE1Yfn7X7xIQssXxS2Zc,8933
25
27
  lollms_client/lollms_python_analyzer.py,sha256=7gf1fdYgXCOkPUkBAPNmr6S-66hMH4_KonOMsADASxc,10246
26
28
  lollms_client/lollms_stt_binding.py,sha256=jAUhLouEhh2hmm1bK76ianfw_6B59EHfY3FmLv6DU-g,5111
27
- lollms_client/lollms_tasks.py,sha256=Tgqces03gPTHFJCcPaeN9vBCsil3SSJX7nQAjCQ2-yg,34393
28
29
  lollms_client/lollms_tti_binding.py,sha256=afO0-d-Kqsmh8UHTijTvy6dZAt-XDB6R-IHmdbf-_fs,5928
29
30
  lollms_client/lollms_ttm_binding.py,sha256=FjVVSNXOZXK1qvcKEfxdiX6l2b4XdGOSNnZ0utAsbDg,4167
30
31
  lollms_client/lollms_tts_binding.py,sha256=5cJYECj8PYLJAyB6SEH7_fhHYK3Om-Y3arkygCnZ24o,4342
@@ -32,7 +33,7 @@ lollms_client/lollms_ttv_binding.py,sha256=KkTaHLBhEEdt4sSVBlbwr5i_g_TlhcrwrT-7D
32
33
  lollms_client/lollms_types.py,sha256=cfc1sremM8KR4avkYX99fIVkkdRvXErrCWKGjLrgv50,2723
33
34
  lollms_client/lollms_utilities.py,sha256=WiG-HHMdo86j3LBndcBQ-PbMqQ8kGKLp1e9WuLDzRVU,7048
34
35
  lollms_client/llm_bindings/__init__.py,sha256=9sWGpmWSSj6KQ8H4lKGCjpLYwhnVdL_2N7gXCphPqh4,14
35
- lollms_client/llm_bindings/llamacpp/__init__.py,sha256=rMfxOiLVsVwg_VOPSxMGcO401V6JFfpWXTvbpPZqI14,58424
36
+ lollms_client/llm_bindings/llamacpp/__init__.py,sha256=tUdCh00Tcg2VtavM5uRNsAoEkdeHI4p3nFsF9YUcYuk,58402
36
37
  lollms_client/llm_bindings/lollms/__init__.py,sha256=poGr9H3UshRUqmiAiiRW8_1Q8rBj3Q-mhBacdnp7C7Y,13157
37
38
  lollms_client/llm_bindings/ollama/__init__.py,sha256=8Kn8OI0PcT8QWVv5w7NDcsP99AvQ9TKMj-1VL3DZLfU,27770
38
39
  lollms_client/llm_bindings/openai/__init__.py,sha256=IGvsWbI0uw6x04IQ7u4GAM1AaVFSendLjkbKvjQ6-AM,13993
@@ -41,11 +42,19 @@ lollms_client/llm_bindings/pythonllamacpp/__init__.py,sha256=7dM42TCGKh0eV0njNL1
41
42
  lollms_client/llm_bindings/tensor_rt/__init__.py,sha256=nPaNhGRd-bsG0UlYwcEqjd_UagCMEf5VEbBUW-GWu6A,32203
42
43
  lollms_client/llm_bindings/transformers/__init__.py,sha256=9LkqEC5bp1zHgyeGEcPQ3_uqvEAEf_B4p9DztcBaC5w,37211
43
44
  lollms_client/llm_bindings/vllm/__init__.py,sha256=2NqeeqYWXNq1aNicdcAwN9DaoL4gq96GZ7hsKErfC6c,32187
45
+ lollms_client/mcp_bindings/local_mcp/__init__.py,sha256=FxS-0PULS3TZScPLDbwHlfyW5joWucmMfn6b9ydyeM0,14341
46
+ lollms_client/mcp_bindings/local_mcp/default_tools/file_writer/file_writer.py,sha256=2pkt1JcEKj61lIA5zuW3s6qkdpQN5rKfooo7bnebx24,3061
47
+ lollms_client/mcp_bindings/local_mcp/default_tools/generate_image_from_prompt/generate_image_from_prompt.py,sha256=THtZsMxNnXZiBdkwoBlfbWY2C5hhDdmPtnM-8cSKN6s,9488
48
+ lollms_client/mcp_bindings/local_mcp/default_tools/internet_search/internet_search.py,sha256=PLC31-D04QKTOTb1uuCHnrAlpysQjsk89yIJngK0VGc,4586
49
+ lollms_client/mcp_bindings/local_mcp/default_tools/python_interpreter/python_interpreter.py,sha256=McDCBVoVrMDYgU7EYtyOY7mCk1uEeTea0PSD69QqDsQ,6228
44
50
  lollms_client/stt_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
51
  lollms_client/stt_bindings/lollms/__init__.py,sha256=jBz3285atdPRqQe9ZRrb-AvjqKRB4f8tjLXjma0DLfE,6082
46
- lollms_client/stt_bindings/whisper/__init__.py,sha256=1NYczN4xm1gXCLmgymTF_zIIEbY5_s-lt5bFxIZ1uHw,15447
52
+ lollms_client/stt_bindings/whisper/__init__.py,sha256=vrua7fLwDId9_WiH4y2gXOE0hy3Gr2Ig-z5ScIT2bHI,15447
47
53
  lollms_client/stt_bindings/whispercpp/__init__.py,sha256=B45lOn5rSoHXJSG9duPzBEPBOoNTrDzpCUdOL8KHaDM,21874
48
54
  lollms_client/tti_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ lollms_client/tti_bindings/dalle/__init__.py,sha256=V-rODzcwaN9eg0wX8DGOQXXcDtnYYDWYD6t6pFNTo0w,23628
56
+ lollms_client/tti_bindings/diffusers/__init__.py,sha256=Hcu3F3KU8h6b_T4Dpl98OsQrsUoecd_z7xOVIEyYoDc,37679
57
+ lollms_client/tti_bindings/gemini/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
58
  lollms_client/tti_bindings/lollms/__init__.py,sha256=GJShFW6Y8MrfM9PXaPrdAp8OUpD6rraSRFt8ZOnrauo,8735
50
59
  lollms_client/ttm_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
60
  lollms_client/ttm_bindings/audiocraft/__init__.py,sha256=a0k6wTrHth6GaVOiNnVboeFY3oKVvCQPbQlqO38XEyc,14328
@@ -58,8 +67,8 @@ lollms_client/tts_bindings/piper_tts/__init__.py,sha256=0IEWG4zH3_sOkSb9WbZzkeV5
58
67
  lollms_client/tts_bindings/xtts/__init__.py,sha256=FgcdUH06X6ZR806WQe5ixaYx0QoxtAcOgYo87a2qxYc,18266
59
68
  lollms_client/ttv_bindings/__init__.py,sha256=UZ8o2izQOJLQgtZ1D1cXoNST7rzqW22rL2Vufc7ddRc,3141
60
69
  lollms_client/ttv_bindings/lollms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
- lollms_client-0.17.1.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
62
- lollms_client-0.17.1.dist-info/METADATA,sha256=il6ItLIYooPptltVkFNR-nLgFF6Kjcf_PyckEhbMlzA,9798
63
- lollms_client-0.17.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
64
- lollms_client-0.17.1.dist-info/top_level.txt,sha256=NI_W8S4OYZvJjb0QWMZMSIpOrYzpqwPGYaklhyWKH2w,23
65
- lollms_client-0.17.1.dist-info/RECORD,,
70
+ lollms_client-0.19.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
71
+ lollms_client-0.19.0.dist-info/METADATA,sha256=omhefcFH2TBEIAs0dRspAQN3mBHpJqga8Q_Qhy14bcE,9798
72
+ lollms_client-0.19.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ lollms_client-0.19.0.dist-info/top_level.txt,sha256=NI_W8S4OYZvJjb0QWMZMSIpOrYzpqwPGYaklhyWKH2w,23
74
+ lollms_client-0.19.0.dist-info/RECORD,,
@@ -1,52 +0,0 @@
1
- import cv2
2
- from lollms_client import LollmsClient, LollmsTTS, TasksLibrary, FunctionCalling_Library
3
- import random
4
-
5
- # Initialize the LollmsClient instance
6
- lc = LollmsClient()
7
- tl = TasksLibrary(lc)
8
- tts = LollmsTTS(lc)
9
- fcl = FunctionCalling_Library(tl)
10
- voices = tts.get_voices()
11
- if voices:
12
- # Pick a voice randomly
13
- random_voice = random.choice(voices)
14
- print(f"Selected voice: {random_voice}")
15
-
16
- # File path to save the captured image
17
- file_path = "captured_image.jpg"
18
- images = []
19
- # Capture image from webcam and save it to a file
20
- def capture_image():
21
- cap = cv2.VideoCapture(0)
22
- if not cap.isOpened():
23
- raise Exception("Could not open webcam")
24
-
25
- ret, frame = cap.read()
26
- if not ret:
27
- raise Exception("Failed to capture image")
28
- images.clear()
29
- images.append(file_path)
30
- cv2.imwrite(file_path, frame)
31
- cap.release()
32
- return "Image captured successfully"
33
-
34
-
35
- fcl.register_function("capture_image",capture_image,"Captures an image from the user webcam",[])
36
-
37
-
38
-
39
- # Function to handle streaming callback
40
- def cb(chunk, type):
41
- print(chunk, end="", flush=True)
42
-
43
- # Generate text with image
44
- response, function_calls = fcl.generate_with_functions_and_images(prompt="user: take a look at me then tell ma how i look.\nassistant: ", images=images, stream=False, temperature=0.5, streaming_callback=cb)
45
- print(f"response: {response}")
46
- if len(function_calls)>0:
47
- results = fcl.execute_function_calls(function_calls)
48
- result = "\n".join(results)
49
- prompt="user: take a look at me then tell ma how i look.\nassistant: "+response + f"\nfunction execution result: {result}\nassistant: "
50
- response, function_calls = fcl.generate_with_functions_and_images(prompt, images=images, stream=False, temperature=0.5, streaming_callback=cb)
51
- print(f"response: {response}")
52
- tts.text2Audio(response, random_voice)
@@ -1,72 +0,0 @@
1
- from functools import partial
2
- from lollms_client.lollms_tasks import TasksLibrary
3
- from typing import Dict, Any, List
4
-
5
- class FunctionCalling_Library:
6
- def __init__(self, tasks_library:TasksLibrary):
7
- self.tl = tasks_library
8
- self.function_definitions = []
9
-
10
- def register_function(self, function_name, function_callable, function_description, function_parameters):
11
- self.function_definitions.append({
12
- "function_name": function_name,
13
- "function": function_callable,
14
- "function_description": function_description,
15
- "function_parameters": function_parameters
16
- })
17
-
18
- def unregister_function(self, function_name):
19
- self.function_definitions = [func for func in self.function_definitions if func["function_name"] != function_name]
20
-
21
-
22
-
23
- def execute_function_calls(self, function_calls: List[Dict[str, Any]]) -> List[Any]:
24
- """
25
- Executes the function calls with the parameters extracted from the generated text,
26
- using the original functions list to find the right function to execute.
27
-
28
- Args:
29
- function_calls (List[Dict[str, Any]]): A list of dictionaries representing the function calls.
30
- function_definitions (List[Dict[str, Any]]): The original list of functions with their descriptions and callable objects.
31
-
32
- Returns:
33
- List[Any]: A list of results from executing the function calls.
34
- """
35
- results = []
36
- # Convert function_definitions to a dict for easier lookup
37
- functions_dict = {func['function_name']: func['function'] for func in self.function_definitions}
38
-
39
- for call in function_calls:
40
- function_name = call.get("function_name")
41
- parameters = call.get("function_parameters", [])
42
- function = functions_dict.get(function_name)
43
-
44
- if function:
45
- try:
46
- # Assuming parameters is a dictionary that maps directly to the function's arguments.
47
- if type(parameters)==list:
48
- result = function(*parameters)
49
- elif type(parameters)==dict:
50
- result = function(**parameters)
51
- results.append(result)
52
- except TypeError as e:
53
- # Handle cases where the function call fails due to incorrect parameters, etc.
54
- results.append(f"Error calling {function_name}: {e}")
55
- else:
56
- results.append(f"Function {function_name} not found.")
57
-
58
- return results
59
-
60
- def generate_with_functions(self, prompt, stream=False, temperature=0.5, streaming_callback=None):
61
- # Assuming generate_with_function_calls is a method from TasksLibrary
62
- ai_response, function_calls = self.tl.generate_with_function_calls(prompt, self.function_definitions, callback=streaming_callback)
63
- return ai_response, function_calls
64
-
65
- def generate_with_functions_and_images(self, prompt, images=[], stream=False, temperature=0.5, streaming_callback=None):
66
- # Assuming generate_with_function_calls_and_images is a method from TasksLibrary
67
- if len(images) > 0:
68
- ai_response, function_calls = self.tl.generate_with_function_calls_and_images(prompt, images, self.function_definitions, callback=streaming_callback)
69
- else:
70
- ai_response, function_calls = self.tl.generate_with_function_calls(prompt, self.function_definitions)
71
-
72
- return ai_response, function_calls