sunholo 0.89.8__py3-none-any.whl → 0.90.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.
@@ -187,19 +187,20 @@ if __name__ == "__main__":
187
187
  def generate_response_content():
188
188
 
189
189
  for chunk in start_streaming_chat(question=all_input["user_input"],
190
- vector_name=vector_name,
191
- qna_func=observed_stream_interpreter,
192
- chat_history=all_input["chat_history"],
193
- wait_time=all_input["stream_wait_time"],
194
- timeout=all_input["stream_timeout"],
195
- #kwargs
196
- **all_input["kwargs"]
197
- ):
190
+ vector_name=vector_name,
191
+ qna_func=observed_stream_interpreter,
192
+ chat_history=all_input["chat_history"],
193
+ wait_time=all_input["stream_wait_time"],
194
+ timeout=all_input["stream_timeout"],
195
+ trace_id=trace.id,
196
+ #kwargs
197
+ **all_input["kwargs"]
198
+ ):
198
199
  if isinstance(chunk, dict) and 'answer' in chunk:
199
200
  # When we encounter the dictionary, we yield it as a JSON string
200
201
  # and stop the generator.
201
202
  if trace:
202
- chunk["trace"] = trace.id
203
+ chunk["trace_id"] = trace.id
203
204
  chunk["trace_url"] = trace.get_trace_url()
204
205
  archive_qa(chunk, vector_name)
205
206
  if trace:
@@ -281,6 +282,7 @@ if __name__ == "__main__":
281
282
  question=all_input["user_input"],
282
283
  vector_name=vector_name,
283
284
  chat_history=all_input["chat_history"],
285
+ trace_id=trace.id,
284
286
  **all_input["kwargs"]
285
287
  )
286
288
  if span:
@@ -288,7 +290,7 @@ if __name__ == "__main__":
288
290
  # {"answer": "The answer", "source_documents": [{"page_content": "The page content", "metadata": "The metadata"}]}
289
291
  bot_output = parse_output(bot_output)
290
292
  if trace:
291
- bot_output["trace"] = trace.id
293
+ bot_output["trace_id"] = trace.id
292
294
  bot_output["trace_url"] = trace.get_trace_url()
293
295
  archive_qa(bot_output, vector_name)
294
296
  log.info(f'==LLM Q:{all_input["user_input"]} - A:{bot_output}')
@@ -409,6 +411,7 @@ if __name__ == "__main__":
409
411
  chat_history=all_input["chat_history"],
410
412
  wait_time=all_input.get("stream_wait_time", 1),
411
413
  timeout=all_input.get("stream_timeout", 60),
414
+ trace_id=all_input.get("trace_id"),
412
415
  **all_input["kwargs"]
413
416
  ):
414
417
  if isinstance(chunk, dict) and 'answer' in chunk:
@@ -454,6 +457,7 @@ if __name__ == "__main__":
454
457
  question=user_message,
455
458
  vector_name=vector_name,
456
459
  chat_history=all_input["chat_history"],
460
+ trace_id=all_input.get("trace_id"),
457
461
  **all_input["kwargs"]
458
462
  )
459
463
  bot_output = parse_output(bot_output)
sunholo/langfuse/evals.py CHANGED
@@ -40,7 +40,7 @@ def pubsub_to_evals(data: dict, eval_funcs: list=[eval_length]) -> dict:
40
40
 
41
41
  trace_id = the_json.pop('trace_id', None)
42
42
 
43
- return do_evals(trace_id, eval_funcs, **message_data)
43
+ return do_evals(trace_id, eval_funcs, **the_json)
44
44
 
45
45
 
46
46
  def direct_langfuse_evals(data, eval_funcs: list=[eval_length]):
@@ -68,13 +68,17 @@ def do_evals(trace_id, eval_funcs: list=[eval_length], **kwargs) -> dict:
68
68
  # Run the evaluation functions
69
69
  eval_results = []
70
70
  for eval_func in eval_funcs:
71
- eval_result = eval_func(trace) # Assuming eval_func returns a dict with 'score' and 'reason'
71
+ try:
72
+ eval_result = eval_func(trace) # Assuming eval_func returns a dict with 'score' and 'reason'
73
+ except Exception as e:
74
+ eval_result = {"score": 0, "reason":f"ERROR: {str(e)}"}
72
75
  eval_results.append(eval_result)
73
76
 
74
77
  eval_name = eval_func.__name__
75
78
 
76
79
  if 'score' and 'reason' not in eval_result:
77
- raise ValueError(f"Trace {trace.name} using {eval_name=} did not return a dict with 'score' and 'reason': {eval_result=}")
80
+ log.error(f"Trace {trace.name} using {eval_name=} did not return a dict with 'score' and 'reason': {eval_result=}")
81
+ eval_result = {"score": 0, "reason": f"malformed eval_result: {eval_result}"}
78
82
 
79
83
  log.info(f"TraceId {trace.id} with name {trace.name} had {eval_name=} with score {eval_result=}")
80
84
 
@@ -22,7 +22,7 @@ from .content_buffer import ContentBuffer, BufferStreamingStdOutCallbackHandler
22
22
  from ..qna.parsers import parse_output
23
23
 
24
24
  from ..custom_logging import log
25
- from ..utils import load_config_key, ConfigManager
25
+ from ..utils import ConfigManager
26
26
  from ..utils.parsers import check_kwargs_support
27
27
 
28
28
  from .langserve import parse_langserve_token, parse_langserve_token_async
sunholo/utils/parsers.py CHANGED
@@ -217,10 +217,10 @@ def escape_braces(text):
217
217
  """
218
218
  # First, handle cases where there might be a mix of braces
219
219
  # Replace all `{` that are not followed by another `{` with `{{`
220
- text = re.sub(r'(?<!{){(?!{)', '{{', text)
220
+ text = re.sub(r'(?<!{){(?!{)', '<<', text)
221
221
 
222
222
  # Replace all `}` that are not preceded by another `}` with `}}`
223
- text = re.sub(r'(?<!})}(?!})', '}}', text)
223
+ text = re.sub(r'(?<!})}(?!})', '>>', text)
224
224
 
225
225
  # After escaping single braces, return the modified text
226
226
  return text
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.89.8
3
+ Version: 0.90.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.89.8.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.90.0.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -14,7 +14,7 @@ sunholo/agents/fastapi/qna_routes.py,sha256=lKHkXPmwltu9EH3RMwmD153-J6pE7kWQ4BhB
14
14
  sunholo/agents/flask/__init__.py,sha256=poJDKMr2qj8qMb99JqCvCPSiEt1tj2tLQ3hKW3f2aVw,107
15
15
  sunholo/agents/flask/base.py,sha256=FgSaCODyoTtlstJtsqlLPScdgRUtv9_plxftdzHdVFo,809
16
16
  sunholo/agents/flask/qna_routes.py,sha256=uwUD1yrzOPH27m2AXpiQrPk_2VfJOQOM6dAynOWQtoQ,22532
17
- sunholo/agents/flask/vac_routes.py,sha256=z3omGsb6Ze3Hpxx_em1vve9aPnRQQjYKdz0dkStmJ-I,22811
17
+ sunholo/agents/flask/vac_routes.py,sha256=V1MeYcMbrARdvLjxeN_pcmIuG4QXBkMqsh3m5mb7d8g,23031
18
18
  sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
19
19
  sunholo/archive/archive.py,sha256=PxVfDtO2_2ZEEbnhXSCbXLdeoHoQVImo4y3Jr2XkCFY,1204
20
20
  sunholo/auth/__init__.py,sha256=TeP-OY0XGxYV_8AQcVGoh35bvyWhNUcMRfhuD5l44Sk,91
@@ -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=TkZnJErN2n3IEEMIOaFtes--5bHvMpPcJz6hGliNtFc,3164
97
+ sunholo/langfuse/evals.py,sha256=YTaqOxSoeVxjuynASWjia07z9Q4NusOi_gQUUWaCTY4,3359
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
@@ -117,7 +117,7 @@ sunholo/streaming/__init__.py,sha256=MpbydI2UYo_adttPQFkxNM33b-QRyNEbrKJx0C2AGPc
117
117
  sunholo/streaming/content_buffer.py,sha256=A9rVhlmLZxaFPvGYjVqCs5GfIsA1EMl_tyk-0VCDvo4,6462
118
118
  sunholo/streaming/langserve.py,sha256=hi7q8WY8DPKrALl9m_dOMxWOdE-iEuk7YW05SVDFIX8,6514
119
119
  sunholo/streaming/stream_lookup.py,sha256=hYg1DbdSE_QNJ8ZB-ynXJlWgvFjrGvwoUsGJu_E0pRQ,360
120
- sunholo/streaming/streaming.py,sha256=5dRXo1wHYE0E91gll-939RShYTYxQMeVwAVCqFR13h0,16343
120
+ sunholo/streaming/streaming.py,sha256=TNnjlMH4tC4vDqLICyeLCj2tj9EcTLLvyH6zDSpsxh4,16326
121
121
  sunholo/summarise/__init__.py,sha256=MZk3dblUMODcPb1crq4v-Z508NrFIpkSWNf9FIO8BcU,38
122
122
  sunholo/summarise/summarise.py,sha256=95A-6PXFGanjona8DvZPnnIHLbzZ2ip5hO0wOAJQhfw,3791
123
123
  sunholo/terraform/__init__.py,sha256=yixxEltc3n9UpZaVi05GlgS-YRq_DVGjUc37I9ajeP4,76
@@ -132,7 +132,7 @@ sunholo/utils/config_class.py,sha256=4uY7i7y18bDLvGNY1PiQ8c4LM-whopsjEWZerHEckwQ
132
132
  sunholo/utils/config_schema.py,sha256=Wv-ncitzljOhgbDaq9qnFqH5LCuxNv59dTGDWgd1qdk,4189
133
133
  sunholo/utils/gcp.py,sha256=uueODEpA-P6O15-t0hmcGC9dONLO_hLfzSsSoQnkUss,4854
134
134
  sunholo/utils/gcp_project.py,sha256=Fa0IhCX12bZ1ctF_PKN8PNYd7hihEUfb90kilBfUDjg,1411
135
- sunholo/utils/parsers.py,sha256=LxzkCTBQ4uYhf0FfqiO4yWeP_yqVaMz_fw7sMu7mq5E,6421
135
+ sunholo/utils/parsers.py,sha256=wES0fRn3GONoymRXOXt-z62HCoOiUvvFXa-MfKfjCls,6421
136
136
  sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,493
137
137
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
138
138
  sunholo/utils/version.py,sha256=P1QAJQdZfT2cMqdTSmXmcxrD2PssMPEGM-WI6083Fck,237
@@ -144,9 +144,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
144
144
  sunholo/vertex/memory_tools.py,sha256=q_phxgGX2TG2j2MXNULF2xGzQnQPENwjPN9nZ_A9Gh0,7526
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.89.8.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.89.8.dist-info/METADATA,sha256=kDmLpDCiMlsC_h6EK4A4l2EGqwQEgOXZJhUHzklEkk4,7706
149
- sunholo-0.89.8.dist-info/WHEEL,sha256=ixB2d4u7mugx_bCBycvM9OzZ5yD7NmPXFRtKlORZS2Y,91
150
- sunholo-0.89.8.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.89.8.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.89.8.dist-info/RECORD,,
147
+ sunholo-0.90.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.90.0.dist-info/METADATA,sha256=PHAIaEQ-hoCAqwc1KGrVNO5zCU9i_o1m12_P6kjWriw,7706
149
+ sunholo-0.90.0.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
150
+ sunholo-0.90.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.90.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.90.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.0)
2
+ Generator: setuptools (74.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5