sunholo 0.93.0__py3-none-any.whl → 0.94.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.
@@ -3,6 +3,7 @@ import traceback
3
3
  import datetime
4
4
  import uuid
5
5
  import random
6
+ from functools import partial
6
7
 
7
8
  from ...agents import extract_chat_history, handle_special_commands
8
9
  from ...qna.parsers import parse_output
@@ -54,13 +55,36 @@ if __name__ == "__main__":
54
55
  ```
55
56
 
56
57
  """
57
- def __init__(self, app, stream_interpreter, vac_interpreter, additional_routes=None):
58
+ def __init__(self, app, stream_interpreter, vac_interpreter=None, additional_routes=None):
58
59
  self.app = app
59
60
  self.stream_interpreter = stream_interpreter
60
- self.vac_interpreter = vac_interpreter
61
+ self.vac_interpreter = vac_interpreter or partial(self.vac_interpreter_default)
61
62
  self.additional_routes = additional_routes if additional_routes is not None else []
62
63
  self.register_routes()
63
64
 
65
+
66
+ def vac_interpreter_default(self, question: str, vector_name: str, chat_history=[], **kwargs):
67
+ # Create a callback that does nothing for streaming if you don't want intermediate outputs
68
+ class NoOpCallback:
69
+ def on_llm_new_token(self, token):
70
+ pass
71
+ def on_llm_end(self, response):
72
+ pass
73
+
74
+ # Use the NoOpCallback for non-streaming behavior
75
+ callback = NoOpCallback()
76
+
77
+ # Pass all arguments to vac_stream and use the final return
78
+ result = self.stream_interpreter(
79
+ question=question,
80
+ vector_name=vector_name,
81
+ chat_history=chat_history,
82
+ callback=callback,
83
+ **kwargs
84
+ )
85
+
86
+ return result
87
+
64
88
  def register_routes(self):
65
89
  """
66
90
  Registers all the VAC routes for the Flask application.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.93.0
3
+ Version: 0.94.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.93.0.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.94.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=LA_NjWmZDTMJSiBfhlfOOdHOxfcr0KiVwDrbGJXaKNs,23342
17
+ sunholo/agents/flask/vac_routes.py,sha256=wMH0a53BFrBnksi4F34pEGJIJgRImxndPeMWGAjUQZw,24179
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
@@ -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.93.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.93.0.dist-info/METADATA,sha256=jAwnrLLbA9YDitxozR7LjwaU9doMLczDU6yl2b81ovs,7806
149
- sunholo-0.93.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
- sunholo-0.93.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.93.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.93.0.dist-info/RECORD,,
147
+ sunholo-0.94.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.94.0.dist-info/METADATA,sha256=WzxVoYlzQITMFyMSG8aGXvkAaIoE2XVwOzXgkLZDZPM,7806
149
+ sunholo-0.94.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
+ sunholo-0.94.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.94.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.94.0.dist-info/RECORD,,