sunholo 0.103.3__py3-none-any.whl → 0.104.1__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.
@@ -13,8 +13,9 @@
13
13
  # limitations under the License.
14
14
  def create_app(name):
15
15
  from flask import Flask
16
- # Initialize Flask app
16
+
17
17
  app = Flask(name)
18
+
18
19
  app.config['TRAP_HTTP_EXCEPTIONS'] = True
19
20
  app.config['PROPAGATE_EXCEPTIONS'] = True
20
21
 
@@ -63,7 +63,8 @@ if __name__ == "__main__":
63
63
  self.vac_interpreter = vac_interpreter or partial(self.vac_interpreter_default)
64
64
  self.additional_routes = additional_routes if additional_routes is not None else []
65
65
  self.register_routes()
66
-
66
+ self.register_additional_routes()
67
+ self.register_after_request()
67
68
 
68
69
  def vac_interpreter_default(self, question: str, vector_name: str, chat_history=[], **kwargs):
69
70
  # Create a callback that does nothing for streaming if you don't want intermediate outputs
@@ -110,8 +111,7 @@ if __name__ == "__main__":
110
111
  # OpenAI compatible endpoint
111
112
  self.app.route('/openai/v1/chat/completions', methods=['POST'])(self.handle_openai_compatible_endpoint)
112
113
  self.app.route('/openai/v1/chat/completions/<vector_name>', methods=['POST'])(self.handle_openai_compatible_endpoint)
113
- # Register additional routes
114
- self.register_additional_routes()
114
+
115
115
 
116
116
  def register_additional_routes(self):
117
117
  """
@@ -152,6 +152,17 @@ if __name__ == "__main__":
152
152
  for route in self.additional_routes:
153
153
  self.app.route(route["rule"], methods=route["methods"])(route["handler"])
154
154
 
155
+ def register_after_request(self):
156
+ """
157
+ Register after_request to add CORS headers.
158
+ """
159
+ @self.app.after_request
160
+ def add_cors_headers(response):
161
+ response.headers.add('Access-Control-Allow-Origin', '*')
162
+ response.headers.add('Access-Control-Allow-Headers', 'Content-Type, Authorization, x-api-key')
163
+ response.headers.add('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS')
164
+ return response
165
+
155
166
  def home(self):
156
167
  return jsonify("OK")
157
168
 
@@ -385,7 +396,7 @@ if __name__ == "__main__":
385
396
  bot_output = {'answer': f'QNA_ERROR: An error occurred while processing /vac/{vector_name}: {str(err)} traceback: {traceback.format_exc()}'}
386
397
  if span:
387
398
  gen.end(output=bot_output)
388
-
399
+
389
400
  if trace:
390
401
  span.end(output=jsonify(bot_output))
391
402
  trace.update(output=jsonify(bot_output))
@@ -16,7 +16,7 @@ def load_prompt_from_yaml(key, prefix="sunholo", load_from_file=False, f_string=
16
16
  kind: promptConfig
17
17
  apiVersion: v1
18
18
  prompts:
19
- sunholo:
19
+ sunholo:
20
20
  hello: |
21
21
  Say hello to {name}
22
22
  ```
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.103.3
3
+ Version: 0.104.1
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.103.3.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.104.1.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -12,9 +12,9 @@ sunholo/agents/fastapi/__init__.py,sha256=S_pj4_bTUmDGoq_exaREHlOKThi0zTuGT0VZY0
12
12
  sunholo/agents/fastapi/base.py,sha256=W-cyF8ZDUH40rc-c-Apw3-_8IIi2e4Y9qRtnoVnsc1Q,2521
13
13
  sunholo/agents/fastapi/qna_routes.py,sha256=lKHkXPmwltu9EH3RMwmD153-J6pE7kWQ4BhBlV3to-s,3864
14
14
  sunholo/agents/flask/__init__.py,sha256=poJDKMr2qj8qMb99JqCvCPSiEt1tj2tLQ3hKW3f2aVw,107
15
- sunholo/agents/flask/base.py,sha256=FgSaCODyoTtlstJtsqlLPScdgRUtv9_plxftdzHdVFo,809
15
+ sunholo/agents/flask/base.py,sha256=HLz3Z5efWaewTwSFEM6JH48NA9otoJBoVFJlARGk9L8,788
16
16
  sunholo/agents/flask/qna_routes.py,sha256=uwUD1yrzOPH27m2AXpiQrPk_2VfJOQOM6dAynOWQtoQ,22532
17
- sunholo/agents/flask/vac_routes.py,sha256=sFjVXxudKP3SMO2hpcSbPZRZFBfrJr0tDQmlHTzn5E0,27181
17
+ sunholo/agents/flask/vac_routes.py,sha256=L4B6fUj6u0mVhCdG4Ac31DaGO2kw1VcWqSI_fUse9dA,27665
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
@@ -97,7 +97,7 @@ sunholo/invoke/invoke_vac_utils.py,sha256=sJc1edHTHMzMGXjji1N67c3iUaP7BmAL5nj82Q
97
97
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
98
  sunholo/langfuse/callback.py,sha256=jl0SZsFS53uMW9DGeM9SOL_EsRZsba0wwFGLqKzu9_U,1684
99
99
  sunholo/langfuse/evals.py,sha256=fQBaC0dBTYfgCzyfv9QBRvUfc9f42lbwQAeZmynaHO8,3841
100
- sunholo/langfuse/prompts.py,sha256=9TkmT2A-P4YRlk7sWz_EYk6yASxPKU8jhM7jAg9ND_Q,2330
100
+ sunholo/langfuse/prompts.py,sha256=J-oePqMyd2xPoTDb5G4fM-LNsC9jEa-udZ4dpbQle-w,2332
101
101
  sunholo/llamaindex/__init__.py,sha256=DlY_cHWCsVEV1C5WBgDdHRgOMlJc8pDoCRukUJ8PT9w,88
102
102
  sunholo/llamaindex/get_files.py,sha256=6rhXCDqQ_lrIapISQ_OYQDjiSATXvS_9m3qq53-oIl0,781
103
103
  sunholo/llamaindex/import_files.py,sha256=Bnic5wz8c61af9Kwq8KSrNBbc4imYnzMtBCb2jzSImI,6224
@@ -147,9 +147,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
147
147
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
148
148
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
149
149
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
150
- sunholo-0.103.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
- sunholo-0.103.3.dist-info/METADATA,sha256=c9RZHjm11DZGjxIeguvv05L1UzrVTS3SqgHAPsKy_bE,8312
152
- sunholo-0.103.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
- sunholo-0.103.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
- sunholo-0.103.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
- sunholo-0.103.3.dist-info/RECORD,,
150
+ sunholo-0.104.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
+ sunholo-0.104.1.dist-info/METADATA,sha256=4yY3xcuYhQmUySBJjwyQkjKtQZ0iRmu8NKI6mnjsH-Y,8312
152
+ sunholo-0.104.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
+ sunholo-0.104.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
+ sunholo-0.104.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
+ sunholo-0.104.1.dist-info/RECORD,,