sunholo 0.62.14__py3-none-any.whl → 0.62.15__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.
@@ -45,7 +45,6 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
45
45
  return jsonify({"status": "healthy"})
46
46
 
47
47
  @app.route('/vac/streaming/<vector_name>', methods=['POST'])
48
- @observe()
49
48
  def stream_qa(vector_name):
50
49
  observed_stream_interpreter = observe()(stream_interpreter)
51
50
  prep = prep_vac(request, vector_name)
@@ -111,8 +110,8 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
111
110
  return response
112
111
 
113
112
  @app.route('/vac/<vector_name>', methods=['POST'])
114
- @observe()
115
113
  def process_qna(vector_name):
114
+ observed_vac_interpreter = observe()(vac_interpreter)
116
115
  prep = prep_vac(request, vector_name)
117
116
  log.debug(f"Processing prep: {prep}")
118
117
  trace = prep["trace"]
@@ -132,13 +131,13 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
132
131
  input = all_input,
133
132
  model=vac_config.get("model") or vac_config.get("llm")
134
133
  )
135
- bot_output = vac_interpreter(
134
+ bot_output = observed_vac_interpreter(
136
135
  question=all_input["user_input"],
137
136
  vector_name=vector_name,
138
137
  chat_history=all_input["chat_history"],
139
138
  **all_input["kwargs"]
140
139
  )
141
- if generation:
140
+ if span:
142
141
  generation.end(output=bot_output)
143
142
  # {"answer": "The answer", "source_documents": [{"page_content": "The page content", "metadata": "The metadata"}]}
144
143
  bot_output = parse_output(bot_output)
@@ -29,7 +29,7 @@ from langchain.retrievers import ContextualCompressionRetriever
29
29
  def load_memories(vector_name):
30
30
  memories = load_config_key("memory", vector_name, kind="vacConfig")
31
31
  log.info(f"Found memory settings for {vector_name}: {memories}")
32
- if len(memories) == 0:
32
+ if not memories or len(memories) == 0:
33
33
  log.info(f"No memory settings found for {vector_name}")
34
34
  return None
35
35
 
@@ -67,7 +67,7 @@ def pick_retriever(vector_name, embeddings=None):
67
67
 
68
68
  #TODO: more memory stores here
69
69
 
70
- if len(retriever_list) == 0:
70
+ if not retriever_list or len(retriever_list) == 0:
71
71
  log.info(f"No retrievers were created for {memories}")
72
72
  return None
73
73
 
sunholo/qna/parsers.py CHANGED
@@ -36,7 +36,7 @@ def parse_output(bot_output):
36
36
 
37
37
  return bot_output
38
38
 
39
- elif isinstance(bot_output, dict) and 'metadata' in bot_output and isinstance(bot_output.get('metadata')) and 'source_documents' in bot_output.get('metadata'):
39
+ elif isinstance(bot_output, dict) and 'metadata' in bot_output and isinstance(bot_output.get('metadata'), dict) and 'source_documents' in bot_output.get('metadata'):
40
40
  metadata = bot_output.get('metadata')
41
41
  bot_output['source_documents'] = [document_to_dict(doc) for doc in metadata['source_documents']]
42
42
  if not bot_output.get("answer") or bot_output.get("answer") == "":
@@ -49,6 +49,10 @@ def get_vertex_memories(vector_name):
49
49
 
50
50
  memories = load_memories(vector_name)
51
51
  tools = []
52
+
53
+ if not memories:
54
+ return tools
55
+
52
56
  for memory in memories:
53
57
  for key, value in memory.items(): # Now iterate over the dictionary
54
58
  log.info(f"Found memory {key}")
@@ -138,4 +142,5 @@ def print_grounding_response(response):
138
142
  for uri, source in sources.items():
139
143
  markdown_text += f"{source['footnote']}. [{source['title']}]({uri})\n"
140
144
 
141
- log.info(markdown_text)
145
+ log.info(markdown_text)
146
+ return markdown_text
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.62.14
3
+ Version: 0.62.15
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.62.14.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.62.15.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -12,7 +12,7 @@ sunholo/agents/fastapi/base.py,sha256=clk76cHbUAvU0OYJrRfCWX_5f0ACbhDsIzYBhI3wyo
12
12
  sunholo/agents/fastapi/qna_routes.py,sha256=DgK4Btu5XriOC1JaRQ4G_nWEjJfnQ0J5pyLanF6eF1g,3857
13
13
  sunholo/agents/flask/__init__.py,sha256=uqfHNw2Ru3EJ4dJEcbp86h_lkquBQPMxZbjhV_xe3rs,72
14
14
  sunholo/agents/flask/base.py,sha256=FgSaCODyoTtlstJtsqlLPScdgRUtv9_plxftdzHdVFo,809
15
- sunholo/agents/flask/qna_routes.py,sha256=x9QMY-z-1_ThCLAAtHQPC-oTmVulch3sTy_9KwsKHtI,8617
15
+ sunholo/agents/flask/qna_routes.py,sha256=Twx6bitUAQ8Urtuwu9PtdoxYv-3aBDbF4cOUl9kdas8,8652
16
16
  sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
17
17
  sunholo/archive/archive.py,sha256=C-UhG5x-XtZ8VheQp92IYJqgD0V3NFQjniqlit94t18,1197
18
18
  sunholo/auth/__init__.py,sha256=4owDjSaWYkbTlPK47UHTOC0gCWbZsqn4ZIEw5NWZTlg,28
@@ -42,7 +42,7 @@ sunholo/cli/run_proxy.py,sha256=5CihmxymaCSwu1U58ySux38T3CQhx_FZkGRJLs99ix4,1129
42
42
  sunholo/cli/sun_rich.py,sha256=UpMqeJ0C8i0pkue1AHnnyyX0bFJ9zZeJ7HBR6yhuA8A,54
43
43
  sunholo/components/__init__.py,sha256=IDoylb74zFKo6NIS3RQqUl0PDFBGVxM1dfUmO7OJ44U,176
44
44
  sunholo/components/llm.py,sha256=T4we3tGmqUj4tPwxQr9M6AXv_BALqZV_dRSvINan-oU,10374
45
- sunholo/components/retriever.py,sha256=lqVwKXRU8Lu0-Tp4dgCvjDdUfBKkUMWUPpggMde0cx8,3782
45
+ sunholo/components/retriever.py,sha256=jAgcmEM_D2Qfb3hYqHVZMZMLUEUqUbqmhD6G5czmEas,3820
46
46
  sunholo/components/vectorstore.py,sha256=lB8vx_N6eBA44orNeVo1WRn0Q8GCIjvPPT9AfiPWBWE,5620
47
47
  sunholo/database/__init__.py,sha256=Zz0Shcq-CtStf9rJGIYB_Ybzb8rY_Q9mfSj-nviM490,241
48
48
  sunholo/database/alloydb.py,sha256=zvT50Df7r-jJPo5lEEWbjlXzVr0KuqN6WINgRtiSyxo,17014
@@ -79,7 +79,7 @@ sunholo/pubsub/__init__.py,sha256=wgkrtlL3h8uzNpnlWSHdVMOq0l5Q3D7gkxF_Rp1A6Ro,94
79
79
  sunholo/pubsub/process_pubsub.py,sha256=64hvqMsxbBrf0WGJsprz_SXf9FpjeszAIsqUSBlJrA8,2780
80
80
  sunholo/pubsub/pubsub_manager.py,sha256=NjeChrorhIFmakAzwzVqGYQdG7Q8lJT6UvppiYlrFjI,6427
81
81
  sunholo/qna/__init__.py,sha256=F8q1uR_HreoSX0IfmKY1qoSwIgXhO2Q8kuDSxh9_-EE,28
82
- sunholo/qna/parsers.py,sha256=mH_SIgN2yXzvcoQZt9ITkdJSw3jgZGuu0p8q_H-kdSM,2140
82
+ sunholo/qna/parsers.py,sha256=Wn2X47_yeE39oeqxxgDr7jgBT-N1anYpJtVBq-623O4,2146
83
83
  sunholo/qna/retry.py,sha256=gFgOf9AxrZMIO9OwOYu1EW7rhNhyfnw_o4XAsNLBOVQ,2021
84
84
  sunholo/streaming/__init__.py,sha256=MpbydI2UYo_adttPQFkxNM33b-QRyNEbrKJx0C2AGPc,241
85
85
  sunholo/streaming/content_buffer.py,sha256=fWcg0oTf470M3U40VAChfmHmWRFgRD8VaT90jNfBCH0,6455
@@ -99,11 +99,11 @@ sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,49
99
99
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
100
100
  sunholo/vertex/__init__.py,sha256=JvHcGFuv6R_nAhY2AdoqqhMpJ5ugeWPZ_svGhWrObBk,136
101
101
  sunholo/vertex/init.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
102
- sunholo/vertex/memory_tools.py,sha256=PMMJa0ecb0GUavUX275lhJjhmelc7bEIoM81G_uH4ys,5306
102
+ sunholo/vertex/memory_tools.py,sha256=8F1iTWnqEK9mX4W5RzCVKIjydIcNp6OFxjn_dtQ3GXo,5379
103
103
  sunholo/vertex/safety.py,sha256=3meAX0HyGZYrH7rXPUAHxtI_3w_zoy_RX7Shtkoa660,1275
104
- sunholo-0.62.14.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
105
- sunholo-0.62.14.dist-info/METADATA,sha256=fOpbqUK_ycWdrySd41SQ2xXuyLP79cnGzyyEefc3iHU,8059
106
- sunholo-0.62.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
107
- sunholo-0.62.14.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
108
- sunholo-0.62.14.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
109
- sunholo-0.62.14.dist-info/RECORD,,
104
+ sunholo-0.62.15.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
105
+ sunholo-0.62.15.dist-info/METADATA,sha256=8Rj94fhAxkmfWv7riY3k1qF0lMen-5ae9HA24jOvUX0,8059
106
+ sunholo-0.62.15.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
107
+ sunholo-0.62.15.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
108
+ sunholo-0.62.15.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
109
+ sunholo-0.62.15.dist-info/RECORD,,