sunholo 0.136.0__py3-none-any.whl → 0.136.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.
@@ -487,23 +487,34 @@ class DiscoveryEngineClient:
487
487
  all_documents = []
488
488
  result_count = 0
489
489
  # Check if the response contains results
490
- if not hasattr(response, 'results') or not response.results:
490
+ if not response or not hasattr(response, 'results') or not response.results:
491
491
  log.info(f'No results found in response: {response=}')
492
492
  return []
493
493
 
494
- # Iterate through each result in the page
495
- for result in response.results:
496
- if hasattr(result, 'document'):
497
- document = result.document
498
- all_documents.append(self.document_format(document))
499
- result_count += 1
500
-
501
- # Check if we've reached max_limit
502
- if max_limit is not None and result_count >= max_limit:
503
- log.info(f"Reached max_limit of {max_limit} results, stopping processing")
504
- break
505
- else:
506
- log.warning("No document found in result")
494
+ should_break=False
495
+ # Process the pager properly
496
+ for page in response.pages:
497
+ if should_break:
498
+ break
499
+ if hasattr(page, 'results') and page.results:
500
+ for result in page.results:
501
+ if result_count >= max_limit:
502
+ log.info("Breaking results loop as max limit reached")
503
+ should_break = True # Set flag to break outer loop
504
+ break
505
+
506
+ if hasattr(result, 'document'):
507
+ document = result.document
508
+ all_documents.append(self.document_format(document))
509
+ result_count += 1
510
+
511
+ # Check if we've reached max_limit
512
+ if max_limit is not None and result_count >= max_limit:
513
+ log.info(f"Reached max_limit of {max_limit} results, stopping processing")
514
+ should_break = True
515
+ break
516
+ else:
517
+ log.warning("No document found in result")
507
518
 
508
519
  # Combine all documents into one long string
509
520
  result_string = "\n\n".join(all_documents)
@@ -516,23 +527,34 @@ class DiscoveryEngineClient:
516
527
  result_count = 0
517
528
 
518
529
  # Check if the response contains results
519
- if not hasattr(response, 'results') or not response.results:
530
+ if not response or not hasattr(response, 'results') or not response.results:
520
531
  log.info(f'No results found in response: {response=}')
521
532
  return []
522
-
523
- # Iterate through each result in the page
524
- for result in response.results:
525
- if hasattr(result, 'document'):
526
- document = result.document
527
- all_documents.append(self.document_format(document))
528
- result_count += 1
529
-
530
- # Check if we've reached max_limit
531
- if max_limit is not None and result_count >= max_limit:
532
- log.info(f"Reached max_limit of {max_limit} results, stopping processing")
533
- break
534
- else:
535
- log.warning("No document found in result")
533
+
534
+ should_break=False
535
+ # Process the pager properly
536
+ async for page in response.pages:
537
+ if should_break:
538
+ break
539
+ if hasattr(page, 'results') and page.results:
540
+ for result in page.results:
541
+ if result_count >= max_limit:
542
+ log.info("Breaking results loop as max limit reached")
543
+ should_break = True # Set flag to break outer loop
544
+ break
545
+
546
+ if hasattr(result, 'document'):
547
+ document = result.document
548
+ all_documents.append(self.document_format(document))
549
+ result_count += 1
550
+
551
+ # Check if we've reached max_limit
552
+ if max_limit is not None and result_count >= max_limit:
553
+ log.info(f"Reached max_limit of {max_limit} results, stopping processing")
554
+ should_break = True
555
+ break
556
+ else:
557
+ log.warning("No document found in result")
536
558
 
537
559
  # Combine all documents into one long string
538
560
  result_string = "\n\n".join(all_documents)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.136.0
3
+ Version: 0.136.1
4
4
  Summary: AI DevOps - a package to help deploy GenAI to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
@@ -75,7 +75,7 @@ sunholo/discovery_engine/__init__.py,sha256=hLgqRDJ22Aov9o2QjAEfsVgnL3kMdM-g5p8R
75
75
  sunholo/discovery_engine/chunker_handler.py,sha256=wkvXl4rFtYfN6AZUKdW9_QD49Whf77BukDbO82UwlAg,7480
76
76
  sunholo/discovery_engine/cli.py,sha256=tsKqNSDCEsDTz5-wuNwjttb3Xt35D97-KyyEiaqolMQ,35628
77
77
  sunholo/discovery_engine/create_new.py,sha256=WUi4_xh_dFaGX3xA9jkNKZhaR6LCELjMPeRb0hyj4FU,1226
78
- sunholo/discovery_engine/discovery_engine_client.py,sha256=xOcOj7D49bh7aKvDM1KujrFxu8dhgbFugSJv-fUPjt0,62444
78
+ sunholo/discovery_engine/discovery_engine_client.py,sha256=-0vSF4vd26ihhj7_XkxZJ6TvUCJrThLxZ8lMSTe5vqs,63448
79
79
  sunholo/discovery_engine/get_ai_search_chunks.py,sha256=I6Dt1CznqEvE7XIZ2PkLqopmjpO96iVEWJJqL5cJjOU,5554
80
80
  sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
81
81
  sunholo/embedder/embed_chunk.py,sha256=did2pKkWM2o0KkRcb0H9l2x_WjCq6OyuHDxGbITFKPM,6530
@@ -168,9 +168,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
168
168
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
169
169
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
170
170
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
171
- sunholo-0.136.0.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
- sunholo-0.136.0.dist-info/METADATA,sha256=VeoffpbDPqtye_pewu_LASUZo-79qT6Rpb4UjrG1TQ8,10067
173
- sunholo-0.136.0.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
174
- sunholo-0.136.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
- sunholo-0.136.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
- sunholo-0.136.0.dist-info/RECORD,,
171
+ sunholo-0.136.1.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
+ sunholo-0.136.1.dist-info/METADATA,sha256=2aeqbpV_AQcKkI1c_WUgZh63q6a7ZMNaAbk5C9fSzAY,10067
173
+ sunholo-0.136.1.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
174
+ sunholo-0.136.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
+ sunholo-0.136.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
+ sunholo-0.136.1.dist-info/RECORD,,