sunholo 0.64.19__py3-none-any.whl → 0.66.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.
sunholo/agents/swagger.py CHANGED
@@ -158,9 +158,24 @@ def generate_swagger(vac_config, agent_config):
158
158
  log.warning(f"Failed to find URL stem for {vector_name}/{agent_type} - using {stem} instead")
159
159
 
160
160
  for method, endpoints in agent_config_paths.items():
161
- if method not in ['get', 'post']:
162
- log.warning(f"Skipping {endpoints}")
161
+ # controls if get requests are protected or not
162
+ do_auth = True
163
+
164
+ # default get: noauth, post: auth
165
+ if method not in ['get', 'post', 'get-auth', 'post-noauth']:
163
166
  continue
167
+
168
+ if method == 'get-auth':
169
+ do_auth = True
170
+ method = 'get'
171
+ elif method == 'post-noauth':
172
+ do_auth = False
173
+ method = 'post'
174
+ elif method == 'get':
175
+ do_auth = False
176
+ elif method == 'post':
177
+ do_auth = True # not needed but to be clear whats happening
178
+
164
179
  for endpoint_key, endpoint_template in endpoints.items():
165
180
  endpoint_template = endpoint_template.strip()
166
181
  endpoint_address = endpoint_template.replace("{stem}", stem).replace("{vector_name}", vector_name).strip()
@@ -173,14 +188,17 @@ def generate_swagger(vac_config, agent_config):
173
188
 
174
189
  operation_id = f"{method}_{agent_type}_{endpoint_key}_{vector_name}"
175
190
 
191
+ security = [{'ApiKeyAuth': []}] if do_auth else [{'None': []}]
192
+
176
193
  swagger_template['paths'][endpoint_path][method] = {
177
194
  'summary': f"{method.capitalize()} {vector_name}",
178
195
  'operationId': operation_id,
179
196
  'x-google-backend': {
180
197
  'address': endpoint_address,
181
- 'protocol': 'h2'
198
+ 'protocol': 'h2',
199
+ 'deadline': 180000 # Timeout of 3 minutes (1,800,00 milliseconds)
182
200
  },
183
- 'security': [{'ApiKeyAuth': []}] if method == 'post' else [{'None': []}],
201
+ 'security': security,
184
202
  'responses': copy.deepcopy(agent_config_paths.get('response', {}).get(endpoint_key, {
185
203
  '200': {
186
204
  'description': 'Default - A successful response',
@@ -204,9 +222,26 @@ def generate_swagger(vac_config, agent_config):
204
222
  stem = f"${{{agent_type.upper()}_BACKEND_URL}}"
205
223
  log.warning(f"Failed to find URL stem for {vector_name}/{agent_type} - using {stem} instead")
206
224
 
225
+
207
226
  for method, endpoints in default_agent_config.items():
208
- if method not in ['get', 'post']:
227
+ # controls if get requests are protected or not
228
+ do_auth = True
229
+
230
+ # default get: noauth, post: auth
231
+ if method not in ['get', 'post', 'get-auth', 'post-noauth']:
209
232
  continue
233
+
234
+ if method == 'get-auth':
235
+ do_auth = True
236
+ method = 'get'
237
+ elif method == 'post-noauth':
238
+ do_auth = False
239
+ method = 'post'
240
+ elif method == 'get':
241
+ do_auth = False
242
+ elif method == 'post':
243
+ do_auth = True # not needed but to be clear whats happening
244
+
210
245
  for endpoint_key, endpoint_template in endpoints.items():
211
246
  endpoint_template = endpoint_template.strip()
212
247
  endpoint_address = endpoint_template.replace("{stem}", stem).replace("{vector_name}", vector_name).strip()
@@ -219,14 +254,17 @@ def generate_swagger(vac_config, agent_config):
219
254
 
220
255
  operation_id = f"{method}_{agent_type}_{endpoint_key}_{vector_name}"
221
256
 
257
+ security = [{'ApiKeyAuth': []}] if do_auth else [{'None': []}]
258
+
222
259
  swagger_template['paths'][endpoint_path][method] = {
223
260
  'summary': f"{method.capitalize()} {agent_type}",
224
261
  'operationId': operation_id,
225
262
  'x-google-backend': {
226
263
  'address': endpoint_address,
227
- 'protocol': 'h2'
264
+ 'protocol': 'h2',
265
+ 'deadline': 180000 # Timeout of 3 minutes (1,800,00 milliseconds)
228
266
  },
229
- 'security': [{'ApiKeyAuth': []}] if method == 'post' else [{'None': []}],
267
+ 'security': security,
230
268
  'responses': copy.deepcopy(default_agent_config.get('response', {}).get(endpoint_key, {
231
269
  '200': {
232
270
  'description': 'Default - A successful response',
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.64.19
3
+ Version: 0.66.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.64.19.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.66.1.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -7,7 +7,7 @@ sunholo/agents/langserve.py,sha256=FdhQjorAY2bMn2rpuabNT6bU3uqSKWrl8DjpH3L_V7k,4
7
7
  sunholo/agents/pubsub.py,sha256=5hbbhbBGyVWRpt2sAGC5FEheYH1mCCwVUhZEB1S7vGg,1337
8
8
  sunholo/agents/route.py,sha256=V1HKXTvaNuYgjmT5_QgIQum4O7O0Mw497m6YiMpEzX0,2383
9
9
  sunholo/agents/special_commands.py,sha256=ecD5jrBVXo170sdgPILi0m_m_4nRFEv6qKn5zYEvEK8,6494
10
- sunholo/agents/swagger.py,sha256=nnaf9JtHeJwdzlpXmgFBpI71nf5oE7tSLG1VoZZj0SY,10261
10
+ sunholo/agents/swagger.py,sha256=muFMQ1-9MtVlvSyUrLKjmULe4inC_QMb0Iofa14QnXw,11540
11
11
  sunholo/agents/fastapi/__init__.py,sha256=S_pj4_bTUmDGoq_exaREHlOKThi0zTuGT0VZY0YfODQ,88
12
12
  sunholo/agents/fastapi/base.py,sha256=clk76cHbUAvU0OYJrRfCWX_5f0ACbhDsIzYBhI3wyoE,2514
13
13
  sunholo/agents/fastapi/qna_routes.py,sha256=DgK4Btu5XriOC1JaRQ4G_nWEjJfnQ0J5pyLanF6eF1g,3857
@@ -104,9 +104,9 @@ sunholo/vertex/__init__.py,sha256=JvHcGFuv6R_nAhY2AdoqqhMpJ5ugeWPZ_svGhWrObBk,13
104
104
  sunholo/vertex/init.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
105
105
  sunholo/vertex/memory_tools.py,sha256=8F1iTWnqEK9mX4W5RzCVKIjydIcNp6OFxjn_dtQ3GXo,5379
106
106
  sunholo/vertex/safety.py,sha256=3meAX0HyGZYrH7rXPUAHxtI_3w_zoy_RX7Shtkoa660,1275
107
- sunholo-0.64.19.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
108
- sunholo-0.64.19.dist-info/METADATA,sha256=8J1J8ApDb-Q3I3afrKM4RTck6U2_Lgb8K8ogxUZ8hTU,6000
109
- sunholo-0.64.19.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
110
- sunholo-0.64.19.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
111
- sunholo-0.64.19.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
112
- sunholo-0.64.19.dist-info/RECORD,,
107
+ sunholo-0.66.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
108
+ sunholo-0.66.1.dist-info/METADATA,sha256=Mv0TUMCU4fHkOPMw2fCWKfiL6sJtkWG8MPDlA7JstiI,5998
109
+ sunholo-0.66.1.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
110
+ sunholo-0.66.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
111
+ sunholo-0.66.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
112
+ sunholo-0.66.1.dist-info/RECORD,,