sunholo 0.110.3__py3-none-any.whl → 0.110.4__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.
@@ -1,5 +1,11 @@
1
1
  from ..custom_logging import log
2
2
  from ..utils import ConfigManager
3
+ import threading
4
+ try:
5
+ from langfuse import Langfuse
6
+ langfuse = Langfuse()
7
+ except ImportError:
8
+ langfuse = None
3
9
 
4
10
  # Load the YAML file
5
11
  def load_prompt_from_yaml(key, prefix="sunholo", load_from_file=False, f_string=True):
@@ -50,31 +56,33 @@ def load_prompt_from_yaml(key, prefix="sunholo", load_from_file=False, f_string=
50
56
  ```
51
57
 
52
58
  """
53
- config = ConfigManager(prefix)
59
+ # Initialize Langfuse client
54
60
  if load_from_file:
61
+ config = ConfigManager(prefix)
55
62
 
56
63
  return config.promptConfig(key)
57
64
 
58
-
59
- from langfuse import Langfuse
60
-
61
- # Initialize Langfuse client
62
- langfuse = Langfuse()
63
-
64
- try:
65
- if prefix is None:
66
- langfuse_template = key
67
- else:
68
- langfuse_template = f"{prefix}-{key}"
69
-
70
- langfuse_prompt = langfuse.get_prompt(langfuse_template, cache_ttl_seconds=300)
71
-
72
- if f_string:
73
- return langfuse_prompt.get_langchain_prompt()
65
+ if langfuse is None:
66
+ log.warning("No Langfuse import available - install via sunholo[http]")
67
+ else:
68
+ langfuse_result = [None]
74
69
 
75
- return langfuse_prompt
76
-
77
- except Exception as err:
78
- log.warning(f"Could not find langfuse template: {langfuse_template} - {str(err)} - attempting to load from promptConfig")
70
+ def langfuse_load():
71
+ try:
72
+ template = f"{prefix}-{key}" if prefix else key
73
+ prompt = langfuse.get_prompt(template, cache_ttl_seconds=300)
74
+ langfuse_result[0] = prompt.get_langchain_prompt() if f_string else prompt
75
+ except Exception as err:
76
+ log.warning(f"Langfuse error: {template} - {str(err)}")
77
+ config = ConfigManager(prefix)
78
+ langfuse_result[0] = config.promptConfig(key)
79
+
80
+ thread = threading.Thread(target=langfuse_load)
81
+ thread.start()
82
+ thread.join(timeout=1)
83
+
84
+ if langfuse_result[0]:
85
+ return langfuse_result[0]
79
86
 
87
+ config = ConfigManager(prefix)
80
88
  return config.promptConfig(key)
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.110.3
3
+ Version: 0.110.4
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
5
5
  Home-page: https://github.com/sunholo-data/sunholo-py
6
- Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.110.3.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.110.4.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -98,7 +98,7 @@ sunholo/invoke/invoke_vac_utils.py,sha256=sJc1edHTHMzMGXjji1N67c3iUaP7BmAL5nj82Q
98
98
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
99
  sunholo/langfuse/callback.py,sha256=jl0SZsFS53uMW9DGeM9SOL_EsRZsba0wwFGLqKzu9_U,1684
100
100
  sunholo/langfuse/evals.py,sha256=fQBaC0dBTYfgCzyfv9QBRvUfc9f42lbwQAeZmynaHO8,3841
101
- sunholo/langfuse/prompts.py,sha256=J-oePqMyd2xPoTDb5G4fM-LNsC9jEa-udZ4dpbQle-w,2332
101
+ sunholo/langfuse/prompts.py,sha256=E3ZBd51k8NWkeO7K-uYkUPJhbqJWXee8X0N79pVCaIA,2744
102
102
  sunholo/llamaindex/__init__.py,sha256=DlY_cHWCsVEV1C5WBgDdHRgOMlJc8pDoCRukUJ8PT9w,88
103
103
  sunholo/llamaindex/get_files.py,sha256=6rhXCDqQ_lrIapISQ_OYQDjiSATXvS_9m3qq53-oIl0,781
104
104
  sunholo/llamaindex/import_files.py,sha256=Bnic5wz8c61af9Kwq8KSrNBbc4imYnzMtBCb2jzSImI,6224
@@ -150,9 +150,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
150
150
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
151
151
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
152
152
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
153
- sunholo-0.110.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
154
- sunholo-0.110.3.dist-info/METADATA,sha256=I_HMqWpF2MWGwqupE_vIkJ9CLfgpJqlj63UehFNCP_M,8705
155
- sunholo-0.110.3.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
156
- sunholo-0.110.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
157
- sunholo-0.110.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
158
- sunholo-0.110.3.dist-info/RECORD,,
153
+ sunholo-0.110.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
154
+ sunholo-0.110.4.dist-info/METADATA,sha256=4EZvfegaiERNSi6qN-RUVWy1CojNXbCjGg4sZ89g2cI,8705
155
+ sunholo-0.110.4.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
156
+ sunholo-0.110.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
157
+ sunholo-0.110.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
158
+ sunholo-0.110.4.dist-info/RECORD,,