sunholo 0.58.5__py3-none-any.whl → 0.59.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/cli/configs.py +104 -9
- sunholo/gcs/download_url.py +5 -4
- sunholo/utils/config_schema.py +121 -0
- {sunholo-0.58.5.dist-info → sunholo-0.59.1.dist-info}/METADATA +3 -2
- {sunholo-0.58.5.dist-info → sunholo-0.59.1.dist-info}/RECORD +9 -8
- {sunholo-0.58.5.dist-info → sunholo-0.59.1.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.58.5.dist-info → sunholo-0.59.1.dist-info}/WHEEL +0 -0
- {sunholo-0.58.5.dist-info → sunholo-0.59.1.dist-info}/entry_points.txt +0 -0
- {sunholo-0.58.5.dist-info → sunholo-0.59.1.dist-info}/top_level.txt +0 -0
sunholo/cli/configs.py
CHANGED
|
@@ -1,29 +1,124 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
from ..utils.config import load_all_configs
|
|
3
|
+
from ..utils.config_schema import SCHEMAS, VAC_SUBCONFIG_SCHEMA
|
|
2
4
|
|
|
5
|
+
from jsonschema import validate, ValidationError
|
|
3
6
|
from pprint import pprint
|
|
4
7
|
|
|
8
|
+
def validate_config(config, schema):
|
|
9
|
+
try:
|
|
10
|
+
validate(instance=config, schema=schema)
|
|
11
|
+
print("OK: Validated schema")
|
|
12
|
+
return True
|
|
13
|
+
except ValidationError as err:
|
|
14
|
+
error_path = " -> ".join(map(str, err.path))
|
|
15
|
+
#print(f"ERROR: Validation error at '{error_path}': {err.message}")
|
|
16
|
+
raise ValidationError(f"Validation error at '{error_path}': {err.message}")
|
|
17
|
+
|
|
5
18
|
def list_configs(args):
|
|
6
19
|
"""
|
|
7
|
-
Lists configuration files, filtered by kind if specified.
|
|
20
|
+
Lists configuration files, filtered by kind or VAC name if specified, and optionally validates them.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
args: Command-line arguments including 'kind', 'vac', and 'validate' for filtering and validation.
|
|
24
|
+
|
|
25
|
+
Examples:
|
|
26
|
+
# List all configurations
|
|
27
|
+
list_configs(args)
|
|
28
|
+
|
|
29
|
+
# List configurations filtered by kind
|
|
30
|
+
args.kind = 'vacConfig'
|
|
31
|
+
list_configs(args)
|
|
32
|
+
|
|
33
|
+
# List configurations filtered by VAC name
|
|
34
|
+
args.vac = 'edmonbrain'
|
|
35
|
+
list_configs(args)
|
|
36
|
+
|
|
37
|
+
# List configurations filtered by both kind and VAC name
|
|
38
|
+
args.kind = 'vacConfig'
|
|
39
|
+
args.vac = 'edmonbrain'
|
|
40
|
+
list_configs(args)
|
|
41
|
+
|
|
42
|
+
# Validate configurations
|
|
43
|
+
args.validate = True
|
|
44
|
+
list_configs(args)
|
|
8
45
|
"""
|
|
9
46
|
print("Listing configuration files")
|
|
10
47
|
configs = load_all_configs()
|
|
48
|
+
filtered_configs = {}
|
|
11
49
|
|
|
12
|
-
if args.kind:
|
|
50
|
+
if args.kind and args.vac:
|
|
13
51
|
if args.kind in configs:
|
|
14
|
-
|
|
15
|
-
|
|
52
|
+
kind_config = configs[args.kind]
|
|
53
|
+
vac_config = kind_config.get('vac', {}).get(args.vac)
|
|
54
|
+
if vac_config:
|
|
55
|
+
filtered_configs[args.kind] = {args.vac: vac_config}
|
|
56
|
+
else:
|
|
57
|
+
print(f"No configurations found for kind: {args.kind} with VAC: {args.vac}")
|
|
16
58
|
else:
|
|
17
59
|
print(f"No configurations found for kind: {args.kind}")
|
|
18
|
-
|
|
60
|
+
elif args.kind:
|
|
61
|
+
if args.kind in configs:
|
|
62
|
+
filtered_configs[args.kind] = configs[args.kind]
|
|
63
|
+
else:
|
|
64
|
+
print(f"No configurations found for kind: {args.kind}")
|
|
65
|
+
elif args.vac:
|
|
19
66
|
for kind, config in configs.items():
|
|
20
|
-
|
|
21
|
-
|
|
67
|
+
vac_config = config.get('vac', {}).get(args.vac)
|
|
68
|
+
if vac_config:
|
|
69
|
+
if kind not in filtered_configs:
|
|
70
|
+
filtered_configs[kind] = {}
|
|
71
|
+
filtered_configs[kind][args.vac] = vac_config
|
|
72
|
+
if not filtered_configs:
|
|
73
|
+
print(f"No configurations found with VAC: {args.vac}")
|
|
74
|
+
else:
|
|
75
|
+
filtered_configs = configs
|
|
76
|
+
|
|
77
|
+
for kind, config in filtered_configs.items():
|
|
78
|
+
print(f"## Config kind: {kind}")
|
|
79
|
+
pprint(config)
|
|
80
|
+
|
|
81
|
+
if args.validate:
|
|
82
|
+
validation_failed = False
|
|
83
|
+
for kind, config in filtered_configs.items():
|
|
84
|
+
print(f"Validating configuration for kind: {kind}")
|
|
85
|
+
if args.kind == "vacConfig" and args.vac:
|
|
86
|
+
print(f"Validating vacConfig for {args.vac}")
|
|
87
|
+
try:
|
|
88
|
+
validate_config(config[args.vac], VAC_SUBCONFIG_SCHEMA)
|
|
89
|
+
except ValidationError as e:
|
|
90
|
+
print(f"Validation failed for sub-kind: {args.vac} - {str(e)}")
|
|
91
|
+
validation_failed = True
|
|
92
|
+
elif kind in SCHEMAS:
|
|
93
|
+
try:
|
|
94
|
+
validate_config(config, SCHEMAS[kind])
|
|
95
|
+
except ValidationError as e:
|
|
96
|
+
print(f"FAIL: Validation failed for kind: {kind} - - {str(e)}")
|
|
97
|
+
validation_failed = True
|
|
98
|
+
else:
|
|
99
|
+
print(f"No schema available to validate configuration for kind: {kind}")
|
|
100
|
+
|
|
101
|
+
if validation_failed:
|
|
102
|
+
print("Validation failed for one or more configurations")
|
|
103
|
+
|
|
104
|
+
sys.exit(1)
|
|
105
|
+
|
|
22
106
|
|
|
23
107
|
def setup_list_configs_subparser(subparsers):
|
|
24
108
|
"""
|
|
25
109
|
Sets up an argparse subparser for the 'list-configs' command.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
subparsers: The subparsers object from argparse.ArgumentParser().
|
|
113
|
+
|
|
114
|
+
Examples:
|
|
115
|
+
# Set up the subparser for the 'list-configs' command
|
|
116
|
+
parser = argparse.ArgumentParser()
|
|
117
|
+
subparsers = parser.add_subparsers()
|
|
118
|
+
setup_list_configs_subparser(subparsers)
|
|
26
119
|
"""
|
|
27
|
-
list_configs_parser = subparsers.add_parser('list-configs', help='Lists all configuration files and their details.')
|
|
28
|
-
list_configs_parser.add_argument('--kind', help='Filter configurations by kind.')
|
|
120
|
+
list_configs_parser = subparsers.add_parser('list-configs', help='Lists all configuration files and their details e.g. `sunholo list-configs --kind=vacConfig --vac=edmonbrain`')
|
|
121
|
+
list_configs_parser.add_argument('--kind', help='Filter configurations by kind e.g. `--kind=vacConfig`')
|
|
122
|
+
list_configs_parser.add_argument('--vac', help='Filter configurations by VAC name e.g. `--vac=edmonbrain`')
|
|
123
|
+
list_configs_parser.add_argument('--validate', action='store_true', help='Validate the configuration files.')
|
|
29
124
|
list_configs_parser.set_defaults(func=list_configs)
|
sunholo/gcs/download_url.py
CHANGED
|
@@ -2,12 +2,13 @@ import os
|
|
|
2
2
|
from urllib.parse import quote
|
|
3
3
|
from datetime import datetime, timedelta
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# needs to be in minimal to check gcp
|
|
6
|
+
import google.auth
|
|
7
|
+
from google.auth.transport import requests
|
|
8
|
+
from google.auth.exceptions import RefreshError
|
|
6
9
|
|
|
7
10
|
try:
|
|
8
|
-
from google.cloud import storage
|
|
9
|
-
from google.auth.transport import requests
|
|
10
|
-
from google.auth.exceptions import RefreshError
|
|
11
|
+
from google.cloud import storage
|
|
11
12
|
except ImportError:
|
|
12
13
|
storage = None
|
|
13
14
|
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
VAC_SUBCONFIG_SCHEMA = {
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"llm": {"type": "string"},
|
|
5
|
+
"agent": {"type": "string"},
|
|
6
|
+
"model": {"type": "string"},
|
|
7
|
+
"prompt": {"type": "string"},
|
|
8
|
+
"chunker": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"type": {"type": "string"},
|
|
12
|
+
"llm": {"type": "string"},
|
|
13
|
+
"chunk_size": {"type": "integer"},
|
|
14
|
+
"overlap": {"type": "integer"}
|
|
15
|
+
},
|
|
16
|
+
"additionalProperties": False
|
|
17
|
+
},
|
|
18
|
+
"memory": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"patternProperties": {
|
|
23
|
+
".*-vectorstore": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"vectorstore": {"type": "string"},
|
|
27
|
+
"self_query": {"type": "boolean"},
|
|
28
|
+
"provider": {"type": "string"},
|
|
29
|
+
"k": {"type": "integer"},
|
|
30
|
+
"vector_name": {"type": "string"},
|
|
31
|
+
"read_only": {"type": "boolean"},
|
|
32
|
+
"llm": {"type": "string"}
|
|
33
|
+
},
|
|
34
|
+
"required": ["vectorstore"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"gcp_config": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"project_id": {"type": "string"},
|
|
43
|
+
"endpoint_id": {"type": "integer"},
|
|
44
|
+
"location": {"type": "string"}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"alloydb_config": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"project_id": {"type": "string"},
|
|
51
|
+
"region": {"type": "string"},
|
|
52
|
+
"cluster": {"type": "string"},
|
|
53
|
+
"instance": {"type": "string"},
|
|
54
|
+
"database": {"type": "string"}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"secrets": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": {"type": "string"}
|
|
60
|
+
},
|
|
61
|
+
"display_name": {"type": "string"},
|
|
62
|
+
"avatar_url": {"type": "string"},
|
|
63
|
+
"description": {"type": "string"},
|
|
64
|
+
"memory_k": {"type": "integer"}
|
|
65
|
+
},
|
|
66
|
+
"required": ["llm", "agent"]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
VAC_CONFIG_SCHEMA = {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"properties": {
|
|
73
|
+
"kind": {"type": "string"},
|
|
74
|
+
"apiVersion": {"type": "string"},
|
|
75
|
+
"gcp_config": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"project_id": {"type": "string"},
|
|
79
|
+
"location": {"type": "string"}
|
|
80
|
+
},
|
|
81
|
+
"required": ["project_id", "location"]
|
|
82
|
+
},
|
|
83
|
+
"vac": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"patternProperties": {
|
|
86
|
+
".*": VAC_SUBCONFIG_SCHEMA
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": ["kind", "apiVersion", "gcp_config", "vac"]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
PROMPT_CONFIG_SCHEMA = {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"properties": {
|
|
96
|
+
"kind": {"type": "string"},
|
|
97
|
+
"apiVersion": {"type": "string"},
|
|
98
|
+
"prompts": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"patternProperties": {
|
|
101
|
+
".*": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"chunk_summary": {"type": "string"},
|
|
105
|
+
"intro": {"type": "string"},
|
|
106
|
+
"template": {"type": "string"},
|
|
107
|
+
"chat_summary": {"type": "string"},
|
|
108
|
+
"summarise_known_question": {"type": "string"}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"required": ["kind", "apiVersion", "prompts"]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
SCHEMAS = {
|
|
118
|
+
"vacConfig": VAC_CONFIG_SCHEMA,
|
|
119
|
+
"promptConfig": PROMPT_CONFIG_SCHEMA
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.59.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.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.59.1.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
|
+
Requires-Dist: jsonschema
|
|
21
22
|
Requires-Dist: langchain
|
|
22
23
|
Requires-Dist: langchain-experimental
|
|
23
24
|
Requires-Dist: langchain-community
|
|
@@ -33,7 +33,7 @@ sunholo/chunker/splitter.py,sha256=ug_v-h0wos3b7OkhmedVQs5jtLuDdFDWypvsZVYgxbU,6
|
|
|
33
33
|
sunholo/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
sunholo/cli/cli.py,sha256=rcO1hMthy5nWC_5sOHqRm7ut70c9JfxFTSjFRBNYuYg,1248
|
|
35
35
|
sunholo/cli/cli_init.py,sha256=WReZuMQwDfkRUvssYT7TirUoG6SiT1dTDol8nLI8O70,3418
|
|
36
|
-
sunholo/cli/configs.py,sha256=
|
|
36
|
+
sunholo/cli/configs.py,sha256=8oiFwFHTHzXtEK4AW3CLVcfcwt6rV9UTpM0v0_RW2I0,4820
|
|
37
37
|
sunholo/cli/deploy.py,sha256=zxdwUsRTRMC8U5vyRv0JiKBLFn84Ug_Tc88-_h9hJSs,1609
|
|
38
38
|
sunholo/components/__init__.py,sha256=RJGNEihwvRIiDScKis04RHJv4yZGI1UpXlOmuCptNZI,208
|
|
39
39
|
sunholo/components/llm.py,sha256=T4we3tGmqUj4tPwxQr9M6AXv_BALqZV_dRSvINan-oU,10374
|
|
@@ -56,7 +56,7 @@ sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,
|
|
|
56
56
|
sunholo/embedder/embed_chunk.py,sha256=XV1kdDUWw2QO-am5_Yl7GrYP9V_4i1XRNNFPhqUSnZQ,5851
|
|
57
57
|
sunholo/gcs/__init__.py,sha256=DtVw_AZwQn-IguR5BJuIi2XJeF_FQXizhJikzRNrXiE,50
|
|
58
58
|
sunholo/gcs/add_file.py,sha256=JmJIuz5Z1h7-eJ6s2eE3wc8Y4IAv3Jridq1xfQbD9_E,4711
|
|
59
|
-
sunholo/gcs/download_url.py,sha256=
|
|
59
|
+
sunholo/gcs/download_url.py,sha256=HJlRhjs2WGtWV5jk0fcOGj9QCXVW4NQJV5X9toucyO8,4800
|
|
60
60
|
sunholo/gcs/metadata.py,sha256=C9sMPsHsq1ETetdQCqB3EBs3Kws8b8QHS9L7ei_v5aw,891
|
|
61
61
|
sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
62
|
sunholo/langfuse/callback.py,sha256=G9xcZHpLvyzolU57ycItLaooMCtRuM37QJSWjiwQEd0,1776
|
|
@@ -85,13 +85,14 @@ sunholo/summarise/summarise.py,sha256=C3HhjepTjUhUC8FLk4jMQIBvq1BcORniwuTFHjPVhV
|
|
|
85
85
|
sunholo/utils/__init__.py,sha256=G11nN_6ATjxpuMfG_BvcUr9UU8onPIgkpTK6CjOcbr8,48
|
|
86
86
|
sunholo/utils/big_context.py,sha256=qHYtds4Ecf9eZRHVqXho4_q8Je7HD44-vS6RJ6s9Z0Q,5387
|
|
87
87
|
sunholo/utils/config.py,sha256=Ve1sb68Av9_SPGqXs33g5FAJSIQ3GODoeuUCW3MNCwU,8802
|
|
88
|
+
sunholo/utils/config_schema.py,sha256=bx3SHHuZ3SCOOXNRU91Mk-b4pHXt7D-EElv7Q85gAdw,3758
|
|
88
89
|
sunholo/utils/gcp.py,sha256=B2G1YKjeD7X9dqO86Jrp2vPuFwZ223Xl5Tg09Ndw-oc,5760
|
|
89
90
|
sunholo/utils/parsers.py,sha256=OrHmASqIbI45atVOhiGodgLvnfrzkvVzyHnSvAXD89I,3841
|
|
90
91
|
sunholo/vertex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
92
|
sunholo/vertex/init_vertex.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
|
|
92
|
-
sunholo-0.
|
|
93
|
-
sunholo-0.
|
|
94
|
-
sunholo-0.
|
|
95
|
-
sunholo-0.
|
|
96
|
-
sunholo-0.
|
|
97
|
-
sunholo-0.
|
|
93
|
+
sunholo-0.59.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
94
|
+
sunholo-0.59.1.dist-info/METADATA,sha256=84L9QkQTPWbkcIAKuO6W__im6N66Da8UJ0400bYA_xA,7903
|
|
95
|
+
sunholo-0.59.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
96
|
+
sunholo-0.59.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
97
|
+
sunholo-0.59.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
98
|
+
sunholo-0.59.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|