sunholo 0.104.1__py3-none-any.whl → 0.104.3__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/agents/flask/vac_routes.py +26 -15
- {sunholo-0.104.1.dist-info → sunholo-0.104.3.dist-info}/METADATA +2 -2
- {sunholo-0.104.1.dist-info → sunholo-0.104.3.dist-info}/RECORD +7 -7
- {sunholo-0.104.1.dist-info → sunholo-0.104.3.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.104.1.dist-info → sunholo-0.104.3.dist-info}/WHEEL +0 -0
- {sunholo-0.104.1.dist-info → sunholo-0.104.3.dist-info}/entry_points.txt +0 -0
- {sunholo-0.104.1.dist-info → sunholo-0.104.3.dist-info}/top_level.txt +0 -0
|
@@ -63,8 +63,7 @@ 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
|
-
|
|
67
|
-
self.register_after_request()
|
|
66
|
+
|
|
68
67
|
|
|
69
68
|
def vac_interpreter_default(self, question: str, vector_name: str, chat_history=[], **kwargs):
|
|
70
69
|
# Create a callback that does nothing for streaming if you don't want intermediate outputs
|
|
@@ -97,21 +96,44 @@ if __name__ == "__main__":
|
|
|
97
96
|
self.app.route("/health", methods=['GET'])(self.health)
|
|
98
97
|
|
|
99
98
|
# Streaming VAC
|
|
100
|
-
self.app.route('/vac/streaming/<vector_name>',
|
|
99
|
+
self.app.route('/vac/streaming/<vector_name>',
|
|
100
|
+
methods=['POST'],
|
|
101
|
+
provide_automatic_options=False)(self.handle_stream_vac)
|
|
101
102
|
|
|
102
103
|
# Static VAC
|
|
103
|
-
self.app.route('/vac/<vector_name>',
|
|
104
|
+
self.app.route('/vac/<vector_name>',
|
|
105
|
+
methods=['POST'],
|
|
106
|
+
provide_automatic_options=False)(self.handle_process_vac)
|
|
104
107
|
|
|
105
108
|
# Authentication middleware
|
|
106
109
|
self.app.before_request(self.check_authentication)
|
|
107
110
|
|
|
111
|
+
# Handle OPTIONS requests explicitly
|
|
112
|
+
self.app.route('/vac/streaming/<vector_name>', methods=['OPTIONS'])(self.handle_options)
|
|
113
|
+
self.app.route('/vac/<vector_name>', methods=['OPTIONS'])(self.handle_options)
|
|
114
|
+
|
|
108
115
|
# OpenAI health endpoint
|
|
109
116
|
self.app.route('/openai/health', methods=['GET', 'POST'])(self.openai_health_endpoint)
|
|
110
117
|
|
|
111
118
|
# OpenAI compatible endpoint
|
|
112
119
|
self.app.route('/openai/v1/chat/completions', methods=['POST'])(self.handle_openai_compatible_endpoint)
|
|
113
120
|
self.app.route('/openai/v1/chat/completions/<vector_name>', methods=['POST'])(self.handle_openai_compatible_endpoint)
|
|
121
|
+
|
|
122
|
+
self.register_additional_routes()
|
|
123
|
+
|
|
124
|
+
def handle_options(self, **kwargs):
|
|
125
|
+
response = Response(status=200)
|
|
126
|
+
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
114
127
|
|
|
128
|
+
# Reflect the request's `Access-Control-Request-Headers`
|
|
129
|
+
request_headers = request.headers.get('Access-Control-Request-Headers', '')
|
|
130
|
+
response.headers.add('Access-Control-Allow-Headers', request_headers)
|
|
131
|
+
|
|
132
|
+
# Specify allowed methods
|
|
133
|
+
response.headers.add('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
|
|
134
|
+
log.info(f'OPTION Request headers: {request_headers}')
|
|
135
|
+
|
|
136
|
+
return response
|
|
115
137
|
|
|
116
138
|
def register_additional_routes(self):
|
|
117
139
|
"""
|
|
@@ -152,17 +174,6 @@ if __name__ == "__main__":
|
|
|
152
174
|
for route in self.additional_routes:
|
|
153
175
|
self.app.route(route["rule"], methods=route["methods"])(route["handler"])
|
|
154
176
|
|
|
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
|
-
|
|
166
177
|
def home(self):
|
|
167
178
|
return jsonify("OK")
|
|
168
179
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.104.
|
|
3
|
+
Version: 0.104.3
|
|
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.104.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.104.3.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=HLz3Z5efWaewTwSFEM6JH48NA9otoJBoVFJlARGk9L8,788
|
|
16
16
|
sunholo/agents/flask/qna_routes.py,sha256=uwUD1yrzOPH27m2AXpiQrPk_2VfJOQOM6dAynOWQtoQ,22532
|
|
17
|
-
sunholo/agents/flask/vac_routes.py,sha256=
|
|
17
|
+
sunholo/agents/flask/vac_routes.py,sha256=Bwa_v1M9502w7tdtSMbL5tuupaQts6v0x0RIm1JaY_s,28121
|
|
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
|
|
@@ -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.104.
|
|
151
|
-
sunholo-0.104.
|
|
152
|
-
sunholo-0.104.
|
|
153
|
-
sunholo-0.104.
|
|
154
|
-
sunholo-0.104.
|
|
155
|
-
sunholo-0.104.
|
|
150
|
+
sunholo-0.104.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
151
|
+
sunholo-0.104.3.dist-info/METADATA,sha256=ow-M-hY8uTh1WUylcEDYVP1NCGmTBm5SELeCWQDknCY,8312
|
|
152
|
+
sunholo-0.104.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
153
|
+
sunholo-0.104.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
154
|
+
sunholo-0.104.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
155
|
+
sunholo-0.104.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|