sunholo 0.61.4__py3-none-any.whl → 0.61.5__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/cli/chat_vac.py +59 -15
- {sunholo-0.61.4.dist-info → sunholo-0.61.5.dist-info}/METADATA +2 -2
- {sunholo-0.61.4.dist-info → sunholo-0.61.5.dist-info}/RECORD +7 -7
- {sunholo-0.61.4.dist-info → sunholo-0.61.5.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.61.4.dist-info → sunholo-0.61.5.dist-info}/WHEEL +0 -0
- {sunholo-0.61.4.dist-info → sunholo-0.61.5.dist-info}/entry_points.txt +0 -0
- {sunholo-0.61.4.dist-info → sunholo-0.61.5.dist-info}/top_level.txt +0 -0
sunholo/cli/chat_vac.py
CHANGED
|
@@ -9,6 +9,7 @@ import uuid
|
|
|
9
9
|
import sys
|
|
10
10
|
import subprocess
|
|
11
11
|
import json
|
|
12
|
+
import requests
|
|
12
13
|
|
|
13
14
|
from rich import print
|
|
14
15
|
from .sun_rich import console
|
|
@@ -143,27 +144,46 @@ def headless_mode(service_url, service_name, user_input, chat_history=None):
|
|
|
143
144
|
|
|
144
145
|
return chat_history
|
|
145
146
|
|
|
147
|
+
def resolve_service_url(args):
|
|
148
|
+
|
|
149
|
+
if args.url_override:
|
|
150
|
+
|
|
151
|
+
return args.url_override
|
|
152
|
+
|
|
153
|
+
if not args.no_proxy:
|
|
154
|
+
try:
|
|
155
|
+
service_url = get_service_url(args.vac_name, args.project, args.region)
|
|
156
|
+
except ValueError as e:
|
|
157
|
+
console.print(f"[bold red]ERROR: Could not start {args.vac_name} proxy URL: {str(e)}[/bold red]")
|
|
158
|
+
sys.exit(1)
|
|
159
|
+
else:
|
|
160
|
+
console.print(f"Not using a proxy, connecting directly to {service_url}")
|
|
161
|
+
|
|
162
|
+
agent_url = load_config_key("agent_url", args.vac_name, "vacConfig")
|
|
163
|
+
if agent_url:
|
|
164
|
+
console.print("Found agent_url within vacConfig: {agent_url}")
|
|
165
|
+
|
|
166
|
+
service_url = agent_url or get_cloud_run_service_url(args.project, args.region, args.vac_name)
|
|
167
|
+
|
|
168
|
+
return service_url
|
|
146
169
|
|
|
147
170
|
def vac_command(args):
|
|
171
|
+
|
|
172
|
+
service_url = resolve_service_url(args)
|
|
173
|
+
|
|
148
174
|
if args.action == 'list':
|
|
175
|
+
|
|
149
176
|
list_cloud_run_services(args.project, args.region)
|
|
177
|
+
|
|
150
178
|
return
|
|
179
|
+
|
|
151
180
|
elif args.action == 'get-url':
|
|
152
|
-
service_url = get_cloud_run_service_url(args.project, args.region, args.vac_name)
|
|
153
|
-
if service_url:
|
|
154
|
-
console.print(service_url)
|
|
155
|
-
return
|
|
156
|
-
elif args.action == 'chat':
|
|
157
181
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
sys.exit(1)
|
|
164
|
-
else:
|
|
165
|
-
service_url = get_cloud_run_service_url(args.project, args.region, args.vac_name)
|
|
166
|
-
console.print(f"Not using a proxy, connecting directly to {service_url}")
|
|
182
|
+
console.print(service_url)
|
|
183
|
+
|
|
184
|
+
return
|
|
185
|
+
|
|
186
|
+
elif args.action == 'chat':
|
|
167
187
|
|
|
168
188
|
agent_name = load_config_key("agent", args.vac_name, kind="vacConfig")
|
|
169
189
|
|
|
@@ -188,6 +208,24 @@ def vac_command(args):
|
|
|
188
208
|
|
|
189
209
|
stop_proxy(agent_name, stop_local=False)
|
|
190
210
|
|
|
211
|
+
elif args.action == 'invoke':
|
|
212
|
+
try:
|
|
213
|
+
json_data = json.loads(args.data)
|
|
214
|
+
except json.JSONDecodeError as err:
|
|
215
|
+
console.print(f"[bold red]ERROR: invalid JSON: {str(err)} [/bold red]")
|
|
216
|
+
sys.exit(1)
|
|
217
|
+
|
|
218
|
+
invoke_vac(service_url, json_data)
|
|
219
|
+
|
|
220
|
+
def invoke_vac(service_url, data):
|
|
221
|
+
try:
|
|
222
|
+
headers = {"Content-Type": "application/json"}
|
|
223
|
+
response = requests.post(service_url, headers=headers, data=json.dumps(data))
|
|
224
|
+
response.raise_for_status()
|
|
225
|
+
print(response.json())
|
|
226
|
+
except requests.exceptions.RequestException as e:
|
|
227
|
+
console.print(f"[bold red]ERROR: Failed to invoke VAC: {e}[/bold red]")
|
|
228
|
+
|
|
191
229
|
|
|
192
230
|
def list_cloud_run_services(project, region):
|
|
193
231
|
"""
|
|
@@ -281,6 +319,8 @@ def setup_vac_subparser(subparsers):
|
|
|
281
319
|
subparsers: The subparsers object from argparse.ArgumentParser().
|
|
282
320
|
"""
|
|
283
321
|
vac_parser = subparsers.add_parser('vac', help='Interact with deployed VAC services.')
|
|
322
|
+
vac_parser.add_argument('--url_override', help='Override the VAC service URL.')
|
|
323
|
+
vac_parser.add_argument('--no-proxy', action='store_true', help='Do not use the proxy and connect directly to the VAC service.')
|
|
284
324
|
vac_subparsers = vac_parser.add_subparsers(dest='action', help='VAC subcommands')
|
|
285
325
|
|
|
286
326
|
# Subcommand for listing VAC services
|
|
@@ -296,6 +336,10 @@ def setup_vac_subparser(subparsers):
|
|
|
296
336
|
chat_parser.add_argument('user_input', help='User input for the VAC service when in headless mode.', nargs='?', default=None)
|
|
297
337
|
chat_parser.add_argument('--headless', action='store_true', help='Run in headless mode.')
|
|
298
338
|
chat_parser.add_argument('--chat_history', help='Chat history for headless mode (as JSON string).', default=None)
|
|
299
|
-
|
|
339
|
+
|
|
340
|
+
# Subcommand for invoking a VAC service directly
|
|
341
|
+
invoke_parser = vac_subparsers.add_parser('invoke', help='Invoke a VAC service directly with custom data.')
|
|
342
|
+
invoke_parser.add_argument('vac_name', help='Name of the VAC service.')
|
|
343
|
+
invoke_parser.add_argument('data', help='Data to send to the VAC service (as JSON string).')
|
|
300
344
|
|
|
301
345
|
vac_parser.set_defaults(func=vac_command)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.61.
|
|
3
|
+
Version: 0.61.5
|
|
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.61.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.61.5.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -31,7 +31,7 @@ sunholo/chunker/pdfs.py,sha256=daCZ1xjn1YvxlifIyxskWNpLJLe-Q9D_Jq12MWx3tZo,2473
|
|
|
31
31
|
sunholo/chunker/publish.py,sha256=PoT8q3XJeFCg10WrLkYhuaaXIrGVkvUD3-R9IfoWoH4,2703
|
|
32
32
|
sunholo/chunker/splitter.py,sha256=FLkDhkePkg_zGQpFBK13Cznw575D-Rf9pcaCpc1HUxY,6726
|
|
33
33
|
sunholo/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
sunholo/cli/chat_vac.py,sha256=
|
|
34
|
+
sunholo/cli/chat_vac.py,sha256=hroQtcf12nYaHaYObE4EeNlHmcB4BZl6LBs_yhSnwYI,12713
|
|
35
35
|
sunholo/cli/cli.py,sha256=cogY1F5rcIGFYpZVFtbDNlAIElpfyPSCvSLC1ZIpHXg,2666
|
|
36
36
|
sunholo/cli/cli_init.py,sha256=JMZ9AX2cPDZ-_mv3adiv2ToFVNyRPtjk9Biszl1kiR0,2358
|
|
37
37
|
sunholo/cli/configs.py,sha256=QUM9DvKOdZmEQRM5uI3Nh887T0YDiSMr7O240zTLqws,4546
|
|
@@ -95,9 +95,9 @@ sunholo/utils/parsers.py,sha256=OrHmASqIbI45atVOhiGodgLvnfrzkvVzyHnSvAXD89I,3841
|
|
|
95
95
|
sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
|
|
96
96
|
sunholo/vertex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
97
|
sunholo/vertex/init_vertex.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
|
|
98
|
-
sunholo-0.61.
|
|
99
|
-
sunholo-0.61.
|
|
100
|
-
sunholo-0.61.
|
|
101
|
-
sunholo-0.61.
|
|
102
|
-
sunholo-0.61.
|
|
103
|
-
sunholo-0.61.
|
|
98
|
+
sunholo-0.61.5.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
99
|
+
sunholo-0.61.5.dist-info/METADATA,sha256=tJ2thVA-C3VH57sGLxsCI1dIVZ-H9gmxX-x8bzvaeQY,8057
|
|
100
|
+
sunholo-0.61.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
101
|
+
sunholo-0.61.5.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
102
|
+
sunholo-0.61.5.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
103
|
+
sunholo-0.61.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|