sunholo 0.64.17__py3-none-any.whl → 0.64.19__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
@@ -4,6 +4,8 @@ from .route import route_vac
4
4
  from ..logging import log
5
5
  from ruamel.yaml import YAML
6
6
  from io import StringIO
7
+ # check it here:
8
+ # https://editor.swagger.io/
7
9
 
8
10
  def config_to_swagger():
9
11
  """
@@ -128,7 +130,19 @@ def generate_swagger(vac_config, agent_config):
128
130
  'host': '${_ENDPOINTS_HOST}',
129
131
  'schemes': ['https'],
130
132
  'produces': ['application/json'],
131
- 'paths': {}
133
+ 'paths': {},
134
+ 'securityDefinitions': {
135
+ 'ApiKeyAuth': { # For private VAC endpoint
136
+ 'type': 'apiKey',
137
+ 'name': 'x-api-key', # Custom header name for API key
138
+ 'in': 'header'
139
+ },
140
+ 'None': { # For public documentation
141
+ 'type': 'apiKey',
142
+ 'name': 'allow', # Dummy parameter for public access
143
+ 'in': 'query' # Use query parameter to avoid interfering with other headers
144
+ }
145
+ }
132
146
  }
133
147
 
134
148
  vac_services = vac_config['vac']
@@ -156,13 +170,17 @@ def generate_swagger(vac_config, agent_config):
156
170
  log.debug(f"endpoint_path: {endpoint_path}")
157
171
  if endpoint_path not in swagger_template['paths']:
158
172
  swagger_template['paths'][endpoint_path] = {}
173
+
174
+ operation_id = f"{method}_{agent_type}_{endpoint_key}_{vector_name}"
175
+
159
176
  swagger_template['paths'][endpoint_path][method] = {
160
177
  'summary': f"{method.capitalize()} {vector_name}",
161
- 'operationId': f"{method}_{agent_type}_{endpoint_key}",
178
+ 'operationId': operation_id,
162
179
  'x-google-backend': {
163
180
  'address': endpoint_address,
164
181
  'protocol': 'h2'
165
182
  },
183
+ 'security': [{'ApiKeyAuth': []}] if method == 'post' else [{'None': []}],
166
184
  'responses': copy.deepcopy(agent_config_paths.get('response', {}).get(endpoint_key, {
167
185
  '200': {
168
186
  'description': 'Default - A successful response',
@@ -198,13 +216,17 @@ def generate_swagger(vac_config, agent_config):
198
216
  log.debug(f"default endpoint_path: {endpoint_path}")
199
217
  if endpoint_path not in swagger_template['paths']:
200
218
  swagger_template['paths'][endpoint_path] = {}
219
+
220
+ operation_id = f"{method}_{agent_type}_{endpoint_key}_{vector_name}"
221
+
201
222
  swagger_template['paths'][endpoint_path][method] = {
202
223
  'summary': f"{method.capitalize()} {agent_type}",
203
- 'operationId': f"{method}_{agent_type}_{endpoint_key}",
224
+ 'operationId': operation_id,
204
225
  'x-google-backend': {
205
226
  'address': endpoint_address,
206
227
  'protocol': 'h2'
207
228
  },
229
+ 'security': [{'ApiKeyAuth': []}] if method == 'post' else [{'None': []}],
208
230
  'responses': copy.deepcopy(default_agent_config.get('response', {}).get(endpoint_key, {
209
231
  '200': {
210
232
  'description': 'Default - A successful response',
sunholo/utils/config.py CHANGED
@@ -82,7 +82,6 @@ def load_all_configs():
82
82
  cached_config, cache_time = config_cache[filename]
83
83
  time_to_recache = (current_time - cache_time)
84
84
  if time_to_recache < timedelta(minutes=5):
85
- log.debug(f"Returning cached config for {filename} - recache in {format_timedelta(timedelta(minutes=5) - time_to_recache)}")
86
85
  config = cached_config
87
86
  else:
88
87
  config = reload_config_file(config_file, filename)
@@ -94,6 +93,8 @@ def load_all_configs():
94
93
  configs_by_kind[kind] = config
95
94
  else:
96
95
  log.warning(f"No 'kind' found in {filename}")
96
+
97
+ #log.debug(f"Config recache in {format_timedelta(timedelta(minutes=5) - time_to_recache)}")
97
98
 
98
99
  return configs_by_kind
99
100
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.64.17
3
+ Version: 0.64.19
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.17.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.64.19.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=jxQ-NeKJ5BGQS29SiIbFhS_drb4_R5ahdR3m8-jDzWk,9354
10
+ sunholo/agents/swagger.py,sha256=nnaf9JtHeJwdzlpXmgFBpI71nf5oE7tSLG1VoZZj0SY,10261
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
@@ -92,7 +92,7 @@ sunholo/summarise/__init__.py,sha256=MZk3dblUMODcPb1crq4v-Z508NrFIpkSWNf9FIO8BcU
92
92
  sunholo/summarise/summarise.py,sha256=C3HhjepTjUhUC8FLk4jMQIBvq1BcORniwuTFHjPVhVo,3784
93
93
  sunholo/utils/__init__.py,sha256=G11nN_6ATjxpuMfG_BvcUr9UU8onPIgkpTK6CjOcbr8,48
94
94
  sunholo/utils/big_context.py,sha256=gJIP7_ZL-YSLhOMq8jmFTMqH1wq8eB1NK7oKPeZAq2s,5578
95
- sunholo/utils/config.py,sha256=xwI-3Ire8vGzvUydokfNz4Ubolxy4tA_4DNGcyGPO90,8951
95
+ sunholo/utils/config.py,sha256=5lzO9CkLpDslp66ZwSBC_95aA1FQs-zpiOLi5YaYWbM,8907
96
96
  sunholo/utils/config_schema.py,sha256=Wv-ncitzljOhgbDaq9qnFqH5LCuxNv59dTGDWgd1qdk,4189
97
97
  sunholo/utils/gcp.py,sha256=uueODEpA-P6O15-t0hmcGC9dONLO_hLfzSsSoQnkUss,4854
98
98
  sunholo/utils/gcp_project.py,sha256=0ozs6tzI4qEvEeXb8MxLnCdEVoWKxlM6OH05htj7_tc,1325
@@ -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.17.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
108
- sunholo-0.64.17.dist-info/METADATA,sha256=V0EKYPEHEw0VqknXtTiT2GfhWhmQwxqeMqD0cwPZDuk,6000
109
- sunholo-0.64.17.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
110
- sunholo-0.64.17.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
111
- sunholo-0.64.17.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
112
- sunholo-0.64.17.dist-info/RECORD,,
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,,