sunholo 0.92.4__tar.gz → 0.92.6__tar.gz
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-0.92.4 → sunholo-0.92.6}/PKG-INFO +2 -2
- {sunholo-0.92.4 → sunholo-0.92.6}/setup.py +1 -1
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/chat_vac.py +16 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/genai/process_funcs_cls.py +36 -25
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/config_class.py +3 -5
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo.egg-info/PKG-INFO +2 -2
- {sunholo-0.92.4 → sunholo-0.92.6}/LICENSE.txt +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/MANIFEST.in +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/README.md +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/setup.cfg +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/flask/qna_routes.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/flask/vac_routes.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/langserve.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/route.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/agents/swagger.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/archive/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/archive/archive.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/auth/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/auth/gcloud.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/auth/refresh.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/auth/run.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/azure/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/azure/auth.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/azure/blobs.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/azure/event_grid.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/bots/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/bots/discord.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/bots/webapp.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/azure.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/encode_metadata.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/images.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/process_chunker_data.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/publish.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/pubsub.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/cli.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/configs.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/deploy.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/embedder.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/swagger.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/cli/vertex.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/components/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/components/llm.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/components/retriever.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/custom_logging.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/alloydb.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/alloydb_client.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/database.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/lancedb.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/database/uuid.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/discovery_engine/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/discovery_engine/chunker_handler.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/discovery_engine/create_new.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/excel/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/excel/plugin.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/gcs/download_folder.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/genai/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/genai/init.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/genai/safety.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/invoke/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/invoke/async_class.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/invoke/direct_vac_func.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/invoke/invoke_vac_utils.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/langfuse/evals.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/llamaindex/llamaindex_class.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/llamaindex/user_history.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/patches/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/patches/langchain/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/patches/langchain/lancedb.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/patches/langchain/vertexai.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/qna/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/qna/parsers.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/qna/retry.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/terraform/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/terraform/tfvars_editor.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/tools/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/tools/web_browser.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/api_key.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/big_context.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/config.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/gcp.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/parsers.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/utils/version.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/extensions_call.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/extensions_class.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/genai_functions.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/init.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/safety.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo/vertex/type_dict_to_json.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo.egg-info/SOURCES.txt +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo.egg-info/requires.txt +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/tests/test_chat_history.py +0 -0
- {sunholo-0.92.4 → sunholo-0.92.6}/tests/test_config.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.92.
|
|
3
|
+
Version: 0.92.6
|
|
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.92.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.92.6.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -533,6 +533,14 @@ def get_cloud_run_service_url(project, region, service_name):
|
|
|
533
533
|
Returns:
|
|
534
534
|
str: The URL of the Cloud Run service, or an error message if not found.
|
|
535
535
|
"""
|
|
536
|
+
# Try to load existing data from the file, or initialize an empty dict
|
|
537
|
+
file_path = "config/cloud_run_urls.json"
|
|
538
|
+
if os.path.exists(file_path):
|
|
539
|
+
with open(file_path, 'r') as file:
|
|
540
|
+
services_dict = json.load(file)
|
|
541
|
+
else:
|
|
542
|
+
services_dict = {}
|
|
543
|
+
|
|
536
544
|
try:
|
|
537
545
|
result = subprocess.run(
|
|
538
546
|
["gcloud", "run", "services", "describe", service_name, "--project", project, "--region", region, "--format=json"],
|
|
@@ -544,6 +552,14 @@ def get_cloud_run_service_url(project, region, service_name):
|
|
|
544
552
|
|
|
545
553
|
service = json.loads(result.stdout.decode())
|
|
546
554
|
service_url = service['status']['url']
|
|
555
|
+
|
|
556
|
+
# Update the services dictionary
|
|
557
|
+
services_dict[service_name] = service_url
|
|
558
|
+
|
|
559
|
+
# Write the updated dictionary back to the file
|
|
560
|
+
with open(file_path, 'w') as file:
|
|
561
|
+
json.dump(services_dict, file, indent=4)
|
|
562
|
+
|
|
547
563
|
return service_url
|
|
548
564
|
except Exception as e:
|
|
549
565
|
console.print(f"[bold red]ERROR: An unexpected error occurred: {e}[/bold red]")
|
|
@@ -7,6 +7,7 @@ from .safety import genai_safety
|
|
|
7
7
|
from typing import TYPE_CHECKING, Union
|
|
8
8
|
|
|
9
9
|
import json
|
|
10
|
+
from collections import deque
|
|
10
11
|
|
|
11
12
|
try:
|
|
12
13
|
import google.generativeai as genai
|
|
@@ -254,7 +255,9 @@ class GenAIFunctionProcessor:
|
|
|
254
255
|
if not isinstance(fn_exec, genai.protos.FunctionDeclaration):
|
|
255
256
|
# Execute the function with the provided parameters
|
|
256
257
|
result = fn_exec(**params_obj)
|
|
257
|
-
log.info(f"Got result from {function_name}: {result}")
|
|
258
|
+
log.info(f"Got result from {function_name}: {result} of type: {type(result)}")
|
|
259
|
+
if not isinstance(result, str):
|
|
260
|
+
log.warning(f"Tool functions should return strings: {function_name} returned type: {type(result)}")
|
|
258
261
|
else:
|
|
259
262
|
fn_result = type(fn).to_dict(fn)
|
|
260
263
|
result = fn_result.get("result")
|
|
@@ -370,12 +373,12 @@ class GenAIFunctionProcessor:
|
|
|
370
373
|
}
|
|
371
374
|
functions_called =[]
|
|
372
375
|
function_results = []
|
|
376
|
+
# Initialize token queue to ensure sequential processing
|
|
377
|
+
token_queue = deque()
|
|
373
378
|
|
|
374
379
|
while guardrail < guardrail_max:
|
|
375
380
|
|
|
376
|
-
|
|
377
|
-
token=f"\n----Loop [{guardrail}] Start------\nFunctions: {list(self.funcs.keys())}\n"
|
|
378
|
-
)
|
|
381
|
+
token_queue.append(f"\n----Loop [{guardrail}] Start------\nFunctions: {list(self.funcs.keys())}\n")
|
|
379
382
|
|
|
380
383
|
content_parse = ""
|
|
381
384
|
for i, chunk in enumerate(content):
|
|
@@ -387,13 +390,13 @@ class GenAIFunctionProcessor:
|
|
|
387
390
|
response = []
|
|
388
391
|
|
|
389
392
|
try:
|
|
390
|
-
|
|
393
|
+
token_queue.append("\n= Calling Agent =\n")
|
|
391
394
|
response = chat.send_message(content, stream=True)
|
|
392
395
|
|
|
393
396
|
except Exception as e:
|
|
394
397
|
msg = f"Error sending {content} to model: {str(e)} - {traceback.format_exc()}"
|
|
395
398
|
log.info(msg)
|
|
396
|
-
|
|
399
|
+
token_queue.append(msg)
|
|
397
400
|
break
|
|
398
401
|
|
|
399
402
|
loop_metadata = response.usage_metadata
|
|
@@ -403,11 +406,10 @@ class GenAIFunctionProcessor:
|
|
|
403
406
|
"candidates_token_count": usage_metadata["candidates_token_count"] + (loop_metadata.candidates_token_count or 0),
|
|
404
407
|
"total_token_count": usage_metadata["total_token_count"] + (loop_metadata.total_token_count or 0),
|
|
405
408
|
}
|
|
406
|
-
|
|
407
|
-
"\n-- Agent response
|
|
408
|
-
f"
|
|
409
|
-
f"
|
|
410
|
-
f"total_token_count: [{loop_metadata.total_token_count}]/[{usage_metadata['total_token_count']}] \n"
|
|
409
|
+
token_queue.append((
|
|
410
|
+
"\n-- Agent response -- "
|
|
411
|
+
f"Loop tokens: [{loop_metadata.prompt_token_count}]/[{usage_metadata['prompt_token_count']}] "
|
|
412
|
+
f"Session tokens: [{loop_metadata.total_token_count}]/[{usage_metadata['total_token_count']}] \n"
|
|
411
413
|
))
|
|
412
414
|
loop_metadata = None
|
|
413
415
|
|
|
@@ -419,20 +421,20 @@ class GenAIFunctionProcessor:
|
|
|
419
421
|
try:
|
|
420
422
|
if hasattr(chunk, 'text') and isinstance(chunk.text, str):
|
|
421
423
|
token = chunk.text
|
|
422
|
-
|
|
424
|
+
token_queue.append(token)
|
|
423
425
|
big_text += token
|
|
424
426
|
this_text += token
|
|
425
427
|
else:
|
|
426
428
|
log.info("skipping chunk with no text")
|
|
427
429
|
|
|
428
430
|
except ValueError as err:
|
|
429
|
-
|
|
431
|
+
token_queue.append(f"{str(err)} for {chunk=}")
|
|
430
432
|
|
|
431
433
|
executed_responses = self.process_funcs(response)
|
|
432
434
|
log.info(f"[{guardrail}] {executed_responses=}")
|
|
433
435
|
|
|
434
436
|
if executed_responses:
|
|
435
|
-
|
|
437
|
+
token_queue.append("\n-- Agent Actions:\n")
|
|
436
438
|
for executed_response in executed_responses:
|
|
437
439
|
token = ""
|
|
438
440
|
fn = executed_response.function_response.name
|
|
@@ -442,10 +444,13 @@ class GenAIFunctionProcessor:
|
|
|
442
444
|
log.info(fn_log)
|
|
443
445
|
functions_called.append(fn_log)
|
|
444
446
|
function_results.append(fn_result)
|
|
445
|
-
|
|
447
|
+
token_queue.append(f"\n-- {fn_log} ...executing...\n") if fn != "decide_to_go_on" else ""
|
|
448
|
+
while token_queue:
|
|
449
|
+
token = token_queue.popleft()
|
|
450
|
+
callback.on_llm_new_token(token=token)
|
|
446
451
|
|
|
447
452
|
try:
|
|
448
|
-
|
|
453
|
+
# Convert MapComposite to a standard Python dictionary
|
|
449
454
|
if isinstance(fn_result, proto.marshal.collections.maps.MapComposite):
|
|
450
455
|
fn_result = dict(fn_result)
|
|
451
456
|
fn_result_json = json.loads(fn_result)
|
|
@@ -463,12 +468,12 @@ class GenAIFunctionProcessor:
|
|
|
463
468
|
log.info(f"{fn_result_json} {fn_result=} {type(fn_result)}")
|
|
464
469
|
go_on_args = fn_result_json
|
|
465
470
|
if go_on_args:
|
|
466
|
-
token = f"\n
|
|
471
|
+
token = f"\n{'STOPPING' if not go_on_args.get('go_on') else 'CONTINUE'}: {go_on_args.get('chat_summary')}\n"
|
|
467
472
|
else:
|
|
468
473
|
log.warning(f"{fn_result_json} did not work for decide_to_go_on")
|
|
469
474
|
token = f"Error calling decide_to_go_on with {fn_result_json}\n"
|
|
470
475
|
else:
|
|
471
|
-
token = f"--- {fn}
|
|
476
|
+
token = f"--- {fn}() result --- \n"
|
|
472
477
|
if fn_result_json:
|
|
473
478
|
if fn_result_json.get('stdout'):
|
|
474
479
|
text = fn_result_json.get('stdout').encode('utf-8').decode('unicode_escape')
|
|
@@ -479,14 +484,14 @@ class GenAIFunctionProcessor:
|
|
|
479
484
|
if not fn_result_json.get('stdout') and fn_result_json.get('stderr'):
|
|
480
485
|
token += f"{fn_result}\n"
|
|
481
486
|
else:
|
|
482
|
-
token += f"{fn_result}\n---
|
|
487
|
+
token += f"{fn_result}\n--- end ---\n"
|
|
483
488
|
|
|
484
489
|
big_text += token
|
|
485
490
|
this_text += token
|
|
486
|
-
|
|
491
|
+
token_queue.append(token)
|
|
487
492
|
else:
|
|
488
493
|
token = "\nNo function executions were found\n"
|
|
489
|
-
|
|
494
|
+
token_queue.append(token)
|
|
490
495
|
big_text += token
|
|
491
496
|
this_text += token
|
|
492
497
|
|
|
@@ -497,20 +502,26 @@ class GenAIFunctionProcessor:
|
|
|
497
502
|
log.warning(f"[{guardrail}] No content created this loop")
|
|
498
503
|
content.append(f"Agent: No response was found for loop [{guardrail}]")
|
|
499
504
|
|
|
500
|
-
|
|
501
|
-
token=f"\n----Loop [{guardrail}] End------\n{usage_metadata}\n----------------------"
|
|
502
|
-
)
|
|
505
|
+
token_queue.append(f"\n----Loop [{guardrail}] End------\n{usage_metadata}\n----------------------")
|
|
503
506
|
|
|
504
507
|
go_on_check = self.check_function_result("decide_to_go_on", {"go_on": False})
|
|
505
508
|
if go_on_check:
|
|
506
509
|
log.info("Breaking agent loop")
|
|
507
510
|
break
|
|
508
511
|
|
|
512
|
+
while token_queue:
|
|
513
|
+
token = token_queue.popleft()
|
|
514
|
+
callback.on_llm_new_token(token=token)
|
|
515
|
+
|
|
509
516
|
guardrail += 1
|
|
510
517
|
if guardrail > guardrail_max:
|
|
511
|
-
log.warning("Guardrail kicked in, more than
|
|
518
|
+
log.warning(f"Guardrail kicked in, more than {guardrail_max} loops")
|
|
512
519
|
break
|
|
513
520
|
|
|
521
|
+
while token_queue:
|
|
522
|
+
token = token_queue.popleft()
|
|
523
|
+
callback.on_llm_new_token(token=token)
|
|
524
|
+
|
|
514
525
|
usage_metadata["functions_called"] = functions_called
|
|
515
526
|
#usage_metadata["function_results"] = function_results
|
|
516
527
|
|
|
@@ -26,14 +26,12 @@ class ConfigManager:
|
|
|
26
26
|
agent = config.vacConfig("agent")
|
|
27
27
|
```
|
|
28
28
|
"""
|
|
29
|
-
print(f"Current working directory: {os.getcwd()}")
|
|
30
29
|
if os.getenv("VAC_CONFIG_FOLDER") is None:
|
|
31
30
|
print("WARNING: No VAC_CONFIG_FOLDER environment variable was specified")
|
|
32
31
|
local_config_folder = os.path.join(os.getcwd(), "config")
|
|
33
|
-
if os.path.isdir(local_config_folder):
|
|
34
|
-
print(f"Found local config folder {local_config_folder} - will overwrite any global configurations")
|
|
35
|
-
else:
|
|
32
|
+
if not os.path.isdir(local_config_folder):
|
|
36
33
|
local_config_folder = None
|
|
34
|
+
|
|
37
35
|
if os.getenv("VAC_CONFIG_FOLDER") is None and local_config_folder is None:
|
|
38
36
|
raise ValueError(f"Must have either a local config/ folder in this dir ({os.getcwd()}/config/) or a folder specified via the VAC_CONFIG_FOLDER environment variable, or both.")
|
|
39
37
|
|
|
@@ -151,7 +149,7 @@ class ConfigManager:
|
|
|
151
149
|
|
|
152
150
|
self.config_cache[filename] = (config, datetime.now())
|
|
153
151
|
if is_local:
|
|
154
|
-
log.
|
|
152
|
+
log.info(f"Local configuration override for {filename} via {self.local_config_folder}")
|
|
155
153
|
return config
|
|
156
154
|
|
|
157
155
|
def _check_and_reload_configs(self):
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.92.
|
|
3
|
+
Version: 0.92.6
|
|
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.92.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.92.6.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|