sunholo 0.85.3__py3-none-any.whl → 0.86.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/genai/__init__.py CHANGED
@@ -1,2 +1,3 @@
1
1
  from .process_funcs_cls import GenAIFunctionProcessor
2
2
  from .safety import genai_safety
3
+ from .init import init_genai
sunholo/genai/init.py ADDED
@@ -0,0 +1,18 @@
1
+ import os
2
+
3
+ def init_genai():
4
+ """
5
+ There are some features that come to the google.generativeai first,
6
+ which needs to be authenticated via a GOOGLE_API_KEY environment variable,
7
+ created via the Google AI Console at https://aistudio.google.com/app/apikey
8
+ """
9
+ try:
10
+ import google.generativeai as genai
11
+ except ImportError:
12
+ raise ImportError("google.generativeai not installed, please install via 'pip install sunholo'[gcp]'")
13
+
14
+ GOOGLE_API_KEY=os.getenv('GOOGLE_API_KEY')
15
+ if not GOOGLE_API_KEY:
16
+ raise ValueError("google.generativeai needs GOOGLE_API_KEY set in environment variable")
17
+
18
+ genai.configure(api_key=GOOGLE_API_KEY)
@@ -6,6 +6,8 @@ from .safety import genai_safety
6
6
 
7
7
  from typing import TYPE_CHECKING, Union
8
8
 
9
+ import json
10
+
9
11
  try:
10
12
  import google.generativeai as genai
11
13
  except ImportError:
@@ -58,7 +60,7 @@ class GenAIFunctionProcessor:
58
60
 
59
61
  self.config = config
60
62
  self.funcs = self.construct_tools()
61
- self.model_name = config.vacConfig("model") or "gemini-1.5-flash"
63
+ self.model_name = config.vacConfig("model") if config.vacConfig("llm") == "vertex" else "gemini-1.5-flash"
62
64
  self.last_api_requests_and_responses = []
63
65
  self._validate_functions()
64
66
 
@@ -111,7 +113,7 @@ class GenAIFunctionProcessor:
111
113
  Part(
112
114
  function_response=genai.protos.FunctionResponse(
113
115
  name=part[0],
114
- response={"result": part[2]}
116
+ response={"result": part[2], "args": json.dumps(part[1])}
115
117
  )
116
118
  )
117
119
  )
@@ -146,6 +148,13 @@ class GenAIFunctionProcessor:
146
148
  if isinstance(result, list) and target_value in result:
147
149
  log.info(f"Target value '{target_value}' found in the result of function '{function_name}'.")
148
150
  return True
151
+ elif isinstance(result, dict) and isinstance(target_value, dict):
152
+ for key, expected_value in target_value.items():
153
+ if key in result:
154
+ if result[key] == expected_value:
155
+ log.info(f"The key '{key}' has the same value in both dictionaries.")
156
+ return True
157
+ return False
149
158
  elif result == target_value:
150
159
  log.info(f"Target value '{target_value}' found in the result of function '{function_name}'.")
151
160
  return True
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.85.3
3
+ Version: 0.86.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.85.3.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.86.1.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -84,8 +84,9 @@ sunholo/gcs/add_file.py,sha256=TRbdEd3j-lFnyC7kqs5IWEPMPlDMFLR68fdTWga06Wo,8096
84
84
  sunholo/gcs/download_folder.py,sha256=ijJTnS595JqZhBH8iHFErQilMbkuKgL-bnTCMLGuvlA,1614
85
85
  sunholo/gcs/download_url.py,sha256=q1NiJSvEhdNrmU5ZJ-sBCMC_J5CxzrajY8LRgdPOV_M,6130
86
86
  sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
87
- sunholo/genai/__init__.py,sha256=o2c17UbgzIDxNKKF8deCLoctNpatAYgm9Cf9XDfpqvg,87
88
- sunholo/genai/process_funcs_cls.py,sha256=xnSxGGEHO7fYct8VkjaOKSBmHG-cEkvFTZqFLsN_oCc,11798
87
+ sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
88
+ sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
89
+ sunholo/genai/process_funcs_cls.py,sha256=8aEsa4PYSMFM-nfBJEB6bmunfOdGRcrPyGofzCXrcPc,12315
89
90
  sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
90
91
  sunholo/invoke/__init__.py,sha256=bELcqIjzKvaupcIN5OQmDgGx_8jARtH9T6PCe8UgcvE,99
91
92
  sunholo/invoke/async_class.py,sha256=vmLT6DqE1YaPd4W88_QzPQvSzsjwLUAwt23vGZm-BEs,5767
@@ -140,9 +141,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
140
141
  sunholo/vertex/memory_tools.py,sha256=q_phxgGX2TG2j2MXNULF2xGzQnQPENwjPN9nZ_A9Gh0,7526
141
142
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
142
143
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
143
- sunholo-0.85.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
144
- sunholo-0.85.3.dist-info/METADATA,sha256=Zl6FrkaxNICv045YTjTHxJI7gztNukIOutw4YVRxqlw,7598
145
- sunholo-0.85.3.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
146
- sunholo-0.85.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
147
- sunholo-0.85.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
148
- sunholo-0.85.3.dist-info/RECORD,,
144
+ sunholo-0.86.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
145
+ sunholo-0.86.1.dist-info/METADATA,sha256=33nerpBWHKZTB-opKzrasdhI3cosYq0D-imCPCNeCuc,7598
146
+ sunholo-0.86.1.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
147
+ sunholo-0.86.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
148
+ sunholo-0.86.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
149
+ sunholo-0.86.1.dist-info/RECORD,,