sunholo 0.95.4__py3-none-any.whl → 0.96.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.
@@ -523,7 +523,7 @@ class GenAIFunctionProcessor:
523
523
 
524
524
  usage_metadata["functions_called"] = functions_called
525
525
 
526
- big_text = "\n".join(big_result[loop_return:])
526
+ big_text = "\n".join(big_result[-loop_return:])
527
527
 
528
528
  return big_text, usage_metadata
529
529
 
sunholo/langfuse/evals.py CHANGED
@@ -4,6 +4,8 @@ import json
4
4
  from ..pubsub import decode_pubsub_message
5
5
  from langfuse import Langfuse
6
6
  import traceback
7
+
8
+
7
9
  from ..custom_logging import log
8
10
 
9
11
  # Example of how eval_funcs might be structured
@@ -60,6 +62,7 @@ def do_evals(trace_id, eval_funcs: list=[eval_length], **kwargs) -> dict:
60
62
  host=os.environ["LANGFUSE_HOST"]
61
63
  )
62
64
 
65
+ log.info(f"do_evals langfuse with {kwargs=}")
63
66
  # Fetch the latest trace (or modify as needed to fetch a specific trace)
64
67
  trace = langfuse.get_trace(id=trace_id)
65
68
 
@@ -67,31 +70,39 @@ def do_evals(trace_id, eval_funcs: list=[eval_length], **kwargs) -> dict:
67
70
  raise ValueError("Trace {trace.name} had no generated output, it was skipped")
68
71
 
69
72
  # Run the evaluation functions
70
- eval_results = []
73
+ # an eval_response can have multiple eval_results
74
+ eval_responses = []
71
75
  for eval_func in eval_funcs:
72
76
  try:
73
- eval_result = eval_func(trace) # Assuming eval_func returns a dict with 'score' and 'reason'
77
+ eval_response = eval_func(trace, **kwargs) # Assuming eval_func returns a dict with 'score' and 'reason'
74
78
  except Exception as e:
75
- eval_result = {"score": 0, "reason":f"ERROR: {str(e)} traceback: {traceback.format_exc()}"}
76
- eval_results.append(eval_result)
79
+ eval_response = {"score": 0, "reason":f"ERROR: {str(e)} traceback: {traceback.format_exc()}"}
80
+ eval_responses.append(eval_response)
77
81
 
78
82
  eval_name = eval_func.__name__
79
83
 
80
- if 'score' and 'reason' not in eval_result:
81
- log.error(f"Trace {trace.name} using {eval_name=} did not return a dict with 'score' and 'reason': {eval_result=}")
82
- eval_result = {"score": 0, "reason": f"malformed eval_result: {eval_result}"}
83
-
84
- log.info(f"TraceId {trace.id} with name {trace.name} had {eval_name=} with score {eval_result=}")
84
+ if isinstance(eval_response, list):
85
+ eval_results = eval_response
86
+ else:
87
+ eval_results = [eval_response]
85
88
 
86
- # Submit the evaluation to Langfuse
87
- langfuse.score(
88
- trace_id=trace.id,
89
- name=eval_name, # Use the function name as the evaluation name
90
- value=eval_result["score"],
91
- comment=eval_result["reason"],
92
- **kwargs
93
- )
89
+ for eval_result in eval_results:
90
+
91
+ if 'score' and 'reason' not in eval_result:
92
+ log.error(f"Trace {trace.name} using {eval_name=} did not return a dict with 'score' and 'reason': {eval_result=}")
93
+ eval_result = {"score": 0, "reason": f"malformed eval_result: {eval_result}"}
94
+
95
+ log.info(f"TraceId {trace.id} with name {trace.name} had {eval_name=} with score {eval_result=}")
96
+
97
+ # Submit the evaluation to Langfuse
98
+ langfuse.score(
99
+ trace_id=trace.id,
100
+ name=eval_name, # Use the function name as the evaluation name
101
+ value=eval_result["score"],
102
+ comment=eval_result["reason"],
103
+ **kwargs
104
+ )
94
105
 
95
- return {"trace_id": trace.id, "eval_results": eval_results}
106
+ return {"trace_id": trace.id, "eval_results": eval_responses}
96
107
 
97
108
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.95.4
3
+ Version: 0.96.0
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.95.4.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.96.0.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -86,7 +86,7 @@ sunholo/gcs/download_url.py,sha256=q1NiJSvEhdNrmU5ZJ-sBCMC_J5CxzrajY8LRgdPOV_M,6
86
86
  sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
87
87
  sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
88
88
  sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
89
- sunholo/genai/process_funcs_cls.py,sha256=OCLa_yPjVlE7wY1v54SY0M6b5lpU2l3guRHb-qYOk2A,24359
89
+ sunholo/genai/process_funcs_cls.py,sha256=M6vE_-Mi8v1Od8iny3h9-pRA5KbO5n4hiJKr1yPN9BU,24360
90
90
  sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
91
91
  sunholo/invoke/__init__.py,sha256=VOpsfhNf98az3at7bMaY1Fiw4UIZAS6zMmSqWd6_ksI,141
92
92
  sunholo/invoke/async_class.py,sha256=uvCP8ekUCfTRWk7xwofTzRqFykMAwrRZ4Ce_YUR6PVs,2820
@@ -94,7 +94,7 @@ sunholo/invoke/direct_vac_func.py,sha256=fuTJlH5PsqWhN_yVMaWisHCTZU1JEUz8I8yVbWs
94
94
  sunholo/invoke/invoke_vac_utils.py,sha256=sJc1edHTHMzMGXjji1N67c3iUaP7BmAL5nj82Qof63M,2053
95
95
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
96
  sunholo/langfuse/callback.py,sha256=jl0SZsFS53uMW9DGeM9SOL_EsRZsba0wwFGLqKzu9_U,1684
97
- sunholo/langfuse/evals.py,sha256=y1T6qUA-k41BD2_5warjd1CQN4N107zsDizg9j5jCW4,3412
97
+ sunholo/langfuse/evals.py,sha256=MNV3YaZ0b46WcuGZaurSVitWpFpbNaceiB47A2Zynjg,3789
98
98
  sunholo/langfuse/prompts.py,sha256=27BsVfihM6-h1jscbkGSO4HsATl-d4ZN6tcNCVztWoY,1300
99
99
  sunholo/llamaindex/__init__.py,sha256=DlY_cHWCsVEV1C5WBgDdHRgOMlJc8pDoCRukUJ8PT9w,88
100
100
  sunholo/llamaindex/get_files.py,sha256=6rhXCDqQ_lrIapISQ_OYQDjiSATXvS_9m3qq53-oIl0,781
@@ -144,9 +144,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
144
144
  sunholo/vertex/memory_tools.py,sha256=ZirFbS7EKxQaoRmOrb4BnG6jPJ83wt43N8M4zTVbutU,7717
145
145
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
146
146
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
147
- sunholo-0.95.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.95.4.dist-info/METADATA,sha256=0uNENTJHgisWBlLoAF-E2HpFxgxWiuAhxpJ9Tw9-LbE,7889
149
- sunholo-0.95.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
- sunholo-0.95.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.95.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.95.4.dist-info/RECORD,,
147
+ sunholo-0.96.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.96.0.dist-info/METADATA,sha256=vNdFJP76HWDA62pJ1med8qqeKi1Cp1IuzDPgjfBZ2-Q,7889
149
+ sunholo-0.96.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
+ sunholo-0.96.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.96.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.96.0.dist-info/RECORD,,