sunholo 0.57.0__py3-none-any.whl → 0.57.2__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.
sunholo/__init__.py CHANGED
@@ -0,0 +1,40 @@
1
+ from . import agents
2
+ from . import archive
3
+ from . import auth
4
+ from . import bots
5
+ from . import chunker
6
+ from . import cli
7
+ from . import components
8
+ from . import database
9
+ from . import embedder
10
+ from . import gcs
11
+ from . import langfuse
12
+ from . import llamaindex
13
+ from . import lookup
14
+ from . import patches
15
+ from . import pubsub
16
+ from . import qna
17
+ from . import streaming
18
+ from . import utils
19
+ import logging
20
+
21
+ __all__ = ['agents',
22
+ 'archive',
23
+ 'auth',
24
+ 'bots',
25
+ 'chunker',
26
+ 'cli',
27
+ 'components',
28
+ 'database',
29
+ 'embedder',
30
+ 'gcs',
31
+ 'langfuse',
32
+ 'llamaindex',
33
+ 'lookup',
34
+ 'patches',
35
+ 'pubsub',
36
+ 'qna',
37
+ 'streaming',
38
+ 'utils',
39
+ 'logging']
40
+
@@ -29,9 +29,16 @@ try:
29
29
  except ImportError:
30
30
  print("No flask installed for agents.flask.register_qna_routes, install via `pip install sunholo[http]`")
31
31
 
32
+ try:
33
+ from langfuse.decorators import langfuse_context, observe
34
+ except ImportError as err:
35
+ print(f"No langfuse installed for agents.flask.register_qna_routes, install via `pip install sunholo[http]` - {str(err)}")
36
+
37
+
32
38
  def register_qna_routes(app, stream_interpreter, vac_interpreter):
33
39
 
34
40
  @app.route('/vac/streaming/<vector_name>', methods=['POST'])
41
+ @observe()
35
42
  def stream_qa(vector_name):
36
43
  prep = prep_vac(request, vector_name)
37
44
  log.debug(f"Processing prep: {prep}")
@@ -54,9 +61,9 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
54
61
  model=vac_config.get("model") or vac_config.get("llm")
55
62
  )
56
63
 
64
+ @observe()
57
65
  def generate_response_content():
58
66
 
59
- chunks = ""
60
67
  for chunk in start_streaming_chat(question=all_input["user_input"],
61
68
  vector_name=vector_name,
62
69
  qna_func=stream_interpreter,
@@ -82,9 +89,6 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
82
89
 
83
90
  else:
84
91
  # Otherwise, we yield the plain text chunks as they come in.
85
- if chunk:
86
- chunks += chunk
87
-
88
92
  yield chunk
89
93
 
90
94
  # Here, the generator function will handle streaming the content to the client.
@@ -100,6 +104,7 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
100
104
  return response
101
105
 
102
106
  @app.route('/vac/<vector_name>', methods=['POST'])
107
+ @observe()
103
108
  def process_qna(vector_name):
104
109
  prep = prep_vac(request, vector_name)
105
110
  log.debug(f"Processing prep: {prep}")
@@ -177,7 +182,9 @@ def create_langfuse_trace(request, vector_name):
177
182
  )
178
183
 
179
184
  def prep_vac(request, vector_name):
180
- trace = create_langfuse_trace(request, vector_name)
185
+ #trace = create_langfuse_trace(request, vector_name)
186
+ trace = None
187
+ span = None
181
188
  data = request.get_json()
182
189
  log.info(f"vac/{vector_name} got data: {data}")
183
190
  config, _ = load_config("config/llm_config.yaml")
@@ -94,7 +94,11 @@ def pick_vectorstore(vs_str, vector_name, embeddings):
94
94
  log.error(f"Could not locate LANCEDB_BUCKET environment variable for {vector_name}")
95
95
  log.info(f"LANCEDB_BUCKET environment variable found for {vector_name} - {LANCEDB_BUCKET}")
96
96
 
97
- db = lancedb.connect(LANCEDB_BUCKET)
97
+ try:
98
+ log.info(f"Attempting LanceDB connection to {vector_name} for {LANCEDB_BUCKET}")
99
+ db = lancedb.connect(LANCEDB_BUCKET)
100
+ except Exception as err:
101
+ log.error(f"Could not connect to {LANCEDB_BUCKET} - {str(err)}")
98
102
 
99
103
  log.info(f"LanceDB Tables: {db.table_names()} using {LANCEDB_BUCKET}")
100
104
  log.info(f"Opening LanceDB table: {vector_name} using {LANCEDB_BUCKET}")
@@ -51,7 +51,6 @@ class ContentBuffer:
51
51
  Adds the given text to the existing content of the buffer.
52
52
  """
53
53
  self.content += text
54
- log.debug(f"Written {text} to buffer")
55
54
 
56
55
  def read(self) -> str:
57
56
  """
@@ -61,8 +60,7 @@ class ContentBuffer:
61
60
  str: The content of the buffer.
62
61
 
63
62
  Provides the entire content stored in the buffer.
64
- """
65
- log.debug(f"Read content from buffer")
63
+ """
66
64
  return self.content
67
65
 
68
66
  def clear(self):
@@ -71,7 +69,6 @@ class ContentBuffer:
71
69
 
72
70
  Empties the buffer content, resetting it to an empty string.
73
71
  """
74
- log.debug(f"Clearing content buffer")
75
72
  self.content = ""
76
73
 
77
74
 
@@ -306,8 +306,8 @@ async def generate_proxy_stream_async(stream_to_f, user_input, vector_name, chat
306
306
  ):
307
307
  print(output) # Process each streaming output chunk
308
308
  """
309
- agent = load_config_key("agent", vector_name=vector_name, filename="config/llm_config.yaml")
310
- agent_type = load_config_key("agent_type", vector_name=vector_name, filename="config/llm_config.yaml")
309
+ agent = load_config_key("agent", vector_name=vector_name, type = "vacConfig")
310
+ agent_type = load_config_key("agent_type", vector_name=vector_name, type = "vacConfig")
311
311
 
312
312
  async def generate():
313
313
  json_buffer = ""
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.57.0
3
+ Version: 0.57.2
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.57.0.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.57.2.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -1,4 +1,4 @@
1
- sunholo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1
+ sunholo/__init__.py,sha256=n5NRH5j9yi04KFNp1t8-lBQYWxSW01c2LGB1R90iGeM,820
2
2
  sunholo/logging.py,sha256=_poZ61TbLl6yHox2eO78BvIGQCUCrAIjWio70sGJIag,11233
3
3
  sunholo/agents/__init__.py,sha256=CnlbVohPt-Doth9PyROSlN3P8xMV9j9yS19YE-wCS90,341
4
4
  sunholo/agents/chat_history.py,sha256=PbwYmw1TwzI8H-cwQIGgHZ6UIr2Qb-JWow0RG3ayLM8,5195
@@ -13,7 +13,7 @@ sunholo/agents/fastapi/base.py,sha256=clk76cHbUAvU0OYJrRfCWX_5f0ACbhDsIzYBhI3wyo
13
13
  sunholo/agents/fastapi/qna_routes.py,sha256=DgK4Btu5XriOC1JaRQ4G_nWEjJfnQ0J5pyLanF6eF1g,3857
14
14
  sunholo/agents/flask/__init__.py,sha256=uqfHNw2Ru3EJ4dJEcbp86h_lkquBQPMxZbjhV_xe3rs,72
15
15
  sunholo/agents/flask/base.py,sha256=RUGWBYWeV60FatYF5sMRrxD-INU97Vodsi6JaB6i93s,763
16
- sunholo/agents/flask/qna_routes.py,sha256=k5nP_wXX4GVpuAHlVHuC0xMBnMeUc1uqYrGm7Gv_nFg,8382
16
+ sunholo/agents/flask/qna_routes.py,sha256=gg041eCoTpjr7ZuPPJb5z2KlIIbh85Wc4-a6bjGLiHs,8573
17
17
  sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
18
18
  sunholo/archive/archive.py,sha256=C-UhG5x-XtZ8VheQp92IYJqgD0V3NFQjniqlit94t18,1197
19
19
  sunholo/auth/__init__.py,sha256=4owDjSaWYkbTlPK47UHTOC0gCWbZsqn4ZIEw5NWZTlg,28
@@ -36,7 +36,7 @@ sunholo/components/__init__.py,sha256=RJGNEihwvRIiDScKis04RHJv4yZGI1UpXlOmuCptNZ
36
36
  sunholo/components/llm.py,sha256=T4we3tGmqUj4tPwxQr9M6AXv_BALqZV_dRSvINan-oU,10374
37
37
  sunholo/components/prompt.py,sha256=eZSghXkIlRzXiSrzgkG7e5ytUYq6R6LV-qjHU8jStig,6353
38
38
  sunholo/components/retriever.py,sha256=TiM-axCeaZ6CZ8rGKGx-io16JKDe8z0pnMccBi1yqHw,3509
39
- sunholo/components/vectorstore.py,sha256=04t_UctPMOYMaQUbLP4bRLQlCFykdAFDcBdwArA9jkg,4952
39
+ sunholo/components/vectorstore.py,sha256=RB_Dgc9234G_TE3w3abCfBw1pqm2br2RrLP0UqshkvA,5172
40
40
  sunholo/database/__init__.py,sha256=Zz0Shcq-CtStf9rJGIYB_Ybzb8rY_Q9mfSj-nviM490,241
41
41
  sunholo/database/alloydb.py,sha256=18Q4AG_W-Sz8udIj3gWMkGrMWmiEelqgOwJ7VKHElV0,14877
42
42
  sunholo/database/database.py,sha256=reZrThKyKvMAQXe2RIiEKmKYmsRvGsn7e05OoXjWVSQ,7395
@@ -74,18 +74,18 @@ sunholo/qna/__init__.py,sha256=F8q1uR_HreoSX0IfmKY1qoSwIgXhO2Q8kuDSxh9_-EE,28
74
74
  sunholo/qna/parsers.py,sha256=mH_SIgN2yXzvcoQZt9ITkdJSw3jgZGuu0p8q_H-kdSM,2140
75
75
  sunholo/qna/retry.py,sha256=gFgOf9AxrZMIO9OwOYu1EW7rhNhyfnw_o4XAsNLBOVQ,2021
76
76
  sunholo/streaming/__init__.py,sha256=k8dBqhzyS1Oi6NfADtRtWfnPtU1FU2kQz-YxH9yrNeQ,197
77
- sunholo/streaming/content_buffer.py,sha256=hr2ySHOTK1zw_3u-JrKwoomsAAdda2VcOxjkvJLcUuM,6596
77
+ sunholo/streaming/content_buffer.py,sha256=fWcg0oTf470M3U40VAChfmHmWRFgRD8VaT90jNfBCH0,6455
78
78
  sunholo/streaming/langserve.py,sha256=6isOvFwZBfmiQY5N41PYPyrdJj9IgJXXHLfTzPvewGw,6299
79
- sunholo/streaming/streaming.py,sha256=WoSRMnD-3sRxmeyxHz3miTtB6ECpj3Dw4SUCcnP0zB4,16473
79
+ sunholo/streaming/streaming.py,sha256=H8qpQC5wr4dVyInWTAjTmvGePVueWcwNaR8T_5mEp6k,16443
80
80
  sunholo/summarise/__init__.py,sha256=MZk3dblUMODcPb1crq4v-Z508NrFIpkSWNf9FIO8BcU,38
81
81
  sunholo/summarise/summarise.py,sha256=C3HhjepTjUhUC8FLk4jMQIBvq1BcORniwuTFHjPVhVo,3784
82
82
  sunholo/utils/__init__.py,sha256=G11nN_6ATjxpuMfG_BvcUr9UU8onPIgkpTK6CjOcbr8,48
83
83
  sunholo/utils/config.py,sha256=NW2FFyNNTwCyopOvSzDQ0I0l92LAfJJ7hEzatSuoZho,8689
84
84
  sunholo/utils/gcp.py,sha256=B2G1YKjeD7X9dqO86Jrp2vPuFwZ223Xl5Tg09Ndw-oc,5760
85
85
  sunholo/utils/parsers.py,sha256=OrHmASqIbI45atVOhiGodgLvnfrzkvVzyHnSvAXD89I,3841
86
- sunholo-0.57.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
87
- sunholo-0.57.0.dist-info/METADATA,sha256=y3WkwDsEQAjtKnCr_X1rnoP4IINqlu4jtyEm0Lz4PCw,6617
88
- sunholo-0.57.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
89
- sunholo-0.57.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
90
- sunholo-0.57.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
91
- sunholo-0.57.0.dist-info/RECORD,,
86
+ sunholo-0.57.2.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
87
+ sunholo-0.57.2.dist-info/METADATA,sha256=JMXDwlRVc5IDqCb17ls_c_rV9kyzHsTRPnjAEY7mbAQ,6617
88
+ sunholo-0.57.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
89
+ sunholo-0.57.2.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
90
+ sunholo-0.57.2.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
91
+ sunholo-0.57.2.dist-info/RECORD,,