sunholo 0.101.8__py3-none-any.whl → 0.101.11__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/gcs/add_file.py CHANGED
@@ -24,40 +24,7 @@ except ImportError:
24
24
 
25
25
  from ..custom_logging import log
26
26
  from ..utils import ConfigManager
27
-
28
- def guess_image_type(file_path: str) -> str:
29
- """
30
- Guess the image type based on the file extension.
31
-
32
- Args:
33
- file_path (str): The path or URL of the image file.
34
-
35
- Returns:
36
- str: The guessed image type (e.g., "jpeg", "png", "gif", etc.)
37
- or None if the extension is not recognized.
38
- """
39
- # Extract the file extension
40
- _, ext = os.path.splitext(file_path)
41
-
42
- # Normalize and remove the leading dot
43
- ext = ext.lower().strip('.')
44
-
45
- # Mapping of common file extensions to image types
46
- extension_to_type = {
47
- "jpg": "image/jpeg",
48
- "jpeg": "image/jpeg",
49
- "png": "image/png",
50
- "gif": "image/gif",
51
- "bmp": "image/bmp",
52
- "tiff": "image/tiff",
53
- "tif": "image/tiff",
54
- "webp": "image/webp",
55
- "ico": "image/ico",
56
- "svg": "image/svg",
57
- "pdf": "application/pdf",
58
- }
59
-
60
- return extension_to_type.get(ext.lower(), None)
27
+ from ..utils.mime import guess_mime_type
61
28
 
62
29
 
63
30
  def handle_base64_image(base64_data: str, vector_name: str, extension: str):
@@ -92,7 +59,7 @@ def handle_base64_image(base64_data: str, vector_name: str, extension: str):
92
59
  os.remove(filename) # Clean up the saved file
93
60
 
94
61
  # Determine MIME type based on extension
95
- mime_type = guess_image_type(extension) or "application/octet-stream"
62
+ mime_type = guess_mime_type(extension) or "application/octet-stream"
96
63
 
97
64
  return image_uri, mime_type
98
65
  except Exception as e:
@@ -15,6 +15,7 @@ try:
15
15
  from google.generativeai.types import RequestOptions
16
16
  from google.api_core import retry
17
17
  from google.generativeai import ChatSession
18
+ from google.api_core.exceptions import RetryError
18
19
  except ImportError:
19
20
  genai = None
20
21
  ChatSession = None
@@ -441,15 +442,20 @@ class GenAIFunctionProcessor:
441
442
  initial=10,
442
443
  multiplier=2,
443
444
  maximum=60,
444
- timeout=60
445
+ timeout=90
445
446
  )
446
447
  ))
448
+ except RetryError as err:
449
+ msg = f"Retry error - lets try again if its occured less than twice: {str(err)}"
450
+ log.warning(msg)
451
+ token_queue.append(msg)
452
+ this_text += msg
447
453
 
448
454
  except Exception as e:
449
455
  msg = f"Error sending {content} to model: {str(e)} - {traceback.format_exc()}"
450
456
  log.info(msg)
451
457
  token_queue.append(msg)
452
- break
458
+ this_text += msg
453
459
 
454
460
  loop_metadata = response.usage_metadata
455
461
  if loop_metadata:
sunholo/utils/mime.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import os
2
+ from ..custom_logging import log
2
3
 
3
4
  def guess_mime_type(file_path: str) -> str:
4
5
  """
@@ -18,6 +19,7 @@ def guess_mime_type(file_path: str) -> str:
18
19
  ext = ext.lower().strip('.')
19
20
 
20
21
  # Mapping of common file extensions to file types
22
+ log.info(f"Guessing {file_path} is {ext}")
21
23
  extension_to_type = {
22
24
  "jpg": "image/jpeg",
23
25
  "jpeg": "image/jpeg",
@@ -59,6 +61,8 @@ def guess_mime_type(file_path: str) -> str:
59
61
  "tsx": "text/tsx",
60
62
  "jsx": "text/jsx",
61
63
  }
62
-
63
- return extension_to_type.get(ext, "")
64
+ mime=extension_to_type.get(ext, "")
65
+ log.info(f"Guessing {file_path} with {ext=} is {mime=}")
66
+
67
+ return mime
64
68
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.101.8
3
+ Version: 0.101.11
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.101.8.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.101.11.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -80,7 +80,7 @@ sunholo/embedder/embed_chunk.py,sha256=_FdO4-9frUJlDPqXv2Ai49ejUrrMTMGti3D7bfJGf
80
80
  sunholo/excel/__init__.py,sha256=AqTMN9K4qJYi4maEgoORc5oxDVGO_eqmwzDaVP37JgY,56
81
81
  sunholo/excel/plugin.py,sha256=rl3FoECZ6Ts8KKExPrbPwr3u3CegZfsevmcjgUXAlhE,4033
82
82
  sunholo/gcs/__init__.py,sha256=SZvbsMFDko40sIRHTHppA37IijvJTae54vrhooEF5-4,90
83
- sunholo/gcs/add_file.py,sha256=vqgt71BodjVWKb-slr24lE0b12_ipFIbFyiSuPCVHGA,9081
83
+ sunholo/gcs/add_file.py,sha256=OAKEtLWPu5IK5XNxuPSBhbIlSSytIln-Evz2VbZ6O-4,8170
84
84
  sunholo/gcs/download_folder.py,sha256=ijJTnS595JqZhBH8iHFErQilMbkuKgL-bnTCMLGuvlA,1614
85
85
  sunholo/gcs/download_url.py,sha256=Ul81n1rklr8WogPsuxWWD1Nr8RHU451LzHPMJNhAKzw,6416
86
86
  sunholo/gcs/extract_and_sign.py,sha256=paRrTCvCN5vkQwCB7OSkxWi-pfOgOtZ0bwdXE08c3Ps,1546
@@ -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=eW5V2h2JdNqLkaw_u-pJSzu7edHzvrCWPLirolQXX5s,1617
90
90
  sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
91
- sunholo/genai/process_funcs_cls.py,sha256=r8WF0kF5nYhC3qBb9p8X5101taq3lvfhEqs3EPg5QJY,28799
91
+ sunholo/genai/process_funcs_cls.py,sha256=Hj8iahgr-b21F0CbD5QySXBoDaJwzjCmRWalb-3lsz8,29105
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
@@ -134,7 +134,7 @@ sunholo/utils/config_class.py,sha256=aNhxhEHIxRvqQNq_9wFJt1yM9U1ypahCVZ3NzPWuay4
134
134
  sunholo/utils/config_schema.py,sha256=Wv-ncitzljOhgbDaq9qnFqH5LCuxNv59dTGDWgd1qdk,4189
135
135
  sunholo/utils/gcp.py,sha256=uueODEpA-P6O15-t0hmcGC9dONLO_hLfzSsSoQnkUss,4854
136
136
  sunholo/utils/gcp_project.py,sha256=Fa0IhCX12bZ1ctF_PKN8PNYd7hihEUfb90kilBfUDjg,1411
137
- sunholo/utils/mime.py,sha256=IBir-PcIkwM6GCWsohOkCXqdQWO6PxIgvmXOtaeu71U,1869
137
+ sunholo/utils/mime.py,sha256=7_J1PnWOlvAPRoHWKESAncdRVVldVwRdKvuDvi9sRfE,2020
138
138
  sunholo/utils/parsers.py,sha256=wES0fRn3GONoymRXOXt-z62HCoOiUvvFXa-MfKfjCls,6421
139
139
  sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,493
140
140
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
@@ -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.101.8.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
- sunholo-0.101.8.dist-info/METADATA,sha256=ebKNiCxn5C0tp2_i76J48-qN7Uf7R83EvJDY6aLJOPI,8312
152
- sunholo-0.101.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
- sunholo-0.101.8.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
- sunholo-0.101.8.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
- sunholo-0.101.8.dist-info/RECORD,,
150
+ sunholo-0.101.11.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
+ sunholo-0.101.11.dist-info/METADATA,sha256=0qQB1HI5u0PhSxVx1HH_nsyQB6MUAqvYwC8Hi8QNqJo,8314
152
+ sunholo-0.101.11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
+ sunholo-0.101.11.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
+ sunholo-0.101.11.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
+ sunholo-0.101.11.dist-info/RECORD,,