lollms-client 0.27.3__py3-none-any.whl → 0.28.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 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.27.3" # Updated version
11
+ __version__ = "0.28.0" # Updated version
12
12
 
13
13
  # Optionally, you could define __all__ if you want to be explicit about exports
14
14
  __all__ = [
@@ -442,16 +442,40 @@ class LollmsChatBinding(LollmsLLMBinding):
442
442
 
443
443
  def embed(self, text: str, **kwargs) -> list:
444
444
  """
445
- Get embeddings for the input text using OpenAI API
446
-
445
+ Get embeddings for the input text using OpenAI API.
446
+
447
447
  Args:
448
- text (str or List[str]): Input text to embed
449
- **kwargs: Additional arguments like model, truncate, options, keep_alive
450
-
448
+ text (str): Input text to embed.
449
+ **kwargs: Additional arguments. The 'model' argument can be used
450
+ to specify the embedding model (e.g., "text-embedding-3-small").
451
+ Defaults to "text-embedding-ada-002".
452
+
451
453
  Returns:
452
- dict: Response containing embeddings
454
+ list: The embedding vector as a list of floats, or an empty list on failure.
453
455
  """
454
- pass
456
+ # Determine the embedding model, prioritizing kwargs, with a default
457
+ embedding_model = kwargs.get("model", self.model_name)
458
+
459
+ try:
460
+ # The OpenAI API expects the input to be a list of strings
461
+ response = self.client.embeddings.create(
462
+ model=embedding_model,
463
+ input=[text] # Wrap the single text string in a list
464
+ )
465
+
466
+ # Extract the embedding from the response
467
+ if response.data and len(response.data) > 0:
468
+ return response.data[0].embedding
469
+ else:
470
+ ASCIIColors.warning("OpenAI API returned no data for the embedding request.")
471
+ return []
472
+
473
+ except Exception as e:
474
+ ASCIIColors.error(f"Failed to generate embeddings using OpenAI API: {e}")
475
+ trace_exception(e)
476
+ return []
477
+
478
+
455
479
  def get_model_info(self) -> dict:
456
480
  """
457
481
  Return information about the current OpenAI model.
@@ -472,16 +472,39 @@ class OpenAIBinding(LollmsLLMBinding):
472
472
 
473
473
  def embed(self, text: str, **kwargs) -> list:
474
474
  """
475
- Get embeddings for the input text using OpenAI API
476
-
475
+ Get embeddings for the input text using OpenAI API.
476
+
477
477
  Args:
478
- text (str or List[str]): Input text to embed
479
- **kwargs: Additional arguments like model, truncate, options, keep_alive
480
-
478
+ text (str): Input text to embed.
479
+ **kwargs: Additional arguments. The 'model' argument can be used
480
+ to specify the embedding model (e.g., "text-embedding-3-small").
481
+ Defaults to "text-embedding-ada-002".
482
+
481
483
  Returns:
482
- dict: Response containing embeddings
484
+ list: The embedding vector as a list of floats, or an empty list on failure.
483
485
  """
484
- pass
486
+ # Determine the embedding model, prioritizing kwargs, with a default
487
+ embedding_model = kwargs.get("model", self.model_name)
488
+
489
+ try:
490
+ # The OpenAI API expects the input to be a list of strings
491
+ response = self.client.embeddings.create(
492
+ model=embedding_model,
493
+ input=[text] # Wrap the single text string in a list
494
+ )
495
+
496
+ # Extract the embedding from the response
497
+ if response.data and len(response.data) > 0:
498
+ return response.data[0].embedding
499
+ else:
500
+ ASCIIColors.warning("OpenAI API returned no data for the embedding request.")
501
+ return []
502
+
503
+ except Exception as e:
504
+ ASCIIColors.error(f"Failed to generate embeddings using OpenAI API: {e}")
505
+ trace_exception(e)
506
+ return []
507
+
485
508
  def get_model_info(self) -> dict:
486
509
  """
487
510
  Return information about the current OpenAI model.
@@ -574,4 +597,4 @@ class OpenAIBinding(LollmsLLMBinding):
574
597
  """
575
598
  self.model = model_name
576
599
  self.model_name = model_name
577
- return True
600
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lollms_client
3
- Version: 0.27.3
3
+ Version: 0.28.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
@@ -29,7 +29,7 @@ examples/mcp_examples/openai_mcp.py,sha256=7IEnPGPXZgYZyiES_VaUbQ6viQjenpcUxGiHE
29
29
  examples/mcp_examples/run_remote_mcp_example_v2.py,sha256=bbNn93NO_lKcFzfIsdvJJijGx2ePFTYfknofqZxMuRM,14626
30
30
  examples/mcp_examples/run_standard_mcp_example.py,sha256=GSZpaACPf3mDPsjA8esBQVUsIi7owI39ca5avsmvCxA,9419
31
31
  examples/test_local_models/local_chat.py,sha256=slakja2zaHOEAUsn2tn_VmI4kLx6luLBrPqAeaNsix8,456
32
- lollms_client/__init__.py,sha256=KvZT0D6ahj16AharXFGhRMw2qc4a4HXDLYO75H5medY,1147
32
+ lollms_client/__init__.py,sha256=eAfY5Ik399J8AVHNU6vLjqiWNNmT88GX-h3NTKzLo2g,1147
33
33
  lollms_client/lollms_config.py,sha256=goEseDwDxYJf3WkYJ4IrLXwg3Tfw73CXV2Avg45M_hE,21876
34
34
  lollms_client/lollms_core.py,sha256=QliAE6hYiIGqQSDWWmjii1Hj8hsj3IxwBuUFshxJDlM,169099
35
35
  lollms_client/lollms_discussion.py,sha256=tvANNvpTkUr4L6GKowosIyfV7l3SA6cXnzElt36e2s8,52133
@@ -55,11 +55,11 @@ lollms_client/llm_bindings/hugging_face_inference_api/__init__.py,sha256=PxgeRqT
55
55
  lollms_client/llm_bindings/litellm/__init__.py,sha256=pNkwyRPeENvTM4CDh6Pj3kQfxHfhX2pvXhGJDjKjp30,12340
56
56
  lollms_client/llm_bindings/llamacpp/__init__.py,sha256=Qj5RvsgPeHGNfb5AEwZSzFwAp4BOWjyxmm9qBNtstrc,63716
57
57
  lollms_client/llm_bindings/lollms/__init__.py,sha256=7GNv-YyX4YyaR1EP2banQEHnX47QpUyNZU6toAiX1ak,17854
58
- lollms_client/llm_bindings/lollms_chat/__init__.py,sha256=UU3Ep1YkB_pAPkZEA9PpuY_f2KUXghVyzAnUD-u2-tg,23035
58
+ lollms_client/llm_bindings/lollms_chat/__init__.py,sha256=zCCrwAW-lOjAi7nUbvHii7E0kqJiMC0v4ENdbxTUsOs,24114
59
59
  lollms_client/llm_bindings/mistral/__init__.py,sha256=624Gr462yBh52ttHFOapKgJOn8zZ1vZcTEcC3i4FYt8,12750
60
60
  lollms_client/llm_bindings/ollama/__init__.py,sha256=1yxw_JXye_8l1YaEznK5QhOZmLV_opY-FkYnwy530eo,36109
61
61
  lollms_client/llm_bindings/open_router/__init__.py,sha256=v91BpNcuQCbbA6r82gbgMP8UYhSrJUMOf4UtOzEo18Q,13235
62
- lollms_client/llm_bindings/openai/__init__.py,sha256=pXuLDI7Js0LLXVDCHIMMB5rAQb_wC6JqGvK8B5S0Uy0,24596
62
+ lollms_client/llm_bindings/openai/__init__.py,sha256=kLG0-FyLMoSbEay1hcK46XjEBaLbFE3U51lUjAZ8HoI,25663
63
63
  lollms_client/llm_bindings/openllm/__init__.py,sha256=xv2XDhJNCYe6NPnWBboDs24AQ1VJBOzsTuMcmuQ6xYY,29864
64
64
  lollms_client/llm_bindings/pythonllamacpp/__init__.py,sha256=7dM42TCGKh0eV0njNL1tc9cInhyvBRIXzN3dcy12Gl0,33551
65
65
  lollms_client/llm_bindings/tensor_rt/__init__.py,sha256=nPaNhGRd-bsG0UlYwcEqjd_UagCMEf5VEbBUW-GWu6A,32203
@@ -92,8 +92,8 @@ lollms_client/tts_bindings/piper_tts/__init__.py,sha256=0IEWG4zH3_sOkSb9WbZzkeV5
92
92
  lollms_client/tts_bindings/xtts/__init__.py,sha256=FgcdUH06X6ZR806WQe5ixaYx0QoxtAcOgYo87a2qxYc,18266
93
93
  lollms_client/ttv_bindings/__init__.py,sha256=UZ8o2izQOJLQgtZ1D1cXoNST7rzqW22rL2Vufc7ddRc,3141
94
94
  lollms_client/ttv_bindings/lollms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
- lollms_client-0.27.3.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
96
- lollms_client-0.27.3.dist-info/METADATA,sha256=mkv0Y0vIE5s2o5TwsgZmODaY7e4crlfr1G5OWwMCD8Q,25778
97
- lollms_client-0.27.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
- lollms_client-0.27.3.dist-info/top_level.txt,sha256=NI_W8S4OYZvJjb0QWMZMSIpOrYzpqwPGYaklhyWKH2w,23
99
- lollms_client-0.27.3.dist-info/RECORD,,
95
+ lollms_client-0.28.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
96
+ lollms_client-0.28.0.dist-info/METADATA,sha256=Esa4mMjN3hLYTMUR8aGk9jNlE_kqCyYLLuWx-tL9Vzo,25778
97
+ lollms_client-0.28.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
+ lollms_client-0.28.0.dist-info/top_level.txt,sha256=NI_W8S4OYZvJjb0QWMZMSIpOrYzpqwPGYaklhyWKH2w,23
99
+ lollms_client-0.28.0.dist-info/RECORD,,