sunholo 0.104.6__py3-none-any.whl → 0.105.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.
@@ -12,7 +12,7 @@ from collections import deque
12
12
  try:
13
13
  import google.generativeai as genai
14
14
  import proto
15
- from google.generativeai.types import RequestOptions
15
+ from google.generativeai.types import RequestOptions, GenerateContentResponse
16
16
  from google.api_core import retry
17
17
  from google.generativeai import ChatSession
18
18
  from google.api_core.exceptions import RetryError
@@ -441,11 +441,11 @@ class GenAIFunctionProcessor:
441
441
 
442
442
  log.info(f"== Start input content for loop [{guardrail}]\n ## Content: {content_parse}")
443
443
  this_text = "" # reset for this loop
444
- response = []
444
+ response = None
445
445
 
446
446
  try:
447
447
  token_queue.append("\n= Calling Agent =\n")
448
- response = chat.send_message(content, stream=True, request_options=RequestOptions(
448
+ response:GenerateContentResponse = chat.send_message(content, stream=True, request_options=RequestOptions(
449
449
  retry=retry.Retry(
450
450
  initial=10,
451
451
  multiplier=2,
@@ -465,19 +465,20 @@ class GenAIFunctionProcessor:
465
465
  token_queue.append(msg)
466
466
  break
467
467
 
468
- loop_metadata = response.usage_metadata
469
- if loop_metadata:
470
- usage_metadata = {
471
- "prompt_token_count": usage_metadata["prompt_token_count"] + (loop_metadata.prompt_token_count or 0),
472
- "candidates_token_count": usage_metadata["candidates_token_count"] + (loop_metadata.candidates_token_count or 0),
473
- "total_token_count": usage_metadata["total_token_count"] + (loop_metadata.total_token_count or 0),
474
- }
475
- token_queue.append((
476
- "\n-- Agent response -- "
477
- f"Loop tokens: [{loop_metadata.prompt_token_count}]/[{usage_metadata['prompt_token_count']}] "
478
- f"Session tokens: [{loop_metadata.total_token_count}]/[{usage_metadata['total_token_count']}] \n"
479
- ))
480
- loop_metadata = None
468
+ if response:
469
+ loop_metadata = response.usage_metadata
470
+ if loop_metadata:
471
+ usage_metadata = {
472
+ "prompt_token_count": usage_metadata["prompt_token_count"] + (loop_metadata.prompt_token_count or 0),
473
+ "candidates_token_count": usage_metadata["candidates_token_count"] + (loop_metadata.candidates_token_count or 0),
474
+ "total_token_count": usage_metadata["total_token_count"] + (loop_metadata.total_token_count or 0),
475
+ }
476
+ token_queue.append((
477
+ "\n-- Agent response -- "
478
+ f"Loop tokens: [{loop_metadata.prompt_token_count}]/[{usage_metadata['prompt_token_count']}] "
479
+ f"Session tokens: [{loop_metadata.total_token_count}]/[{usage_metadata['total_token_count']}] \n"
480
+ ))
481
+ loop_metadata = None
481
482
 
482
483
  for chunk in response:
483
484
  if not chunk:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.104.6
3
+ Version: 0.105.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.104.6.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.105.0.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -88,7 +88,7 @@ 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=EyjsDqt6XQw99pZUQamomCpMOoIah9bp3XY94WPU7Ms,1678
90
90
  sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
91
- sunholo/genai/process_funcs_cls.py,sha256=6NZiYd9VWEzRN_-25PvOpBnQcfuJfWMuqi2hgAYm9ls,29530
91
+ sunholo/genai/process_funcs_cls.py,sha256=aO23nFLYCJEQ1ZR1rWefSNaqpUg4KXJGIua_ouDVR8E,29658
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
@@ -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.104.6.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
- sunholo-0.104.6.dist-info/METADATA,sha256=kOR4eTd1sEjgHhwLIy6EK1KihYG3aMGKyG3c2N029K4,8312
152
- sunholo-0.104.6.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
- sunholo-0.104.6.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
- sunholo-0.104.6.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
- sunholo-0.104.6.dist-info/RECORD,,
150
+ sunholo-0.105.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
+ sunholo-0.105.0.dist-info/METADATA,sha256=VJ8EeXPxQ19YS2iUjsBY5W5V-4vBdxtHwowutoeMMiE,8312
152
+ sunholo-0.105.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
153
+ sunholo-0.105.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
+ sunholo-0.105.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
+ sunholo-0.105.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5