sunholo 0.101.12__py3-none-any.whl → 0.102.0__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/genai/process_funcs_cls.py +9 -3
- sunholo/invoke/direct_vac_func.py +15 -5
- {sunholo-0.101.12.dist-info → sunholo-0.102.0.dist-info}/METADATA +2 -2
- {sunholo-0.101.12.dist-info → sunholo-0.102.0.dist-info}/RECORD +8 -8
- {sunholo-0.101.12.dist-info → sunholo-0.102.0.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.101.12.dist-info → sunholo-0.102.0.dist-info}/WHEEL +0 -0
- {sunholo-0.101.12.dist-info → sunholo-0.102.0.dist-info}/entry_points.txt +0 -0
- {sunholo-0.101.12.dist-info → sunholo-0.102.0.dist-info}/top_level.txt +0 -0
|
@@ -60,12 +60,13 @@ class GenAIFunctionProcessor:
|
|
|
60
60
|
```
|
|
61
61
|
"""
|
|
62
62
|
|
|
63
|
-
def __init__(self, config: ConfigManager):
|
|
63
|
+
def __init__(self, config: ConfigManager=None, model_name=None):
|
|
64
64
|
"""
|
|
65
65
|
Initializes the GenAIFunctionProcessor with the given configuration.
|
|
66
66
|
|
|
67
67
|
Args:
|
|
68
68
|
config (ConfigManager): The configuration manager instance.
|
|
69
|
+
model_name (str): The name of the model
|
|
69
70
|
"""
|
|
70
71
|
if not genai:
|
|
71
72
|
raise ImportError("import google.generativeai as genai is required, import via `pip install sunholo[gcp]`")
|
|
@@ -77,7 +78,12 @@ class GenAIFunctionProcessor:
|
|
|
77
78
|
if 'decide_to_go_on' not in self.funcs:
|
|
78
79
|
self.funcs['decide_to_go_on'] = self.decide_to_go_on
|
|
79
80
|
|
|
80
|
-
self.model_name =
|
|
81
|
+
self.model_name = "gemini-1.5-flash"
|
|
82
|
+
if config:
|
|
83
|
+
self.model_name = config.vacConfig("model") if config.vacConfig("llm") == "vertex" else "gemini-1.5-flash"
|
|
84
|
+
elif model_name:
|
|
85
|
+
self.model_name = model_name
|
|
86
|
+
|
|
81
87
|
self.last_api_requests_and_responses = []
|
|
82
88
|
self._validate_functions()
|
|
83
89
|
|
|
@@ -281,7 +287,7 @@ class GenAIFunctionProcessor:
|
|
|
281
287
|
error_message = f"Error in {function_name}: {str(err)}"
|
|
282
288
|
traceback_details = traceback.format_exc()
|
|
283
289
|
log.warning(f"{error_message}\nTraceback: {traceback_details}")
|
|
284
|
-
result = [
|
|
290
|
+
result = [error_message] #traceback uses too many tokens
|
|
285
291
|
clean_result = self.remove_invisible_characters(result)
|
|
286
292
|
api_requests_and_responses.append(
|
|
287
293
|
[function_name, params, clean_result]
|
|
@@ -7,7 +7,7 @@ from ..utils.api_key import has_multivac_api_key
|
|
|
7
7
|
import asyncio
|
|
8
8
|
from threading import Thread
|
|
9
9
|
|
|
10
|
-
def direct_vac(vac_input: dict, vac_name: str, chat_history=
|
|
10
|
+
def direct_vac(vac_input: dict, vac_name: str, chat_history=None):
|
|
11
11
|
"""
|
|
12
12
|
This lets VACs call other VAC Q&A endpoints within their code
|
|
13
13
|
"""
|
|
@@ -42,6 +42,8 @@ def direct_vac(vac_input: dict, vac_name: str, chat_history=[]):
|
|
|
42
42
|
|
|
43
43
|
# Prepare the kwargs for send_to_qa by copying vac_input and adding more values
|
|
44
44
|
qa_kwargs = vac_input.copy()
|
|
45
|
+
if not chat_history:
|
|
46
|
+
chat_history = []
|
|
45
47
|
|
|
46
48
|
# Add additional arguments
|
|
47
49
|
qa_kwargs.update({
|
|
@@ -68,7 +70,7 @@ def direct_vac(vac_input: dict, vac_name: str, chat_history=[]):
|
|
|
68
70
|
|
|
69
71
|
return answer
|
|
70
72
|
|
|
71
|
-
async def async_direct_vac(vac_input: dict, vac_name: str, chat_history=
|
|
73
|
+
async def async_direct_vac(vac_input: dict, vac_name: str, chat_history=None):
|
|
72
74
|
"""
|
|
73
75
|
Asynchronous version of direct_vac using send_to_qa_async.
|
|
74
76
|
Allows VACs to call other VAC Q&A endpoints without blocking the event loop.
|
|
@@ -105,6 +107,9 @@ async def async_direct_vac(vac_input: dict, vac_name: str, chat_history=[]):
|
|
|
105
107
|
# Prepare the kwargs for send_to_qa_async by copying vac_input and adding more values
|
|
106
108
|
qa_kwargs = vac_input.copy()
|
|
107
109
|
|
|
110
|
+
if not chat_history:
|
|
111
|
+
chat_history = []
|
|
112
|
+
|
|
108
113
|
# Add additional arguments
|
|
109
114
|
qa_kwargs.update({
|
|
110
115
|
'vector_name': vac_name,
|
|
@@ -138,7 +143,7 @@ async def async_direct_vac(vac_input: dict, vac_name: str, chat_history=[]):
|
|
|
138
143
|
|
|
139
144
|
return answer
|
|
140
145
|
|
|
141
|
-
def direct_vac_stream(vac_input: dict, vac_name: str, chat_history=
|
|
146
|
+
def direct_vac_stream(vac_input: dict, vac_name: str, chat_history=None):
|
|
142
147
|
|
|
143
148
|
if 'user_input' not in vac_input:
|
|
144
149
|
raise ValueError('vac_input must contain at least "user_input" key - got {vac_input}')
|
|
@@ -146,6 +151,9 @@ def direct_vac_stream(vac_input: dict, vac_name: str, chat_history=[]):
|
|
|
146
151
|
user_id = vac_input.get('user_id')
|
|
147
152
|
session_id = vac_input.get('session_id')
|
|
148
153
|
image_uri = vac_input.get('image_url') or vac_input.get('image_uri')
|
|
154
|
+
|
|
155
|
+
if not chat_history:
|
|
156
|
+
chat_history = []
|
|
149
157
|
|
|
150
158
|
log.info(f"Streaming invoke_vac_qa with {vac_input=}")
|
|
151
159
|
def stream_response():
|
|
@@ -196,7 +204,7 @@ def direct_vac_stream(vac_input: dict, vac_name: str, chat_history=[]):
|
|
|
196
204
|
|
|
197
205
|
|
|
198
206
|
|
|
199
|
-
async def async_direct_vac_stream(vac_input: dict, vac_name: str, chat_history=
|
|
207
|
+
async def async_direct_vac_stream(vac_input: dict, vac_name: str, chat_history=None):
|
|
200
208
|
"""
|
|
201
209
|
Asynchronous version of direct_vac_stream.
|
|
202
210
|
Streams responses from VAC Q&A endpoints without blocking the event loop.
|
|
@@ -209,13 +217,15 @@ async def async_direct_vac_stream(vac_input: dict, vac_name: str, chat_history=[
|
|
|
209
217
|
image_uri = vac_input.get('image_url') or vac_input.get('image_uri')
|
|
210
218
|
|
|
211
219
|
log.info(f"Streaming invoke_vac_qa with vac_input={vac_input}")
|
|
220
|
+
if not chat_history:
|
|
221
|
+
chat_history = []
|
|
212
222
|
|
|
213
223
|
def sync_stream_response():
|
|
214
224
|
generate = generate_proxy_stream(
|
|
215
225
|
send_to_qa,
|
|
216
226
|
vac_input["user_input"],
|
|
217
227
|
vector_name=vac_name,
|
|
218
|
-
chat_history=chat_history,
|
|
228
|
+
chat_history=chat_history or [],
|
|
219
229
|
generate_f_output=lambda x: x, # Replace with actual processing function
|
|
220
230
|
stream_wait_time=0.5,
|
|
221
231
|
stream_timeout=120,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.102.0
|
|
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.102.0.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -88,11 +88,11 @@ sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
|
|
|
88
88
|
sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
|
|
89
89
|
sunholo/genai/images.py,sha256=eW5V2h2JdNqLkaw_u-pJSzu7edHzvrCWPLirolQXX5s,1617
|
|
90
90
|
sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
|
|
91
|
-
sunholo/genai/process_funcs_cls.py,sha256=
|
|
91
|
+
sunholo/genai/process_funcs_cls.py,sha256=wiOIMeGLFEParAkdwHbfySzsPuUgi0rimEYOMbWEZKU,29317
|
|
92
92
|
sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
|
|
93
93
|
sunholo/invoke/__init__.py,sha256=o1RhwBGOtVK0MIdD55fAIMCkJsxTksi8GD5uoqVKI-8,184
|
|
94
94
|
sunholo/invoke/async_class.py,sha256=G8vD2H94fpBc37mSJSQODEKJ67P2mPQEHabtDaLOvxE,8033
|
|
95
|
-
sunholo/invoke/direct_vac_func.py,sha256=
|
|
95
|
+
sunholo/invoke/direct_vac_func.py,sha256=dACx3Zh7uZnuWLIFYiyLoyXUhh5-eUpd2RatDUd9ov8,9753
|
|
96
96
|
sunholo/invoke/invoke_vac_utils.py,sha256=sJc1edHTHMzMGXjji1N67c3iUaP7BmAL5nj82Qof63M,2053
|
|
97
97
|
sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
98
|
sunholo/langfuse/callback.py,sha256=jl0SZsFS53uMW9DGeM9SOL_EsRZsba0wwFGLqKzu9_U,1684
|
|
@@ -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.
|
|
151
|
-
sunholo-0.
|
|
152
|
-
sunholo-0.
|
|
153
|
-
sunholo-0.
|
|
154
|
-
sunholo-0.
|
|
155
|
-
sunholo-0.
|
|
150
|
+
sunholo-0.102.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
151
|
+
sunholo-0.102.0.dist-info/METADATA,sha256=5-dYSKg8cpNoJLR8gKDD4f_y1sIlQ4TvJdox0l7K4n4,8312
|
|
152
|
+
sunholo-0.102.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
153
|
+
sunholo-0.102.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
154
|
+
sunholo-0.102.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
155
|
+
sunholo-0.102.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|