sunholo 0.90.4__py3-none-any.whl → 0.90.6__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.
@@ -529,12 +529,10 @@ if __name__ == "__main__":
529
529
 
530
530
  trace = None
531
531
  span = None
532
- if 'trace_id' in data:
533
- trace_id = data.pop('trace_id')
534
- trace = self.create_langfuse_trace(request, vector_name, trace_id)
535
- log.info(f"Using existing langfuse trace: {trace_id}")
536
- else:
537
- trace = self.create_langfuse_trace(request, vector_name)
532
+
533
+ trace_id = data.get('trace_id')
534
+ trace = self.create_langfuse_trace(request, vector_name, trace_id)
535
+ log.info(f"Using existing langfuse trace: {trace_id}")
538
536
 
539
537
  config, _ = load_config("config/llm_config.yaml")
540
538
  vac_configs = config.get("vac")
@@ -550,6 +548,7 @@ if __name__ == "__main__":
550
548
  chat_history = data.pop('chat_history', None)
551
549
  eval_percent = data.pop('eval_percent', 0.01)
552
550
  vector_name = data.pop('vector_name', vector_name)
551
+ data.pop('trace_id', None) # to ensure not in kwargs
553
552
 
554
553
  paired_messages = extract_chat_history(chat_history)
555
554
 
sunholo/components/llm.py CHANGED
@@ -114,9 +114,18 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None, config=None):
114
114
  elif llm_str == 'anthropic':
115
115
  from langchain_anthropic import ChatAnthropic
116
116
  if model is None:
117
- model = 'claude-3-opus-20240229'
117
+ model = 'claude-3-5-sonnet-20240620'
118
118
  log.info(f"No 'model' value in config file - selecting default {model}")
119
119
  return ChatAnthropic(model_name = model, temperature=0)
120
+ elif llm_str == 'anthropic-vertex':
121
+ from langchain_google_vertexai.model_garden import ChatAnthropicVertex
122
+ if model is None:
123
+ model = "claude-3-5-sonnet@20240620"
124
+ log.info(f"No 'model' value in config file - selecting default {model}")
125
+ gcp_config = config.vacConfig("gcp_config")
126
+ return ChatAnthropicVertex(model_name=model,
127
+ project=gcp_config.get('project_id'),
128
+ location=gcp_config.get('location'))
120
129
 
121
130
  if llm_str is None:
122
131
  raise NotImplementedError(f'No llm implemented for {llm_str}')
sunholo/langfuse/evals.py CHANGED
@@ -3,6 +3,7 @@ import json
3
3
 
4
4
  from ..pubsub import decode_pubsub_message
5
5
  from langfuse import Langfuse
6
+ import traceback
6
7
  from ..custom_logging import log
7
8
 
8
9
  # Example of how eval_funcs might be structured
@@ -71,7 +72,7 @@ def do_evals(trace_id, eval_funcs: list=[eval_length], **kwargs) -> dict:
71
72
  try:
72
73
  eval_result = eval_func(trace) # Assuming eval_func returns a dict with 'score' and 'reason'
73
74
  except Exception as e:
74
- eval_result = {"score": 0, "reason":f"ERROR: {str(e)}"}
75
+ eval_result = {"score": 0, "reason":f"ERROR: {str(e)} traceback: {traceback.format_exc()}"}
75
76
  eval_results.append(eval_result)
76
77
 
77
78
  eval_name = eval_func.__name__
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.90.4
3
+ Version: 0.90.6
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.90.4.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.90.6.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -24,6 +24,7 @@ Requires-Dist: langchain >=0.2.12
24
24
  Requires-Dist: langchain-experimental >=0.0.61
25
25
  Requires-Dist: langchain-community >=0.2.11
26
26
  Provides-Extra: all
27
+ Requires-Dist: anthropic[vertex] ; extra == 'all'
27
28
  Requires-Dist: asyncpg ; extra == 'all'
28
29
  Requires-Dist: azure-identity ; extra == 'all'
29
30
  Requires-Dist: azure-storage-blob ; extra == 'all'
@@ -96,6 +97,7 @@ Requires-Dist: xlwings ; extra == 'excel'
96
97
  Requires-Dist: requests ; extra == 'excel'
97
98
  Requires-Dist: rich ; extra == 'excel'
98
99
  Provides-Extra: gcp
100
+ Requires-Dist: anthropic[vertex] ; extra == 'gcp'
99
101
  Requires-Dist: google-api-python-client ; extra == 'gcp'
100
102
  Requires-Dist: google-cloud-alloydb-connector[pg8000] ; extra == 'gcp'
101
103
  Requires-Dist: google-auth-httplib2 ; extra == 'gcp'
@@ -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=MLJ55ytBMI-CBScXGAMVLFtxa-FFfkoEiZoL5cAPz5o,23237
17
+ sunholo/agents/flask/vac_routes.py,sha256=r8CRzqovtPzTFCto6UoPcA4z8jEPHgzETetwK0SNrUg,23173
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
@@ -54,7 +54,7 @@ sunholo/cli/sun_rich.py,sha256=UpMqeJ0C8i0pkue1AHnnyyX0bFJ9zZeJ7HBR6yhuA8A,54
54
54
  sunholo/cli/swagger.py,sha256=absYKAU-7Yd2eiVNUY-g_WLl2zJfeRUNdWQ0oH8M_HM,1564
55
55
  sunholo/cli/vertex.py,sha256=8130YCarxHL1UC3aqblNmUwGZTXbkdL4Y_FOnZJsWiI,2056
56
56
  sunholo/components/__init__.py,sha256=IDoylb74zFKo6NIS3RQqUl0PDFBGVxM1dfUmO7OJ44U,176
57
- sunholo/components/llm.py,sha256=5wRVf7lIb7q1vRADNcdQp26L9l4vGHFIvjtUDurZN_s,11488
57
+ sunholo/components/llm.py,sha256=5QkYgMoqFeFVl71w0zrLN-aKMieSlMiL2gM4aB-6uk8,12023
58
58
  sunholo/components/retriever.py,sha256=bKIVT7_18Ut3OJd0E0jyiISPnD9qkHWVjcQPT4i1_G8,7720
59
59
  sunholo/components/vectorstore.py,sha256=xKk7micTRwZckaI7U6PxvFz_ZSjCH48xPTDYiDcv2tc,5913
60
60
  sunholo/database/__init__.py,sha256=bpB5Nk21kwqYj-qdVnvNgXjLsbflnH4g-San7OHMqR4,283
@@ -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=YTaqOxSoeVxjuynASWjia07z9Q4NusOi_gQUUWaCTY4,3359
97
+ sunholo/langfuse/evals.py,sha256=y1T6qUA-k41BD2_5warjd1CQN4N107zsDizg9j5jCW4,3412
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=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.90.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.90.4.dist-info/METADATA,sha256=Zi5cT9oDUXzjMwZSIvfj93fzi22DlXOzpSm2_X-J-Ts,7706
149
- sunholo-0.90.4.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
- sunholo-0.90.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.90.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.90.4.dist-info/RECORD,,
147
+ sunholo-0.90.6.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.90.6.dist-info/METADATA,sha256=oeL4J2tqfAvbatVNoApFgnG2_1A2mN3lpeoVZmLFhdE,7806
149
+ sunholo-0.90.6.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
+ sunholo-0.90.6.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.90.6.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.90.6.dist-info/RECORD,,