sunholo 0.95.0__py3-none-any.whl → 0.95.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.
@@ -153,42 +153,44 @@ def print_grounding_response(response):
153
153
  prev_index = 0
154
154
  markdown_text = ""
155
155
 
156
- sources: dict[str, str] = {}
157
- footnote = 1
158
- for attribution in grounding_metadata.grounding_attributions:
159
- context = attribution.web or attribution.retrieved_context
160
- if not context:
161
- log.info(f"Skipping Grounding Attribution {attribution}")
162
- continue
163
-
164
- title = context.title
165
- uri = context.uri
166
- end_index = int(attribution.segment.end_index)
156
+ for grounding_support in grounding_metadata.grounding_supports:
157
+ text_segment = text_bytes[
158
+ prev_index : grounding_support.segment.end_index
159
+ ].decode(ENCODING)
167
160
 
168
- if uri not in sources:
169
- sources[uri] = {"title": title, "footnote": footnote}
170
- footnote += 1
161
+ footnotes_text = ""
162
+ for grounding_chunk_index in grounding_support.grounding_chunk_indices:
163
+ footnotes_text += f"[{grounding_chunk_index + 1}]"
171
164
 
172
- text_segment = text_bytes[prev_index:end_index].decode(ENCODING)
173
- markdown_text += f"{text_segment} [[{sources[uri]['footnote']}]]({uri})"
174
- prev_index = end_index
165
+ markdown_text += f"{text_segment} {footnotes_text}\n"
166
+ prev_index = grounding_support.segment.end_index
175
167
 
176
168
  if prev_index < len(text_bytes):
177
169
  markdown_text += str(text_bytes[prev_index:], encoding=ENCODING)
178
170
 
179
- markdown_text += "\n## Grounding Sources\n"
171
+ markdown_text += "\n----\n## Grounding Sources\n"
180
172
 
181
173
  if grounding_metadata.web_search_queries:
182
174
  markdown_text += (
183
175
  f"\n**Web Search Queries:** {grounding_metadata.web_search_queries}\n"
184
176
  )
177
+ if grounding_metadata.search_entry_point:
178
+ markdown_text += f"\n**Search Entry Point:**\n {grounding_metadata.search_entry_point.rendered_content}\n"
185
179
  elif grounding_metadata.retrieval_queries:
186
180
  markdown_text += (
187
181
  f"\n**Retrieval Queries:** {grounding_metadata.retrieval_queries}\n"
188
182
  )
189
183
 
190
- for uri, source in sources.items():
191
- markdown_text += f"{source['footnote']}. [{source['title']}]({uri})\n"
192
-
193
- log.info(markdown_text)
194
- return markdown_text
184
+ markdown_text += "### Grounding Chunks\n"
185
+
186
+ for index, grounding_chunk in enumerate(
187
+ grounding_metadata.grounding_chunks, start=1
188
+ ):
189
+ context = grounding_chunk.web or grounding_chunk.retrieved_context
190
+ if not context:
191
+ print(f"Skipping Grounding Chunk {grounding_chunk}")
192
+ continue
193
+
194
+ markdown_text += f"{index}. [{context.title}]({context.uri})\n"
195
+
196
+ return markdown_text
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.95.0
3
+ Version: 0.95.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.95.0.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.95.1.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -141,12 +141,12 @@ sunholo/vertex/extensions_call.py,sha256=QeQbL3aAHlc4_-SynOzooZ_3xkQWAlcgNmFBSwL
141
141
  sunholo/vertex/extensions_class.py,sha256=2QGW28lNjoMEnaoVb3QcqEDwphclIsZthnpLUi5_Ivo,21033
142
142
  sunholo/vertex/genai_functions.py,sha256=2z6grM9H0Z79Yzx88l8mE1wXck3bRa0TWvnqZZ9ifDc,2051
143
143
  sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
144
- sunholo/vertex/memory_tools.py,sha256=q_phxgGX2TG2j2MXNULF2xGzQnQPENwjPN9nZ_A9Gh0,7526
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.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.95.0.dist-info/METADATA,sha256=Ot1yshHTv-QqO_hNg1O7TElzvyDaopq3Ohij0_cyQJg,7889
149
- sunholo-0.95.0.dist-info/WHEEL,sha256=5Mi1sN9lKoFv_gxcPtisEVrJZihrm_beibeg5R6xb4I,91
150
- sunholo-0.95.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.95.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.95.0.dist-info/RECORD,,
147
+ sunholo-0.95.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.95.1.dist-info/METADATA,sha256=eGcN3ki323hTYiSMUNGlgJCDQI_r1hxVLHbwksnSdXg,7889
149
+ sunholo-0.95.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
+ sunholo-0.95.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.95.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.95.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.0.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5