sunholo 0.95.2__py3-none-any.whl → 0.95.3__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/route.py +2 -2
- sunholo/genai/process_funcs_cls.py +6 -6
- sunholo/streaming/streaming.py +10 -0
- {sunholo-0.95.2.dist-info → sunholo-0.95.3.dist-info}/METADATA +2 -2
- {sunholo-0.95.2.dist-info → sunholo-0.95.3.dist-info}/RECORD +9 -9
- {sunholo-0.95.2.dist-info → sunholo-0.95.3.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.95.2.dist-info → sunholo-0.95.3.dist-info}/WHEEL +0 -0
- {sunholo-0.95.2.dist-info → sunholo-0.95.3.dist-info}/entry_points.txt +0 -0
- {sunholo-0.95.2.dist-info → sunholo-0.95.3.dist-info}/top_level.txt +0 -0
sunholo/agents/route.py
CHANGED
|
@@ -65,14 +65,14 @@ def route_endpoint(vector_name=None, method = 'post', override_endpoint=None, co
|
|
|
65
65
|
|
|
66
66
|
agents_config = config.agentConfig(agent_type)
|
|
67
67
|
|
|
68
|
-
log.
|
|
68
|
+
log.debug(f"agents_config: {agents_config}")
|
|
69
69
|
if method not in agents_config:
|
|
70
70
|
raise ValueError(f"Invalid method '{method}' for agent configuration.")
|
|
71
71
|
|
|
72
72
|
# 'post' or 'get'
|
|
73
73
|
endpoints_config = agents_config[method]
|
|
74
74
|
|
|
75
|
-
log.
|
|
75
|
+
log.debug(f"endpoints_config: {endpoints_config}")
|
|
76
76
|
# Replace placeholders in the config
|
|
77
77
|
endpoints = {}
|
|
78
78
|
for key, value in endpoints_config.items():
|
|
@@ -351,7 +351,7 @@ class GenAIFunctionProcessor:
|
|
|
351
351
|
log.error(f"Error initializing model: {str(err)}")
|
|
352
352
|
return None
|
|
353
353
|
|
|
354
|
-
def run_agent_loop(self, chat, content, callback, guardrail_max=10):
|
|
354
|
+
def run_agent_loop(self, chat, content, callback, guardrail_max=10, loop_return=3):
|
|
355
355
|
"""
|
|
356
356
|
Runs the agent loop, sending messages to the orchestrator, processing responses, and executing functions.
|
|
357
357
|
|
|
@@ -360,12 +360,13 @@ class GenAIFunctionProcessor:
|
|
|
360
360
|
content: The initial content to send to the agent.
|
|
361
361
|
callback: The callback object for handling intermediate responses.
|
|
362
362
|
guardrail_max (int): The maximum number of iterations for the loop.
|
|
363
|
+
loop_return (int): The number of last loop iterations to return. Default 3 will return last 3 iterations. If loop_return > guardrail_max then all iterations are returned.
|
|
363
364
|
|
|
364
365
|
Returns:
|
|
365
366
|
tuple: (big_text, usage_metadata) from the loop execution.
|
|
366
367
|
"""
|
|
367
368
|
guardrail = 0
|
|
368
|
-
|
|
369
|
+
big_result = []
|
|
369
370
|
usage_metadata = {
|
|
370
371
|
"prompt_token_count": 0,
|
|
371
372
|
"candidates_token_count": 0,
|
|
@@ -422,7 +423,6 @@ class GenAIFunctionProcessor:
|
|
|
422
423
|
if hasattr(chunk, 'text') and isinstance(chunk.text, str):
|
|
423
424
|
token = chunk.text
|
|
424
425
|
token_queue.append(token)
|
|
425
|
-
big_text += token
|
|
426
426
|
this_text += token
|
|
427
427
|
else:
|
|
428
428
|
log.info("skipping chunk with no text")
|
|
@@ -486,18 +486,17 @@ class GenAIFunctionProcessor:
|
|
|
486
486
|
else:
|
|
487
487
|
token += f"{fn_result}\n--- end ---\n"
|
|
488
488
|
|
|
489
|
-
big_text += token
|
|
490
489
|
this_text += token
|
|
491
490
|
token_queue.append(token)
|
|
492
491
|
else:
|
|
493
492
|
token = "\nNo function executions were found\n"
|
|
494
493
|
token_queue.append(token)
|
|
495
|
-
big_text += token
|
|
496
494
|
this_text += token
|
|
497
495
|
|
|
498
496
|
if this_text:
|
|
499
497
|
content.append(f"Agent: {this_text}")
|
|
500
498
|
log.info(f"[{guardrail}] Updated content:\n{this_text}")
|
|
499
|
+
big_result.append(this_text)
|
|
501
500
|
else:
|
|
502
501
|
log.warning(f"[{guardrail}] No content created this loop")
|
|
503
502
|
content.append(f"Agent: No response was found for loop [{guardrail}]")
|
|
@@ -523,7 +522,8 @@ class GenAIFunctionProcessor:
|
|
|
523
522
|
callback.on_llm_new_token(token=token)
|
|
524
523
|
|
|
525
524
|
usage_metadata["functions_called"] = functions_called
|
|
526
|
-
|
|
525
|
+
|
|
526
|
+
big_text = "\n".join(big_result[loop_return:])
|
|
527
527
|
|
|
528
528
|
return big_text, usage_metadata
|
|
529
529
|
|
sunholo/streaming/streaming.py
CHANGED
|
@@ -175,6 +175,16 @@ async def start_streaming_chat_async(question, vector_name, qna_func_async, chat
|
|
|
175
175
|
# Run start_chat asynchronously
|
|
176
176
|
chat_task = asyncio.create_task(start_chat())
|
|
177
177
|
|
|
178
|
+
# Allow the event loop to process the scheduled tasks
|
|
179
|
+
await asyncio.sleep(0)
|
|
180
|
+
|
|
181
|
+
# Read and yield any initial content from the content buffer
|
|
182
|
+
content_to_send = content_buffer.read()
|
|
183
|
+
if content_to_send:
|
|
184
|
+
log.info(f"Initial content: {content_to_send}")
|
|
185
|
+
yield content_to_send
|
|
186
|
+
content_buffer.clear()
|
|
187
|
+
|
|
178
188
|
start = time.time()
|
|
179
189
|
|
|
180
190
|
while not chat_callback_handler.stream_finished.is_set() and not stop_event.is_set():
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.95.
|
|
3
|
+
Version: 0.95.3
|
|
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.95.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.95.3.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -5,7 +5,7 @@ sunholo/agents/chat_history.py,sha256=Gph_CdlP2otYnNdR1q1Umyyyvcad2F6K3LxU5yBQ9l
|
|
|
5
5
|
sunholo/agents/dispatch_to_qa.py,sha256=Z2q0ygYxfgBr-EGydq_H5y4Y-bKlY4ZCBCwkGpYwjFY,8766
|
|
6
6
|
sunholo/agents/langserve.py,sha256=C46ph2mnygr6bdHijYWYyfQDI9ylAF0_9Kx2PfcCJpU,4414
|
|
7
7
|
sunholo/agents/pubsub.py,sha256=TscZN_6am6DfaQkC-Yl18ZIBOoLE-0nDSiil6GpQEh4,1344
|
|
8
|
-
sunholo/agents/route.py,sha256=
|
|
8
|
+
sunholo/agents/route.py,sha256=mV8tGABbSqcg3PQL02MgQOs41gKEHLMyIJJJcTuFdbE,2988
|
|
9
9
|
sunholo/agents/special_commands.py,sha256=YhN8_E4cGZVvagN5_fouaxZiVbxr7PEhSzoFcvTKH54,6501
|
|
10
10
|
sunholo/agents/swagger.py,sha256=2tzGmpveUMmTREykZvVnDj3j295wyOMu7mUFDnXdY3c,10671
|
|
11
11
|
sunholo/agents/fastapi/__init__.py,sha256=S_pj4_bTUmDGoq_exaREHlOKThi0zTuGT0VZY0YfODQ,88
|
|
@@ -86,7 +86,7 @@ sunholo/gcs/download_url.py,sha256=q1NiJSvEhdNrmU5ZJ-sBCMC_J5CxzrajY8LRgdPOV_M,6
|
|
|
86
86
|
sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
|
|
87
87
|
sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
|
|
88
88
|
sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
|
|
89
|
-
sunholo/genai/process_funcs_cls.py,sha256=
|
|
89
|
+
sunholo/genai/process_funcs_cls.py,sha256=OCLa_yPjVlE7wY1v54SY0M6b5lpU2l3guRHb-qYOk2A,24359
|
|
90
90
|
sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
|
|
91
91
|
sunholo/invoke/__init__.py,sha256=VOpsfhNf98az3at7bMaY1Fiw4UIZAS6zMmSqWd6_ksI,141
|
|
92
92
|
sunholo/invoke/async_class.py,sha256=NYuQU-LIhnJEmierbSwmwxXfNzmEhqDZCSx5BZDEYA8,3225
|
|
@@ -117,7 +117,7 @@ sunholo/streaming/__init__.py,sha256=MpbydI2UYo_adttPQFkxNM33b-QRyNEbrKJx0C2AGPc
|
|
|
117
117
|
sunholo/streaming/content_buffer.py,sha256=HLj-EJcCxxFwPcEZ4Xu3Ns0tDT6awkTe5QY9S7bMnjg,9162
|
|
118
118
|
sunholo/streaming/langserve.py,sha256=hi7q8WY8DPKrALl9m_dOMxWOdE-iEuk7YW05SVDFIX8,6514
|
|
119
119
|
sunholo/streaming/stream_lookup.py,sha256=hYg1DbdSE_QNJ8ZB-ynXJlWgvFjrGvwoUsGJu_E0pRQ,360
|
|
120
|
-
sunholo/streaming/streaming.py,sha256=
|
|
120
|
+
sunholo/streaming/streaming.py,sha256=Z_M6rn6XZUMfQggiQ79dw5HD7xaodvq0UGS34C5dHbQ,16549
|
|
121
121
|
sunholo/summarise/__init__.py,sha256=MZk3dblUMODcPb1crq4v-Z508NrFIpkSWNf9FIO8BcU,38
|
|
122
122
|
sunholo/summarise/summarise.py,sha256=95A-6PXFGanjona8DvZPnnIHLbzZ2ip5hO0wOAJQhfw,3791
|
|
123
123
|
sunholo/terraform/__init__.py,sha256=yixxEltc3n9UpZaVi05GlgS-YRq_DVGjUc37I9ajeP4,76
|
|
@@ -144,9 +144,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
|
|
|
144
144
|
sunholo/vertex/memory_tools.py,sha256=x3_ESOhgMpf-gNpiOzmP7YQI0l0FAoLtbAVP2K2N0OA,7724
|
|
145
145
|
sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
|
|
146
146
|
sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
|
|
147
|
-
sunholo-0.95.
|
|
148
|
-
sunholo-0.95.
|
|
149
|
-
sunholo-0.95.
|
|
150
|
-
sunholo-0.95.
|
|
151
|
-
sunholo-0.95.
|
|
152
|
-
sunholo-0.95.
|
|
147
|
+
sunholo-0.95.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
148
|
+
sunholo-0.95.3.dist-info/METADATA,sha256=BIKn4TOl_j1DzdCYb_MLEfd-3nI3aUhaofHrGXlDSbc,7889
|
|
149
|
+
sunholo-0.95.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
150
|
+
sunholo-0.95.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
151
|
+
sunholo-0.95.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
152
|
+
sunholo-0.95.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|